Sunday 27 May 2012

Lesson 2 - Primitives and Conditional Loops

1) Java has several 'primitives' or basic data types
  1. byte - minimum value of -128 and a maximum value of 127
  2. short - minimum value of -32,768 and a maximum value of 32,767 (inclusive)
  3. int - minimum value of -2,147,483,648 and a maximum value of 2,147,483,647
  4. long - minimum -9,223,372,036,854,775,808 and a maximum value of 9,223,372,036,854,775,807
  5. float - 1.1234f
  6. double - 1.127
  7. char - a single character such as 'a' or 'b'
  8. boolean - TRUE/FALSE
2) Java also supports another special type called the 'String' which is a set of characters within quotation marks. e.g. "Hello World"

2) The main ones most commonly used are String, int, and float.

3) There is a significant difference between a float and a double but this is beyond the scope of this entry tutorial. You can think of them both as types that will take a decimal point value. If you REALLY want to know the difference, look here.

4) Boolean values a

No comments:

Post a Comment