Primitive Data Types

Before we'll proceed to programming, I'll start off by introducing you the eight different primitive data types in Java.

BYTE

  •  useful for saving a memory in huge arrays. Sometimes, it can be replaced by an Int (or Integer)

SHORT

  • from the word itself, it means short, or small amount of numbers

LONG

  • an opposite of short, it stores large amount of numbers (ex. 1234566789003252)

DOUBLE

  • this data type goes for decimal number (just like float)
INT
  • the most common data type where double, long, short, and byte can be stored in substitute with some differences to their types (like int can't hold decimal numbers)
BOOLEAN
  • answers only true or false, or simply, yes or no
CHAR
  • single letters are called characters
  • example: 'A ' is a character "AB" is a string

Note: Notice that characters are placed with an open and close single quotation marks while strings are placed with an open and close double quotation marks.

No comments:

Post a Comment

Extended Search

Custom Search
Hello World