Types
Data can be different types, because different pieces of data represent different things.
-
Integer data - numbers that do not have a decimal point, or "whole numbers":
42,0,-123,1928374. -
Floating point data - numbers that do have a decimal point, or "real numbers":
0.0,3.14,-15.9997. -
Character data - a single letter, numeral, or punctuation mark:
H,k,9,(,*. -
Boolean data - a
trueorfalsevalue. -
String data - a sequence of characters:
Hello world!,dog,Java is a programming language.
Java Data Types¶
Data in Java has a type for each of these different kinds of data. * We tell Java the type of our data so that Java knows how to treat the data.
The types we will focus on are:
* int
* double
* char
* boolean
* String