Java examples for Language Basics:Primitive Types
public class Main { public static void main(String args[]){ int i=110;//from w ww . ja v a 2s .c o m float f = 110.0f; long l = 110; double d=110.0d; char c='a'; boolean b = true; Object o = new String("Hello World"); /* convert int to String */ System.out.println( String.valueOf(i) ); /* convert float to String */ System.out.println( String.valueOf(f) ); /* convert long to String */ System.out.println( String.valueOf(l) ); /* convert double to String */ System.out.println( String.valueOf(d) ); /* convert char to String */ System.out.println( String.valueOf(c) ); /* convert boolean to String */ System.out.println( String.valueOf(b) ); /* convert Object to String */ System.out.println( String.valueOf(o) ); } }