ToUpperCase and toLowerCase problems

Joined
Aug 5, 2008
Messages
2
Reaction score
0
import javax.swing.JOptionPane;
import java.io.*;
import java.util.*;
import java.lang.*;
public class lowercasesandupper {

public static void main(String[]args)
{
String message;
int i;
String letter;
char let;
message=JOptionPane.showInputDialog("Enter the string: ");
message.length();

for(i=0;i<=message.length();i++)
{
letter = message.substring(i,i+1);
//message.charAt(i);
if(letter == message.toUpperCase())
{
System.out.println("Convert: "+letter.toLowerCase());
}
else
{
System.out.println("Convert: "+letter.toUpperCase());
}
}
}


}
/* I've been making this program for almost 3 days but I can't find the right algorithm..I want to convert all lowercase letters in a string to uppercase letters,and vice versa. For example, JIM will be converted to jim or anTHOny will be converted to ANthoNY. what's wrong with my program?*/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top