Java

Java - String Manipulation

Java - String Manipulation
class str1 
{ 
public static void main(String arg[]) 
{ 
String s1 = "Hello World"; 
String s2 = "hello"; 
String s3 = "world"; 
String s4 = "JAVA"; 
String s5 = "programming"; 
String s6 = "hello"; 

System.out.println("\nString : "+s1); 

System.out.println("\nLength : "+s1.length()); 

System.out.println("\nConcatination : "+s2.concat(s3)); 

System.out.println("\nSub String : "+s1.substring(6)); 

System.out.println("\nSub String : "+s1.substring(3,8)); 

System.out.println("\nEquals : "+s2.equals(s3)); 

System.out.println("\nEquals : "+s2.equals(s6)); 

System.out.println("\nUpper case : "+s5.toUpperCase()); 

System.out.println("\nLower case : "+s4.toLowerCase()); 

System.out.println("\nTrim : "+s1.trim()); 
} 
}
Senthilvelan Sambamoorthy

Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.