Sunday, 17 March 2013

Static qus

class fbcheck
{

{System.out.print("one,");}

public static void main(String args[])
{
System.out.print("two,");

new fbcheck();
... }

static{System.out.print("three,");}
}

what will the out put??

A: one,two,three,
B: three,two,one,
C:two,three,one,
D: Error

3 comments:

  1. now you can give commnts...

    ReplyDelete
  2. three,two,one,

    Static
    static{System.out.print("three,");}
    block will execute first then main and then new ..

    ReplyDelete