Java: Primitive Data Types

An error occurred trying to load this video.

Try refreshing the page, or contact customer support.

Coming up next: Java Data Types: Byte

You're on a roll. Keep up the good work!

Take Quiz Watch Next Lesson
 Replay
Your next lesson will play in 10 seconds
  • 0:02 Primitive & Basic Data Types
  • 0:52 Boolean Data Type
  • 1:19 Numeric Data Types
  • 4:50 Lesson Summary
Save Save Save

Want to watch this again later?

Log in or sign up to add this lesson to a Custom Course.

Log in or Sign up

Timeline
Autoplay
Autoplay
Speed Speed

Recommended Lessons and Courses for You

Lesson Transcript
Instructor: Christopher Prokes

Chris is an instructional designer and college faculty member. He has a Master's Degree in Education and also umpires baseball.

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.

Primitive and Basic Data Types

When you hear the word primitive, you hopefully think of something long ago, basic, or simple. For example, a primitive shelter would be one that is made from locally-available materials and gets the job done to provide protection from the elements, but it's no five-star hotel. In Java, the most primitive elements of data are primitive data types. They serve the single purpose of comprising wholesome, simple values; and there are eight essential versions. Let's explore each of these in a categorical format, in no particular order.

Before we begin, it's important to note that the use of primitive data can be broken down into two main categories. Past that, you will see sub-categories, groups, and then finally types of data.

Boolean Data Type

Like flipping a coin, turning on a switch, or asking a basic yes-or-no question, the boolean type of data has two possible values: true or false. In terms of standards, false is the primary value and its size it 1 bit. Boolean is the tiniest Java data type given this size. It is also in a category all its own of primitive data and has neither subcategories nor groups.

Numeric Data Types

Numeric, a sub-type of primitive data, contains the remaining versions, broken down into even more categories.

Character

Our second type of data type is known as a char. Such an item reflects characters in Unicode. As a matter of reference, Unicode refers to standard depictions of data that is text-related. This would include letters (C, K, L, etc.), special characters (cents sign, foreign currency icons), and symbols (%, #, *). More than 100,000 characters in more than 100 languages can be represented by Unicode. Char values are at 16 bits in size and set at \u0000. The char data type is the only character version but is part of the numeric sub-category of primitive data. It is also one of the more often used types.

Integral

Floating-point Group

The third type of primitive data is known as float. With a default value of 0.0f, it's size is 4 bytes. Float represents real numbers, such as 1, 2, 3, 4, etc., and also can utilize 6 significant digits. Another way to think of this is the number of spaces after a decimal point. Hopefully, that sentence didn't just bring back bad memories of grade school arithmetic! Think of money as an expression. It is listed with numerical values on both sides of a decimal point, such as 3.34 meaning three dollars and 34 cents.

To unlock this lesson you must be a Study.com Member.
Create your account

Register to view this lesson

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use Study.com

Become a Study.com member and start learning now.
Become a Member  Back
What teachers are saying about Study.com
Try it risk-free for 30 days

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.

Create an account to start this course today
Try it risk-free for 30 days!
Create an account
Support