public static void main(String[] args) {
String str1="Shivaji";
String str2 = "Wankhede";
String str3="wa kh ede";
int c=0;
System.out.println("string1="+str1);
System.out.println("string2="+str2);
str1=str1+str2;
str2= str1.substring(0,str1.length() - str2.length());
System.out.println("string2 "+str2);
str1=str1.substring(str2.length());
System.out.println("String1 "+str1);
// counting length of white spaces
for(int i=0;i<=str3.length()-1;i++)
{
if(str3.charAt(i)==' ')
{
c++;
}
}
System.out.println("Blank Spaces: " + c);
//Reverse string
String rev=" ";
for(int i=str2.length()-1;i>=0; i--)
{
rev = rev+str2.charAt(i);
}
System.out.println("reverse string : " + rev);
}
--
String str1="Shivaji";
String str2 = "Wankhede";
String str3="wa kh ede";
int c=0;
System.out.println("string1="+str1);
System.out.println("string2="+str2);
str1=str1+str2;
str2= str1.substring(0,str1.length() - str2.length());
System.out.println("string2 "+str2);
str1=str1.substring(str2.length());
System.out.println("String1 "+str1);
// counting length of white spaces
for(int i=0;i<=str3.length()-1;i++)
{
if(str3.charAt(i)==' ')
{
c++;
}
}
System.out.println("Blank Spaces: " + c);
//Reverse string
String rev=" ";
for(int i=str2.length()-1;i>=0; i--)
{
rev = rev+str2.charAt(i);
}
System.out.println("reverse string : " + rev);
}
With Warm REGARDS,
En. S. WANKHEDE
En. S. WANKHEDE
No comments:
Post a Comment
Welcome, happy learning