The Artima Developer Community
Sponsored Link

Java Buzz Forum
Java Basic Interview Programming Questions Part:1

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
instanceof java

Posts: 576
Nickname: instanceof
Registered: Jan, 2015

instanceof java is a java related one.
Java Basic Interview Programming Questions Part:1 Posted: Feb 6, 2016 11:51 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by instanceof java.
Original Post: Java Basic Interview Programming Questions Part:1
Feed Title: Instance Of Java
Feed URL: http://feeds.feedburner.com/blogspot/TXghwE
Feed Description: Instance of Java. A place where you can learn java in simple way each and every topic covered with many points and sample programs.
Latest Java Buzz Posts
Latest Java Buzz Posts by instanceof java
Latest Posts From Instance Of Java

Advertisement


1.What will be the Output of this program.


  1. public class Test1{
  2.  
  3. Test1(int i){
  4.  
  5. System.out.println("Test1 Constructor "+i);
  6.  
  7.  } 
  8. }

  1. public class Test2{
  2.  
  3. Test1 t1= new Test1(10);
  4.  
  5. Test2(int i){
  6.  
  7.  System.out.println("Test2 Constructor "+i);
  8.  

  9. public static void main(String[] args) {
  10.  
  11.         Test2 t2= new Test2(5);
  12.  
  13.     }
  14. }


Click for Output





2.What will be the Output of this program.

  1. public class A{
  2.  
  3. A(){
  4.  
  5.   System.out.println("A Class Constructor ");
  6.  
  7. }
  8.  
  9. }

  1. public class B extends A{
  2.  
  3. B(){
  4.  
  5.   System.out.println("B Class Constructor ");
  6.  
  7. }
  8. public static void main(String[] args) {
  9.  
  10.         B ob= new B();
  11.  
  12.     }
  13. }


Click for Output



3.What will be the Output of this program.

  1. public class  A{
  2.  
  3. A(){

  4. this(0);
  5. System.out.println("Hi ");
  6.  
  7.  
  8. A(int x){

  9. this(0,0);
  10. System.out.println("Hello");
  11.  
  12. }
  13.   
  14. A(int x, int y){
  15.  
  16. System.out.println("How are you");
  17.  
  18. }
  19. public static void main(String[] args) {
  20.  
  21.         A ob= new A();
  22.  
  23.     }
  24. }


Click for Output


Read: Java Basic Interview Programming Questions Part:1

Topic: GitHub’s Scientist puts Ruby rewrites to the test Previous Topic   Next Topic Topic: Stressed? It’s Not the Industry, It’s Your Employer

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use