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
{
{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
now you can give commnts...
ReplyDeletethree,two,one,
ReplyDeleteStatic
static{System.out.print("three,");}
block will execute first then main and then new ..
yup.. rite
Delete