A Developer Gateway To IT World...

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

Use of static class

//assignment 1
class six
{
    int a=10, b=20;
    static void m1()
    {
        int x=2, y=3;
        System.out.println(x+y);
    }
    static void m2()
    {
        int n=1, m=4;
        System.out.println(n+m);
    }
    public static void main(String args[])
    {
        six s=new six();
        six.m1();
        six.m2();
        System.out.println(s.a);
        System.out.println(s.b);
        //System.out.println(s.a+b);
    }

}

output:


LEARN TUTORIALS

.

.