Friday 29 June 2012

java program that demostrate use of static method and static variable.

class staticdemo
{
    static int a =42;
    static int b = 99;
    static void callme()
        {
        System.out.println("A = "+a);
        }
}
class static_example
{
    public static void main(String args[])
        {
            final int d =1987;
            System.out.println("final d= "+d);
            //CALL STATIC METHOD
        staticdemo.callme();
        System.out.println("B ="+staticdemo.b);
        }
}

No comments:

Post a Comment