What Is The Output Of The Following Java Program?

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
class Food {
    Food() { System.out.println("bland"); }
}
class Pepper extends Food {
       Pepper() { this("spicy"); }
       Pepper(String flavor) { System.out.println(flavor); }
}
public class Lunch {
       public static void main(String[] args) {
                     Food lunch = new Pepper();
      }
}

Select One:

  • a. bland
  • b. spicy
  • c. no output
  • d. spicy
  • e. the program does not compile

Related Posts

0 Comments

12345

    00