public class ConcatExample
{
public static void main(String args[])
{
String s1="Hello Sukhvir";//Declaration of First String
s1.concat("How are you?");//Concatenation is there but not saved in s1
System.out.println(s1);//Printing of only First String
s1=s1.concat(" Java is a Pure Object Oriented Language");
//Hello Sukhvir and this Line will be the output
//as it is stored in s1
System.out.println(s1);
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.