Data Types

The first step to programming in Java is getting to know data types. Programs work with many different types of user input. The computer needs to know how to store the input and what functions can be used on that data. For example, a computer cannot multiply the word “cake” by the number two. Also, data takes up space in memory and it is best to use as little memory as possible. Thats why in Java, even numbers have different types. When you create a variable to store user input or data created by the progam, you must tell the computer how to treat the data.

  • Strings

When you define a variable as a string, you are telling it that the data is text. It can be anything that you can possibly type in on the keyboard.

  • Integers
  • Booleans
  • Doubles
  • Floats
String text="My name is Juan."; 
int value=94; 
boolean bestBlogEver=true; 
double decimal=22.1;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: