Question: What does the following program print output and why (be detailed in your explanation referring to Java OOP principles) ? If int outVariable = 4;
What does the following program print output and why (be detailed in your explanation referring to Java OOP principles) ?
If int outVariable = 4; is commented out in b) above within InnerClass, what does the code output?
class Color { public void red(){ } { } } interface IFlyable void fly(); System.out.println("Color Red"); interface IEatable } { } //Bird class will implement interfaces and extend Color class class Bird extends Color implements IFlyable, IEatable { void eat(); //Implement method of interfaces public void fly(){ System.out.println("Bird flying"); } public void eat() { } System.out.println("Bird eats"); } //It can have more own methods. public class Program { public static void main(String[] args) { Bird b = new Bird(); //Interface implemented methods by Bird class b.eat(); b.fly(); //Color extended method by Bird class b.red();
Step by Step Solution
There are 3 Steps involved in it
When int outVariable 4 is included The code will compile and execute without error... View full answer
Get step-by-step solutions from verified subject matter experts
