Give an the output of program

Assignment Help Computer Engineering
Reference no: EM1330978

What is the output of this Java program?

public class InheritanceProblem
{
public static void main(String[] args)
{
System.out.println(new X().message());
System.out.println(new Y().message());
System.out.println(new Z().message());
}
}
class X
{
String size, color;
X() { this("BIG","RED"); }
X(String s, String c) { size = s; color = c; }
public String message() { return "I am " + description() + "."; }
protected String description() { return size + " and " + color; }
}
class Y extends X
{
Y() { super("SMALL","RED"); }
public String message() {return "I wish I were " + description() + ".";}
}
class Z extends X
{
Z() { super("BIG","BLUE"); }
protected String description() { return size + " but not " + color; }
}

Reference no: EM1330978

Reviews

Write a Review

 

Computer Engineering Questions & Answers

  Testing the procedures

The company receives new release movies each Tuesday. Make a procedure that will enable the receiving clerk inorder to add the new movies received to the mm_movie table.

  What are prospect trends for healthcare informatics

What are prospect trends for healthcare informatics.

  Kind of the collapsible furniture

An inventor has just developed a new kind of the collapsible furniture which will be useful for the students in college dorms where space is limited.

  What is requirements definition

An aspect of the preferred process for almost all formal software development approaches is to do some design before coding. One of the plan artifacts you are asked to use in this course is a flow chart.

  Prepare a multithreaded code breaking program

Prepare a  multithreaded code breaking program. You have been provided 3 files that contain text that have been  encrypted using a Caeser cypher scheme.

  Concept of software integration

Explain how hospitals, manufacturing, retailing, education, construction, agribusiness, and shipping are improving efforts with their supply chain through the evolution of software.

  Find the worst-case runtime of this incorrect algorithm

What is the worst-case runtime of this incorrect algorithm? supply as tight an asymptotic upper bound as possible, using Big-Oh notation as a function of n. Justify your answer.

  What type of procedures might a company put into place

What are some common steps and what type of procedures might a company put into place.

  Ai and intelligent agents supporting knowledge management

Explain how the AI and intelligent agents provide support to the knowledge management. Explain it in the 1 paragraph with source.

  How quick kruskal''s algorithm run

imagine that all edge weights in a graph are integers in the range from 1 to |V|.how quick Kruskal's algorithm run.

  What is the advantage when target is throughput and security

What is the advantage when target is throughput and securityty

  Prompts the user to enter the number of students

Write down a Java program that prompts the user to enter the number of students and each student's name and score, and finally displays the student with the highest score and the student with second-highest score.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd