Data Types
Lesson 6Author : GOUP
Last Updated : September, 2020
byte age0 = 0; // 8-bit signed two's complement integer short age1 = 10; // 16-bit signed two's complement integer. int age2 = 20; // 32-bit signed two's complement integer long age3 = 30L; // 64-bit optionally signed two's complement integer
float gpa0 = 2.5f; // 32-bit floating point double gpa1 = 3.5; // double-precision 64-bit floating point
boolean isTall; // 1 bit -> true/false isTall = true;
name = "John";
System.out.println("Your name is " + name); System.out.printf("Your name is %s \n", name); /* %f -> double or float %d -> Integer %s -> string %c -> character %b -> boolean */