Chapter 1
Chapter 1
Chapter 1
Just like we have some rules that we follow to speak English( the grammar ), we have some rules to
follow while writing a java
Variables
A variable is a contanet that stores a value. This value can be changed during the execution of the
program.
Example :
^ ^
We can choose a name while declaring a java variable if the following rules are followed :
Data Types
6. Double=Takes 8 bytes
Default value is 0.0d
Quick Que :
In order to choose the data type we first need to find the type of data we want to store after that we
need to anally the
Literals
Keywords
Words which are reserved and used by the java compiler. They cannot be used as an identifier.
In order to read data from the keyboard java has a scanner class
Scanner class has a bt of method to read the data from the keyboard
Example :
Int a = s.nextInt(); -- Method to read from the keyboard (integer in this case)