216k views
2 votes
Can someone tell me why this code in Java won't run?

if (s.toLowerCase().equals(s.toUpperCase()))
{
System.out.println("*");
}

User MiladiuM
by
8.0k points

1 Answer

5 votes

Answer:

try typing the following:

String lc = s.toLowerCase();

String uc = s.toUpperCase();

if(lc == uc){

System.out.println("*")

}

User JuggernautDad
by
8.2k points