
a java program to create String s1="Â?Abook on java"Â? s2="Â?Ilike it", s3="Dreamtech press" and perform the following operations. i) Display all the 3 strings. ii) Find the length of s2 and s3.7 Iii) Concat s1 and s2. iv) To test if string s1 start with A. V) Extract substring from s3, starting from 5th to 10th

class StringExample
{
public static void main(String[] args)
{
String s1="Abook on java";
String s2="Ilike it";
String s3="Dreamtech press";
System.out.println("First string is: "+s1+" second string is: "+s2+" and third string is: "+s3);
System.out.println("Length of s2: "+s2.length());
System.out.println("Length of s3: "+s3.length());
String concatenatedString=s1.concat(s2);
System.out.println("Concatenated String: "+concatenatedString);
if(s1.startsWith("A")){
System.out.println("String s1 starts with A");
}
else{
System.out.println("String s1 does not start with A");
}
String substring=s3.substring(5,10);
System.out.println("Substring of string s3: "+substring);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.