Wikipedia says "In computer science and computer programming, a data type or simply type is an attribute of data which tells the compiler or interpreter how the programmer intends to use the data. Most programming languages support basic data types of integer numbers (of varying sizes), Floating-point numbers (which approximate real numbers), characters, and Booleans. A data type constrains the values that an expression, such as a variable or a function, might take. This data type defines the operations that can be done on the data, the meaning of the data, and the way values of that type can be stored. A data type provides a set of values from which an expression (i.e. variable, function, etc.) may take its values."
There are 2 types of data types in Java: Primitive and Non-Primitive. In simple words, primitive data types are predefined whereas non-primitive data types are user defined.
A primitive data type specifies the size and type of variable values and has no additional methods. There are 8 primitive data types in Java: byte, short, int, long, float, double, boolean, char. Let us see how to initialize them below.
char c ='s';
Non-primitive data types are called reference types because they refer to objects. There are many non-primitive data types in Java: arrays, strings, classes etc. Let us see how to initialize an array and a string.
int array = new int;
String s = "hello world";
Since now we know what data types are, it is important to learn the usage of these data types so that we know where to use them to solve a problem.
...To be continued! 🎉
keep learning, keep coding!💖