1
2Local variables are declared in methods,
3constructors, or blocks. Local variables
4are created when the method, constructor
5or block is entered and the variable will
6be destroyed once it exits the method,
7constructor, or block.
1java decleartion
2
3int a, b, c; // Declares three ints, a, b, and c.
4int a = 10, b = 10; // Example of initialization
5byte B = 22; // initializes a byte type variable B.
6double pi = 3.14159; // declares and assigns a value of PI.
7char a = 'a'; // the char variable a iis initialized with value 'a'