1/* Depending on what variables you want to declare */
2String hello = "hello"; //characters
3short one = 12;//shorter integers
4int two = 2000; //complete integer up too 32 bits
5long number = 2000000; //complete integer up to 64 bits
6float decimal = 1.512 //up to 7 decimal digits
7double million = 1.387892847395 //up tp 16 decmial digits
8Bool condition = true; // true or false
9char a = "a"; // unicode character
1/*
2## Variable
3- Container which holds the value while the Java program is executed.
4- Assigned with a data type.
5- Name of memory location.
6
7## There are three types of variables in java:
81) Local variable
92) Static (or class) variable
103) Instance variable
11*/
1int myVariable = 42; //This is the most commonly used variable. Only use other variables if you have a good reason to.
1class Variables {
2 public static void main(String[] args) {
3 String msg = "Hello World"; // Strings
4 int number = 10; // Integers
5 float decimal = 7.369f; // Make sure to end the decimal with an f.
6 char letter = 'A'; // Characters
7 boolean result = true; // Booleans
8 }
9}
1improve the readability of code for other developers who read the code.
2In some situations