Data Types in Java

Data Types in Java are the different values and sizes that can be stored in the variable according to the requirements.

Java Datatype are further two types:-

1. Primitive Data Type in Java

In Java, primitive data types serve as the foundation for manipulating data. They are the most basic types of data that the Java programming language uses. Java has several primitive data types, including:

Type

Size

Example Literals

Range of values

boolean

1 bit

true, false

true, false

byte 

8 bits

(none)

-128 to 127

char 

16 bits 

&#x2018a&#x2019, &#x2018\u0041&#x2019, &#x2018\101&#x2019, &#x2018\\&#x2019, &#x2018\&#x2019, &#x2018\n&#x2019, &#x2018β&#x2019

characters representation of ASCII values

0 to 255

short

16 bits

(none)

-32,768 to 32,767

int

32 bits

-2,-1,0,1,2

-2,147,483,648 

to 

2,147,483,647

long

64 bits

-2L,-1L,0L,1L,2L

-9,223,372,036,854,775,808 

to

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

float 

32 bits

1.23e100f , -1.23e-100f , .3f ,3.14F

upto 7 decimal digits

double

64 bits

1.23456e300d , -123456e-300d , 1e1d

upto 16 decimal digits

2. Non-primitive Data Type

Non-primitive datatypes are created from primitive datatypes. Examples of non-primitive datatypes include arrays, stacks, and queues.

Java Cheat Sheet

Java is a programming language and platform that has been widely used since its development by James Gosling in 1982. It follows the Object-oriented Programming concept and can run programs written in any programming language. Java is a high-level, object-oriented, secure, robust, platform-independent, multithreaded, and portable programming language All those words are collectively called Java Buzzwords. It is commonly used for programming web-based, window, enterprise, and mobile applications. This Java Cheat Sheet article has been written by experts in Java and based on the experience of students who have recently undergone Java interviews.

This Core Java Cheat Sheet has been designed by Java experts, based on the experience of students who have recently undergone Java interviews. Whether you are a beginner or an experienced Java developer, this Java Cheat Sheet is a valuable resource for quickly accessing essential syntax, concepts, and best practices related to Java Programming.

Similar Reads

Learn Java Programming: Basics to Advanced Concepts

Java Programming Terminologies Java Basics Java Program to Print “Hello World” Dataypes in Java Java Comments Java Variables Access Modifiers in Java Operators in Java Identifiers in Java Control Flow in Java Methods in Java Java Input-output (I/O operations) Java Polymorphism Java Inheritance Java Maths Class Typecasting In Java Arrays in Java Strings in Java Java Regex Java Exception Handling Java Commands Java Generics Java Multithreading java Collections...

1. Java Programming Terminologies

JVM:  executes the bytecode generated by the compiler. Bytecode: The Javac compiler of JDK compiles the Java source code into bytecode so that it can be executed by JVM. JDK: It is a complete Java development kit that includes everything including compiler, Java Runtime Environment (JRE), java debuggers, java docs, etc. JRE: allows the Java program to run, however, we cannot compile it. Garbage Collector: To delete or recollect that memory JVM has a program called Garbage Collector. Finalize method: this function is triggered by the garbage collector just before an object is deleted or destroyed....

2. Java Basics

Now, we will explore some of the fundamental concepts often utilized in the Java programming language....

3. Java Program to Print “Hello World”

Java // Java Program to Print // Hello World class GFG { public static void main (String[] args) { System.out.println("Hello World!"); } }...

4. Data Types in Java

...

5. Java Comments

Data Types in Java are the different values and sizes that can be stored in the variable according to the requirements....

6. Java Variables

There are three types of comments in Java...

7. Access Modifiers in Java

...

8. Operators in Java

...

9. Identifiers in Java

Variables are the containers that save the data values. Each variable is assigned according to the data type it is assigned....

10. Control Flow in Java

...

11. Methods in Java

Access modifiers help to restrict the scope of a class, constructor, variable, method, or data member. It provides security, accessibility, etc to the user depending upon the access modifier used with the element...

12. Java Input-output (I/O operations)

Comparison Operators are the Operators which return a boolean value as the result means the answer will be either true or false....

13. Java Polymorphism

The name that we give to the class, variable, and methods are formally called identifiers in Java. and for defining Identifier there are some rules of it we need to take care of that while defining Identifiers....

14. Java Inheritance

1. If, else-if, else...

15. Java Maths Class

...

16. Typecasting In Java

...

17. Arrays in Java

...

18. Strings in Java

...

19. Java Regex

...

20. Java Exception Handling

...

21. Java Commands

Java Methods are collections of statements that perform some specific task and return the result....

22. Java Generics

...

23. Java Multithreading

We can only print using System.out but can use different print varieties in it:...

24. Java Collections

...

Why Use Java?

...

Why is Java so Popular?

...

Features of Java

Polymorphism: It is the ability to differentiate between entities with the same name efficiently....

Applications of Java Programming language

...

Java Cheat Sheet – FAQs

...

Contact Us