Variables and Datatypes in JAVA
Variables and Datatypes in JAVA In this tutorial we are going to learn about variables and datatypes in Java Programming So let’s have look at the picture below for understanding the anatomy of a basic Java Program again Now, let's get back to the point--- Just like we have some rules that we follow to speak English (the grammar), we have some rules to follow while writing a JAVA program. The set of the rules is called Syntax (Vocabulary & Grammar of JAVA). VARIABLES: A variable is a container that stores a value. This value can be changed during execution of the program. Example : int number = 8 Here int is a DATATYPE; number is a Variable name; 8 is the value which the variable has stored. Rules for declaring a Variable name: We can choose a name while declaring a JAVA variable if the following rules are allowed. Must not begin with a digit. (int 1var; is invalid) Name is case sensi...