Open links in new tab
  1. Like
    Dislike

    In Java, data types specify the different sizes and values that can be stored in a variable. Java is a statically-typed language, meaning all variables must be declared before use. There are two main categories of data types in Java: primitive data types and non-primitive data types.

    Primitive Data Types

    Primitive data types are the most basic data types available in Java. They are predefined by the language and named by a keyword. There are eight primitive data types:

    • boolean: Represents a value of either true or false. It is used for simple flags that track true/false conditions.

    boolean isJavaFun = true;
    Copied!
    • byte: An 8-bit signed two's complement integer. It has a minimum value of -128 and a maximum value of 127.

    byte byteValue = 100;
    Copied!
    • char: A single 16-bit Unicode character. It has a minimum value of '\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive).

    char letter = 'A';
    Copied!
    • short: A 16-bit signed two's complement integer. It has a minimum value of -32,768 and a maximum value of 32,767.

  1. Java Data Types - GeeksforGeeks

    Nov 12, 2025 · Data types in Java define the kind of data a variable can hold and the memory required to store it. They are broadly divided into two categories: Primitive Data Types: Store simple values directly in memory. Non-Primitive …

  2. Java Data Types - W3Schools

    Data types are divided into two groups: Primitive data types - includes byte, short, int, long, float, double, boolean and char Non-primitive data types - such as String, Arrays and Classes (you will learn more …

  3. People also ask
  4. Java - Data Types - Online Tutorials Library

    • Primitive data types are predefined by the language and named by a keyword. There are eight primitive data types supported by Java. Below is the list of the primitive data types: 1. byte 2. short 3. int 4. long 5. float 6. double 7. boolean
    See more on tutorialspoint.com

    Code sample

    byte a = 68;
    char a = 'A';
  5. Java Data Types - Tpoint Tech

    Apr 20, 2025 · There are the following two types of data types in Java. Primitive Data Types: The primitive data types include boolean, char, byte, short, int, long, float and double. Non-Primitive Data Types: The non-primitive data types include …

  6. Java Data Types And Variables – Explained for Beginners

    Jun 27, 2023 · In this article, I will walk you through Java's data types and explain how they work. There are two types of data types in Java – primitive data types and reference data types.

  7. Java Data Types (Primitive) - Programiz

    Data types in Java specify the type of data that can be stored inside Java variables. In this tutorial, we will learn about 8 primitive data types in Java with the help of examples.

  8. Understanding Data Types in Java With Examples

    Jul 3, 2025 · Discover the key data types in Java. Learn about the primitive and non-primitive data types in Java, their differences, and their subcategories.

  9. Understanding Data Types in Java - javaspring.net

    Nov 12, 2025 · Understanding different data types in Java is essential for writing efficient, bug - free, and maintainable code. This blog will explore the fundamental concepts of Java data types, their usage …

  10. Java Data Types - DataCamp

    Explore Java data types, including primitive and non-primitive types, with examples and best practices for optimal memory usage and performance in your Java applications.

  11. Understanding Variables, Data Types, and Their Roles in …

    Mar 10, 2024 · This blog post will discuss primitive data types and wrapper data types, define variables and data types, and explain why Java uses both even though they have similar uses.