STRING CONCATINATION OPERATOR

+ is the String concatination operator.
class demo
{
public static void main(String[] args) {
String a="hi";
String b=" bhabani";
String c=a+b;//It concatinates the two strings
System.out.println(c);
}};

Important:
Some value after string with + sign is considered as string.
System.out.println("hi"+5+5);//output hi55
But before string it is calculated.
System.out.println(5+5+"hi");//output 10hi

No comments:

Post a Comment