A Developer Gateway To IT World...

Techie Uncle Software Testing Core Java Java Spring C Programming Operating System HTML 5 Java 8 ES6 Project

Concept of static variables access by class name

//static variables access by class name
class three
{
    static int a=10,b=10;
    void m1()
    {
        int a=10, b=10;
        System.out.println(a+b);
    }
    public static void main(String args[])
    {
        three t1=new three();
        t1.m1();
        System.out.println(three.a+b);
    }

}




Sample output:




LEARN TUTORIALS

.

.