Global Variable

Author: Ravi Poswal

ii. Global Variable

When a variable is declared outside of a method, constructor, or block and is defined using the static keyword, it is known as a static variable or class variable.

Code Example

class A
{
static int a=5;   //global variable with static
public static void main(String ar[])
{
System.out.println("india "+a);
} }