In Java, data type defines a set of values for real numbers, decimal numbers, alphabets, etc. Data types are classified into two types: primitive and non-primitive. The data types that are independent on any other type are known as primitive data types.
In Java, primitive data types are also known as basic or fundamental data types. Some of the primitive data types are int, float, char and boolean. Integers are the whole numbers with a range of values and the range of values are machine dependent. Float data type is used to store fractional numbers. Character type variable can hold a single character. Boolean data type represents the concept of true/false.
In Java, non-primitive data types are created from the basic or fundamental data types. Array, class and interface are the examples of non-primitive data types. Array is a data structure consisting of a group of elements that are accessed by indexing. A class is a group of objects that share common properties and relationships. Object is an entity created according to its class description.
To Access the full content, Please Purchase
What are the different types of data types supported by Java?Marks:1
There are two data types in Java -
- Primitive data type and
- Reference data type
Define 'constant variable'.Marks:1
A constant variable is a variable whose value does not change during the program execution.
Explain 'character' data type.Marks:1
Character data type is used to store characters. It can be a number, character or special character and should be enclosed inside single quotes.
What are numerical data types?Marks:1
Numerical integral type stores whole numbers. Types of numeric integral are int, short, byte and long.
Define data types.Marks:1
Data types are used to specify the type of data stored by the variable.