What is the String Concatenation
+ Operator is employed to concatenate strings
- System.out.pritln ("Hello" + "World") will print Hello World on console
String concatenated with any other data type like int will also convert that datatype to String and result would be a concatenated String displayed on console. E.g.,
- int i = 4;
- int j = 5;
System.out.println ("Hello" + i)
will print Hello 4 on screen
- However
System.out.println( i+j) ;
will print 9 on the console because both i and j are of type int.