//what is the output?
package staticinstanceflow;
public class Initialization {
private
static String m1(String msg)
{
System.out.println(msg);
return msg;
}
public
Initialization()
{
m=m1("1");
}
{
m=m1("2");
}
String m=m1("3");
public
static void main(String[] args) {
Object o=new Initialization();
}
}
o/p:-------------------------------------
2
3
1
What is the
output?
package
staticinstanceflow;
public class
Initializaion2 {
private static
String m1(String msg)
{
System.out.println(msg);
return msg;
}
static
String m=m1("1");
{
m=m1("2");
}
static
{
m=m1("3");
}
public static void
main(String[] args) {
Object obj=new
Initializaion2();
}
}
o/p:--------------------
1
3
2
No comments:
Post a Comment