twitter

Monday, October 24, 2011

Java Programming Chapter 3 (Display Variable)

Ok in this chapter I will share how to display variable
 
    public class DisplayVar {
    public static void main(String[] args) {
        int number = 10;
        char letter = 'a';
        boolean result = true;
        String str = "hello";
        System.out.println("Number = " +number);
        System.out.println("letter = " +letter);
        System.out.println("result = " +result);
        System.out.println("str = " +str);
    }
}


  1. int, char, boolean, String is the type of variable.
  2. int : contents of the variable  must be number of integer.
  3. char : contents of the variable must be character.
  4. boolean : contents of the variable just true or false.
  5. String : contents of variable must be letter or words.
  6. sign + used for separated variable name with out put word like
    (result+"Hello"+number+"My"+name);

No comments:

Post a Comment