Question

2016 points output of following Java Program? public class Base { public final void show() { . System.out.println(Base::show
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer

This code gives a compilation error.
because show() method is declared as final in Base class.
so, it can not be overriden in a subclass(Derived) of Base class.
since show() method is overriden in Derived class, this gives a compilation error.
Add a comment
Know the answer?
Add Answer to:
2016 points output of following Java Program? public class Base { public final void show() {...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • What is the output of this program? class A { public int i; private int j;...

    What is the output of this program? class A { public int i; private int j; } class B extends A { void display() { super.j = super.i + 1; System.out.println(super.i + " " + super.j); } } class Inheritance { public static void main(String args[]) { B obj = new B(); obj.i=1; obj.j=2; obj.display(); } } Java language!! // include explanation!

  • What is the output for the following program codes? a) [ 0.5 Mark ] class A...

    What is the output for the following program codes? a) [ 0.5 Mark ] class A { int i; } class B extends A { int j; void display() { super.i = j + 1; System.out.println(j + " " + i); }} class inheritance { public static void main(String args[]) { B obj = new B(); obj.i=1; obj.j=2; obj.display(); }} OUTPUT: b) [ 0.5 Mark ] class Parent { public void getBike(){ System.out.println("Suzuki Bike"); }} class Child extends Parent {...

  • 1) Consider the following Java program: 1 public class HelloWorld { 2     // My first program!...

    1) Consider the following Java program: 1 public class HelloWorld { 2     // My first program! 3     public static void main(String[] args) { 4         System.out.println("Hello, World!"); 5     } 6 } What is on line 1? a. a variable declaration b. a statement c. a method (subroutine) definition d. a comment e. a class definition 2) Which one of the following does NOT describe an array? a. It can be used in a for-each loop. b. It has a numbered sequence...

  • What will be the output of the following Java code? class Output { public static void...

    What will be the output of the following Java code? class Output { public static void main(String args[]) { boolean a = true; boolean b = false; boolean c = a ^ b; System.out.println(!c); } } a) 0 b) 1 c) false d) true

  • What is the output of the following code? class C1 { public double PI=3.1; public void...

    What is the output of the following code? class C1 { public double PI=3.1; public void m1() { System.out.println("M1 of C1"); } } class C2 extends C1 { public double PI=3.14; public void m1() { System.out.println("M1 of C2"); } } public class C { public static void main(String[] args) { C1 obj = new C2(); System.out.print(obj.PI); } } 3.1 3.14 None of the above

  • What is the output of the following code? class parent { public void someFunction() { System.out.println("Parent...

    What is the output of the following code? class parent { public void someFunction() { System.out.println("Parent Function"); } } public class child extends parent { public void someFunction() { System.out.println("Child Function"); } public static void main(String args) { parent p1 = new parent(); parent p2 = new child(); child c1 = new child(); p1.someFunction(); p2.someFunction(); c1.someFunction(); } }

  • What is the output of the following code? class C1 { public double PI=3.1; public void...

    What is the output of the following code? class C1 { public double PI=3.1; public void m1() { System.out.println("M1 of C1"); } } class C2 extends C1 { public double PI=3.14; public void m1() { System.out.println("M1 of C2"); } } public class C { public static void main(String[] args) { C1 obj = new C2(); obj.m1(); } } M1 of C1 M1 of C2 None of the above

  • D Question9 Which of the following represents the output of the following code segment? abstract class...

    D Question9 Which of the following represents the output of the following code segment? abstract class Base Base0System.out.println("Base Constructor Called"); abstract void fun: class Derived extends Base Constructor Called"): fun) called"): ) class MainClass Derived0 System.out.println("Derived void fun [System.out.printin/"Derived public static void main(String args) Derived d = new Derived@; O Print "Derived Constructor Called then print Base Constructor Called O Print "Base Constructor Called then print Derived Constructor Called" O We must write @override above the fun) method in Derived...

  • What is the output of running class C? The three Java classes are in separate Java...

    What is the output of running class C? The three Java classes are in separate Java files in the same directory (or in the same package). class A { public AO { System.out.println("The default constructor of A"); } // end A constructor } // end class A class B extends A { public BCString s) { System.out.println(s); } // end B constructor } // end class B public class C { public static void main(String[] args) { B b =...

  • Show the output of running the class Test in the following code lines: interface A {...

    Show the output of running the class Test in the following code lines: interface A { void print (); } class C ( class B extends C implements A { public void print() { } } class Test { public static void main(String[] args) { B b = new B(); if (b instanceof A) System.out.println("b is an instance of A"); w class Test { public static void main(String[] args) { B b = new B(); if (b instanceof A) System.out.println("b...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT