In this video I discuss Data Types In Java
A data type is a set of values that share certain properties together and have a set of operations that can be performed on them.
Data types are used when declaring variables in your code so its function is to determine the type and quantity of value a variable can hold.
So based on the data type of a variable the operating system allocates memory and decides what can be stored in the reserved memory.
Data types allow you to store different kinds of values in your program such as integers decimals or characters in these variables.
There are two data types available in Java :
Primitive Data Types
There are eight primitive data types supported by Java.
Primitive data types are predefined by the language and named by a keyword.
Example of primitive data types byte short int long float double char boolean
Non Primitive Data Types
Non-Primitive Data Types: These data types are not actually defined by the programming language but are created by the programmer.
Examples of non-primitive types include Strings Arrays Classes Interface.
The difference between primitive and non-primitive data types are as follows:
Primitive types are predefined in Java.
Non-primitive types are created by the programmer and is not defined by Java.
Non Primitive types can be used to call methods to perform certain operations while primitive types cannot.
A primitive type always has a value whereas non-primitive types can be null.
A primitive type starts with a lowercase letter while non-primitive types start with an uppercase letter.
The size of a primitive type depends on the data type while non-primitive types have all the same size.
Links to my other YouTube videos
Reserved words in Java --
Identifiers in Java --
Writing Comments in Java --
Output Statements --
Источник: rutube.ru