Data Types (Cont.)


Primitive Data Types (Cont.)
Other comments related to primitive data types include:
Concatenate.java (string concatenation)

 public class Concatenate {
   public static void main( String[ ] args ) {
     String[ ] a = { "", "" };     // Spaces allowed
     String b[ ] = { "", "" };     // Spaces allowed
     Integer   c = 20;
     int       d = 20; 
     String    e = a[0] + a[1] + b[0] + b[1] + c + d;
     System.out.println( e );
   }
 }
Output:           Result:

Using the ‘+’ operator is the most common way to concatenate two strings in Java. The operator ‘+’ normally acts as an arithmetic operator unless one of its operands is a String. If so, it converts the other operand to a String before joining the second operand to the end of the first operand.




      Rome was not built in one day.