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);
}
}
- int, char, boolean, String is the type of variable.
- int : contents of the variable must be number of integer.
- char : contents of the variable must be character.
- boolean : contents of the variable just true or false.
- String : contents of variable must be letter or words.
- sign + used for separated variable name with out put word like
(result+"Hello"+number+"My"+name);
No comments:
Post a Comment