Data Types

In Java, there are two primary Data Types that you should know:

Primitive Data Types

Primitive Data Types are ones that can stand alone, without the other Data Types. For example, here is a short list of the primary primitive Data Types that you should know as a beginner:

Integers and Longs are very useful when dealing with numbers. For instance, if you wanted to make a program for a clock or timer, you could use Integers or Longs to hold the hour, minute, and second values.

Although Integers and Longs are similar to Floats and Doubles, they are still different Data Types in their own unique ways. For instance, Floats and Doubles should not be used when dealing with currency or any other value with potential decimal points.

Booleans are different altogether from the other Data Types. Instead of holding a numerical or character value, they hold just one of two values, those values being True and False. Booleans are often used to determine events such as deciding the outcome of an If Statement. For instance, take the following If Statement for example:

This given Method is designed to set a Boolean "booleanExample" to "true", and if "booleanExample" is "true", then the Integer "x", which has been given a value of "0", will add to itself "5".

Object Data Types

Object Data Types are made up of Primitive Data types. Some Object Data Types are already present in Java by default, such as the "String" object. Other Objects are put together by the programmer within the program.

First of all, I would like to stress that the "String" Data Type is incredibly useful. The "String" Object is, made to be able to accept both letters, numbers, and other characters and put them together, as specified, as a string of characters. For instance, if you want the console to output a long string of characters, you can type out that long string of characters as "String longStringOfLetters = "insert long string of letters here";", and then when you want the console to output that, you can simply