Ch 1: Data Types in Java

About This Chapter

Learn about the different data types in Java with this comprehensive tutorial chapter. These simple and engaging lessons teach you about the types of data Java uses and how they're converted.

Data Types in Java: Chapter Summary

These short and engaging Java tutorial lessons cover common types of data that are used in Java. The chapter defines and compares data types, such as bytes and boolean, and helps you understand how they are converted. You'll also take a look at examples of Java comments and learn how big a byte is.

Each lesson highlights the most important information related to Java data types so you can learn as quickly and efficiently as possible. You're encouraged to take the interactive quizzes attached to each lesson so you can be sure you understand the most important Java concepts.

Topics covered in this chapter include:

  • Primitive data types
  • Bytes, short, int and long data
  • Byte size
  • 16, 32, 64 and 128-bit integers
  • Floating point numbers
  • Differences in float and double
  • Char, string and boolean data
  • Data type conversion
  • Int vs. integer
  • Literals
  • Syntax of Java comments

Java is a trademark of the Oracle Corporation, which is not affiliated with Study.com.

15 Lessons in Chapter 1: Data Types in Java
Test your knowledge with a 30-question chapter practice test
Java: Primitive Data Types

1. Java: Primitive Data Types

As a programming language, Java uses two basic data types: primitive and reference/object. In this lesson, we'll have a brief look at each of Java's primitive data types as well as their use.

Java Data Types: Byte

2. Java Data Types: Byte

Java's got byte: One of the basic data types available in Java is the byte, the smallest sized data type available. As we will show in this lesson, it is still a useful data type for programmers.

Java Data Types: Short, Int & Long

3. Java Data Types: Short, Int & Long

This lesson will provide a overview of the Java primitive Java data types: short, int, and long. These whole-number data types have a range of uses. We will provide syntax and examples of their use in programming.

How Big is a Byte?

4. How Big is a Byte?

How big is a byte? Is it a large chunk or just a little morsel? This lesson will provide an overview of bytes; what they are made of and how big they are.

8, 16, 32, 64 & 128-bit Integers

5. 8, 16, 32, 64 & 128-bit Integers

In this lesson, you'll learn how computer programming languages represent integer values and the storage requirements of each data type, as well as appropriate usage and efficiency considerations.

Java: Floating Point Numbers

6. Java: Floating Point Numbers

In Java, floating point numbers are numbers that have a decimal part to them. Java has two basic floating point data types - float and double. In this lesson, we'll learn what they are and how to use them.

Java: Float vs. Double

7. Java: Float vs. Double

Is there a need for two similar yet distinct data types in Java? Yes, and the difference between a float and a double is a large one in Java. This lesson explores these two data types and their applications.

Java: Char Data Type

8. Java: Char Data Type

Whether you pronounce it 'char' or 'care', the Java char data type has no relation to burned beef or care. It is simply short for character (as on a keyboard). This lesson will provide an overview of the char data type, and some examples of its use.

Java: String Data Type

9. Java: String Data Type

In Java, strings are not chased by cats. A string is a sequence, or string, or single characters. This lesson will define the string data type, and provide some examples of its use.

Java: Boolean Data Type

10. Java: Boolean Data Type

True or false? This is a question that's asked frequently in programming languages. Java is no exception. In this lesson, we'll learn about the Boolean data type (true or false) and provide some examples.

Java Data Type Conversion

11. Java Data Type Conversion

You'll learn how to move values contained in one Java data type into a different data type, as well as the consequences of any conversion that may take place.

Java: Int vs. Integer

12. Java: Int vs. Integer

'Int' and 'Integer' are not the same in Java. They both have their uses, and advantages and disadvantages. Here, you'll learn the difference between the Java primitive data type 'int' and the class 'Integer', which offers additional useful capabilities.

Literals in Java

13. Literals in Java

You'll learn what a Java literal is, the notation for some specific literals, how to use literals in your programs, as well as any special considerations concerning literals.

Java Syntax: Expressions, Statements & Blocks

14. Java Syntax: Expressions, Statements & Blocks

Like any language, Java lets you create variables, run tests on them and bundle them in nice packages. In programming terms, these concepts are defined as expressions, statements and blocks. This lesson will define each and provide Java code examples for each.

Comments in Java: Syntax & Example

15. Comments in Java: Syntax & Example

Many times after you write code you will want to go back to make changes. Putting down comments in your program will help you keep track of increasingly complex programs. In this lesson , you will learn how to write notes for yourself or instructions for someone else with comments.

Chapter Practice Exam
Test your knowledge of this chapter with a 30 question practice chapter exam.
Not Taken
Practice Final Exam
Test your knowledge of the entire course with a 50 question practice final exam.
Not Taken

Earning College Credit

Did you know… We have over 200 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.

To learn more, visit our Earning Credit Page

Transferring credit to the school of your choice

Not sure what college you want to attend yet? Study.com has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.

Support