java concat method example

class sm2
{
	public static void main(String args[])
	{
		String str1=new String("I like");
		String str2=new String(" tea");
		System.out.println(str1.concat(str2));
		//another way
		System.out.println(str1+str2);
	}
}

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *