Friday, 27 January 2017

level 1 : 15 Step by step interview question to crack the interview.

1. Which concept of oops we are using in below code ?
class callkr{
             
              void show(int x){  
                     System.out.println("int-args-method");
              }
              void show(){
                     System.out.println("no-args-method");
              }
}

2. What will be the output if we call new callkr().show();
3  What will be the output if we call new callkr().show(10);
4. What is Overloading in java ?
5. What will be the output of below code ?
class callkr{
             
              void show(int x){  
                     System.out.println("int-args-method");
              }
              void show(long l){
                     System.out.println("no-args-method");
              }
              public static void main(String args[]){
              new callkr().show(10);
              new callkr().show(10l);
       }
}

6. What will be the output of below code ?
class callkr{
             
              void show(float x){  
                     System.out.println("int-args-method");
              }
              void show(long l){
                     System.out.println("no-args-method");
              }
              public static void main(String args[]){
              new callkr().show(10);
              
       }
}


7. What will be the output of below code ?
class callkr{
             
              void show(float x){  
                     System.out.println("int-args-method");
              }
              void show(int x){
                     System.out.println("no-args-method");
              }
              public static void main(String args[]){
              new callkr().show(10l);
              
       }
}

8. What will be the output of below code ?
class callkr{
             
              void show(float x){  
                     System.out.println("int-args-method");
              }
              void show(long l){
                     System.out.println("no-args-method");
              }

              void show(double l){
                     System.out.println("no-args-method");
              }
              public static void main(String args[]){
              new callkr().show(10);
              
       }
}


9. What will be the output of below code ?
class callkr{
             
              void show(int x){  
                     System.out.println("int-args-method");
              }
              void show(long l){
                     System.out.println("no-args-method");
              }

             
              public static void main(String args[]){
              new callkr().show('10');
              
       }
}


10. What will be the output of below code ?
class callkr{
             
              void show(byte x){  
                     System.out.println("int-args-method");
              }
              void show(long l){
                     System.out.println("no-args-method");
              }

             
              public static void main(String args[]){
              byte b=30;
              byte c=20;
              new callkr().show(b-c);
              
       }
}

No comments:

Post a Comment