Primitive Data Types are predefined by the java language and named by a keyword. There are totally eight Primitive Data Types in Java. Based on the data type of a variable, the operating system allocates memory and decides what can be stored in the reserved memory. Therefore, by assigning different data types to variables, we can store various data types in these variables. The following table gives the detail information about Primitive Data Types:
A Java program can contain any number of classes. Following Java program comprises of two classes: TestEmployee1 and Employee1 in two different files. After the creation, save both the files and then compile and them in Command Prompt.