package ClassAndObject;
public class TestSIBandIIB {
static int i;
int b;
static {
i = 10;
//b = 20;
System.out.println("I am from SIB1");
}
static {
System.out.println("I am from SIB2");
}
{
b = 20;
i = 70;
System.out.println("I am from IIB1");
}
{
System.out.println("I am from IIB2");
}
public static void main(String[] args) {
// TODO Auto-generated method stub
TestSIBandIIB obj1 = new TestSIBandIIB();
System.out.println("--------");
TestSIBandIIB obj2 = new TestSIBandIIB();
System.out.println("----------");
TestSIBandIIB obj3 = new TestSIBandIIB();
System.out.println(obj3.b);
}
}
public class TestSIBandIIB {
static int i;
int b;
static {
i = 10;
//b = 20;
System.out.println("I am from SIB1");
}
static {
System.out.println("I am from SIB2");
}
{
b = 20;
i = 70;
System.out.println("I am from IIB1");
}
{
System.out.println("I am from IIB2");
}
public static void main(String[] args) {
// TODO Auto-generated method stub
TestSIBandIIB obj1 = new TestSIBandIIB();
System.out.println("--------");
TestSIBandIIB obj2 = new TestSIBandIIB();
System.out.println("----------");
TestSIBandIIB obj3 = new TestSIBandIIB();
System.out.println(obj3.b);
}
}
No comments:
Post a Comment