Primitive Data Types

Part of the Java All-in-One For Dummies Cheat Sheet

Java data types are the kind of data you can store in a variable. Primitive data types are defined by the language itself. Java defines a total of eight primitive types. Of the eight primitive data types, six are for numbers, one is for characters, and one is for true/false values. Of the six number types, four are types of integers, and two are types of floating-point numbers.

Type Wrapper Class Parse Method of Wrapper Class
int Integer int parseInt(String s)
short Short short parseShort(String s)
long Long long parseLong(String s)
byte Byte byte parseByte(String s)
float Float float parseFloat(String s)
double Double double parseDouble(String s)
char Character (none)
boolean Boolean boolean parseBoolean(String s)
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus

SERIES
Java All-in-One For Dummies Cheat Sheet

Advertisement

Inside Dummies.com