Write a Javaprogram to illustrate Java string handling for following functions:
Concatenation of “dbjcollege”,”chiplun”, Reverse of “12721”. Determine whether the two strings:”dbjcollege”,”DBJCollege” are equal or not? Convert the string “Hello World” to uppercase.
Convert the string “Let Us C”to lowercase.Length of the concatenated string above.
source file name: stringdemo1.java
class stringdemo1
{
public static void main(String as[])
{
System.out.println("string demo program");
String str1="dbjcollege";
String str2="chiplun";
StringBuffer sb1=new StringBuffer("12345");
System.out.println("concatenation of 2 strings "+str1.concat(str2));
System.out.println("reverse string "+sb1.reverse());
System.out.println("equal strings "+"dbjcollege".equals("DbjCollege"));
System.out.println("upper case conversion "+"Hello World".toUpperCase());
System.out.println("lower case conversion "+"Let Us C".toLowerCase());
System.out.println("length of concatenation strings "+str1.length());
}
}
0 Comments
Post a Comment