public class Primitive { public static void main( String args[] ) { char ch1 = 65 ; System.out.println( ch1 ) ; //Characters are written using single //quotes ch1 = 'A' ; System.out.println( ch1 ) ; //Internall a character is just a number System.out.println( (int)(ch1) ) ; //The above casts a character to a number //implicit cast //no loss of data int x1 = ch1 ; //f needed because 3.1416 is a double literal float f1 = 3.1416f ; int i1 ; System.out.println( "Default value of i1: " + i1 ) ; //i1 = f1 ; //Won't compile... possible lossy conversion //Explicit cast needed i1 = (int)f1 ; System.out.println( "Value of i1: " + i1 ) ; } }