Friday 12 May 2017

Java puzzle1

Look at the code below, analyze it and find out the output.


package puzzles;

public class Ov {

      public void start()
      {
      System.out.println("Test");
      }
}




package puzzles;

public class Puzzle1 extends Ov {

      public void start()
      {
      System.out.println("TestB");
      }

      public static void main(String [] args)
      {
      ((Ov)new Puzzle1()).start();
      }
}


Output:

TestB


No comments:

Post a Comment

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
If you are looking for a reference book on java then we recommend you to go for → Java The Complete Reference
Click on the image link below to get it now.