class tolower
{
private String str1="";
public void changecase()
{
String str2="";
str1=JOptionPane.showInputDialog(null,"Enter a string:");
int len=str1.length();
char ch[]=new char[len];
for(int i=0;i
{ if(str1.charAt(i)>=65 && str1.charAt(i)<=90)
ch[i]=(char)(str1.charAt(i)+32);
else
ch[i]=str1.charAt(i);
}
for(int i=0;i
{
str2+=ch[i];
}
JOptionPane.showMessageDialog(null,"String after changing case is:"+str2);
}
public static void main(String args[])
{
tolower t=new tolower();
t.changecase();
}
}
No comments:
Post a Comment
Your comment may wait for moderation....