Millionaire Mode

Java OOPs Quiz - SCJP

Question 1 of 10

Which statement is true for the following code?

public class Plant {
   private String name;
   public Plant(String name) { this.name = name; }
   public String getName() { return name; }
}

public class Tree extends Plant {
   public void growFruit() { }
   public void dropLeaves() { }
}
  1. The code will compile without changes.
  2. The code will compile if public Tree() { Plant(); } is added to the Tree class.
  3. The code will compile if public Plant() { Tree(); } is added to the Plant class.
  4. The code will compile if public Plant() { this("fern"); } is added to the Plant class.

Prize Money

15₹7 Crores
14₹1 Crore
13₹50,00,000
12₹25,00,000
11₹12,50,000
10₹6,40,000
9₹3,20,000
8₹1,60,000
7₹80,000
6₹40,000
5₹20,000
4₹10,000
3₹5,000
2₹2,000
1₹1,000