variable are containers for storing dta values
In java, thare are types:
- String - stores text. suc as "Hello". String values are surrounded by double quotes
- Int - Stores integers, Without decimals, such as 123 or -123
- float - stores floating point number with decimal such as 19.99 or -19.99
- char - stores single characters, such as 'a' or 'B', char values are surrounded by single quotes
- boolean - store values with two state : true or false
Declaring (Creating) Variables
To create a variable, you must specify the type and assign it a value:
type variableName = value;
Where type is one java type (such as int or string), and variableName is the name of the variable (such as x or name). The equal sign is used to assign values to the variable.
string name = "Nikunj";
System.out.println(name);
0 Comments