Saturday, May 7, 2011

4. Datatypes

As we've discussed before, every program is made up of two parts:
1. Data
2. Methods
In this chapter, we'll see how data is stored in a Java program.

Data may be of various 'types'. It may be numerical(integral or real), textual(single character or string of characters), boolean(true or false), etc.

The following table shows the various kinds of primitive datatypes available in Java:
(Taken from HERE)
Along with these primitive datatypes, there is one more datatype that is commonly used in Java:

The 'String' datatype. Unlike the 'char' datatype that can store only a single character(alphanumeric values and special symbols), the String datatype can store a string of characters, such as a sentence.

No comments:

Post a Comment