Sunday, February 22, 2009

Lesson2-java source code

public class OutputVariable {

public static void main( String[] args ){

// Variable value is int primitive type and it is initialized to 10
int value = 10;

// Variable x is char primitive type and it is initialized to 'A'
char x;
x = 'A';

// Variable grade is a double type
double grade = 11;

// Display the value of variable "value" on the standard output device
System.out.println( value );

// Display the value of variable "x" on the standard output device
System.out.println( "The value of x=" + x );

// Display the value of variable "grade" on the standard output device
System.out.println( "The value of grade =" + grade );

}

}

No comments:

Post a Comment