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

Questions Cloud

Working in a diverse organization : Explain benefits of working in a diverse organization.
Make sure to comprise a history of the company or industry : Make sure to comprise a history of the company or industry or the market in which it operates.
Show the relationship between budgeting and planning : Show the relationship between budgeting and planning and How are they related? What differences exist between the two?
Comparing and contrasting leadership theories : Compare and contrast leadership theories that you believe would be most influential and beneficial to an organization's management practices in order to lead change in that organization.
Give an the output of program : What is an output of this Java program.
Law for management of hospital : You are the Manager/CEO of a small rural hospital and you have a definitive management style (your style).
Measurement scales and questions : Measurement scales and questions to elicit consumer response
Relationship between bond price and interest rates : What is the relationship between the price of the bond and interest rates? Why does the price of bond change over its lifetime?
Demand analysis whereas impact of government regulations. : describing market trends with disney theme parks also supply and demand analysis whereas impact of government regulations.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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