Note:-
To define a Global variable in java, the keyword static is used.
Java actually doesn't have the concept of Global variable, it is known as class variable.
------------------------------------------------------------------------------------------------------------------------
Instance variables:-
---- Instance variables are declared in a class, but outside a method, constructor or any block.
---- Access modifiers can be given for instance variables.
Default value for
---- Number=0 and Boolean=false String =null
-----------------------------------------------------------------------------------------------------------------------
local variables:-
---- Local variables are declared in methods, constructors, or blocks.
---- Access modifiers cannot be used for local variables.
No Default values....
------------------------------------------------------------------------------------------------------------------------
Class/Static variables:-
---- Class variables also known as static variables are declared with the static keyword in a class, but outside a method, constructor or a block.
Default value for
---- Number=0 and Boolean=false String =null
Hope You Understood The Concept For More Videos Do Subscribe Our Channel✌👍