- class Bike7{
- int speed;
- Bike7(){System.out.println("speed is "+speed);}
- {speed=100;}
- public static void main(String args[]){
- Bike7 b1=new Bike7();
- Bike7 b2=new Bike7();
- }
- }
- class A{
- A(){
- System.out.println("parent class constructor invoked");
- }
- }
- class B2 extends A{
- B2(){
- super();
- System.out.println("child class constructor invoked");
- }
- {System.out.println("instance initializer block is invoked");}
- public static void main(String args[]){
- B2 b=new B2();
- }
- }
No comments:
Post a Comment