Computer Science, asked by manyag1605, 5 months ago

describe the role of data types in Java. Explain various data types available in Java along with memory size and range of each data type

Answers

Answered by aduraj30112007
4

Answer:

In Java language, primitive data types are the building blocks of data manipulation. These are the most basic data types available in Java language. Java is a statically-typed programming language.

...

Java Primitive Data Types.

Data Type Default Value Default size

short 0 2 byte

int 0 4 byte

long 0L 8 byte

float 0.0f 4 byte

Explanation:

mark me brainleist

Answered by jkhan7030
1

Answer:

Different Data Types available in Java

Primitives Data Type

Integer Type

Float-point Type

Character Type

Boolean Type

Non-Primitive Data Types

Class

Array

Interface

Primitives Data Type

Integer Type

Integer data type are like whole numbers, they also include negative numbers but does not support decimal numbers.

Type Storage size Value range Default Value

byte 1 bytes -128 to 127 0

short 2 bytes -32,768 to 32,767 0

int 4 bytes -2,147,483,648 to 2,147,483,647 0

long 8 bytes -9,223,372,036,854,775,808 to

9,223,372,036,854,775,807 0

Float-point Type

Float data type allows user to store decimal values in a variable.

Type Storage size Value range Default Value

float 4 byte 1.4e-045 to 3.4e+038 0.0f

double 8 byte 4.9e-324 to 1.8e+308 0.0

Character Type

Character data type is used to store only one letter, digit, symbol at a time. Java character uses unicode rather than ASCII code. '\u0000' is the smallest unicode and '\uffff' is the kargest unicode.

Type Storage size Value range Default Value

char 1 byte 0 to 65,536 '\u0000'

Boolean Type

The boolean data type has only two possible values either true or false. Boolean data type represents one bit of information.

Type Storage size Value range Default Value

boolean 1 bit Has no range. false

Non-Primitive Data Types

Class

Class is an encapsulation of data and coding. Class is userdefined datatype. Variables declared in class are called Data Members. Functions defined in class are called Member Functions. More info

Array

Array is a collection of similar data type. More info

Inteface

Interface is used in situation, when we need to restrict derived class to implements all methods. This can be done by making abstract class with all abstract methods, then why use interface? The answer is

Similar questions