Archive for boolean

Java Data Types

Posted in Java Instruction with tags , on November 10, 2011 by johnhd

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;