hey guys im kinda new to java n want ur help in solvin this problem :

post: all of the "letter" characters in the entered string will have been switched (lowercase to uppercase, vice versa)

i can only use for loops, character class methods, string methods

heres my code but it doesn't seem to works can u guys fix it ? thnx

public static String switchCase(String s3) 
char c 
{
for ( int i = 0; i == s3.length() -1; i++)
   {
    if (Character.isLowerCase(s3.charAt(i)) == true)
    {
     c = Character.toUpperCase(s3.charAt(i));
     s3 = s3.replace(s3.charAt(i), c); 
    }
    else if (Character.isUpperCase(s3.charAt(i)) == true)
    {
     c = Character.toLowerCase(s3.charAt(i));
     s3 = s3.replace(s3.charAt(i), c); 
}
    }

By the way, to respect universal practive by C/C++/Java/Fortran programmers

for ( int i = 0; i == s3.length() -1; i++)

should be

for ( int i = 0; i < s3.length(); i++)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.