public class OneThing { public One Thing () (): public void foo1 () { System.out
ID: 3849478 • Letter: P
Question
public class OneThing { public One Thing () (): public void foo1 () { System.out.print ("Hi There*"): } public void foo2 () { System. out print ("Bye Now*") foo1 (): } public class Another Thing extends oneThing { Public AnotherThing () { super ();): public void foo2 () { system.out.print ("Bye Againexist"): foo1 (): } } public class OneMoreThing () { super ();}: public void foo2 () { system.out.print ("One more time?"): } } Public Class Program { public void main () { OneThing obj1 = new one Thing (): AnotherThing obj2 = new AnotherThing (): OneMoreThing obj3 = new oneMoreThing(): obj1.foo1 ();//statement #1A------------------------- > __________ obj1.foo2 ();//statement #1B------------------------- > __________ obj2.foo1 (): //statement #2A------------------------- > ____________ obj2.foo2 ();//statement #2B------------------------- > ____________ obj3.foo1 ();//statement #3A------------------------- > _____________ obj3.foo2 ();//statement #3B------------------------- > ___________ } } In the spaces given above after the statements in main(), show the exact output that will be displayed. (3 points each, 18 points total)Explanation / Answer
OUTPUT
Statement #1A
Hi There*
Statement #1B
one more time&
Statement #2A
Hi There*
Statement #2B
Bye Again$
Hi There*
Statement #3A
Hi There*
Statement #3B
one more time&
--------------------------------------------------------------------------------------------------------------------------------------------------------
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
class OneThing
{
public OneThing()
{ }
public void foo1()
{
System.out.println(" Hi There*");
}
public void foo2()
{
System.out.println(" Bye Now*");
foo1();
}
}
class AnotherThing extends OneThing
{
public AnotherThing()
{
super();
}
public void foo2()
{
System.out.println(" Bye Again$");
foo1();
}
}
class OneMoreThing extends AnotherThing
{
public OneMoreThing()
{
super();
}
public void foo2()
{
System.out.println(" one more time&");
}
}
class program
{
public static void main(String args[])
{
OneMoreThing obj1 = new OneMoreThing();
AnotherThing obj2 = new AnotherThing();
OneMoreThing obj3 = new OneMoreThing();
System.out.println(" Statement #1A");
obj1.foo1();
System.out.println(" Statement #1B");
obj1.foo2();
System.out.println(" Statement #2A");
obj2.foo1();
System.out.println(" Statement #2B");
obj2.foo2();
System.out.println(" Statement #3A");
obj3.foo1();
System.out.println(" Statement #3B");
obj3.foo2();
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.