Thursday, August 25, 2011

Java data type example


//Use of java data types .
public class JavaVariables
{
public static void main(String args[])
{
int i = 10;
float f = 20;
double d = 10.55;
char c = 'C';
String s = "Hi! I am a string.";


System.out.println("i = "+i);
System.out.println("f = "+f);
System.out.println("d = "+d);
System.out.println("c = "+c);
System.out.println("s = "+s);
}
}

Output =>
i = 10
f = 20.0
d = 10.55
c = C
s = Hi! I am a string.

No comments:

Post a Comment