subject

Consider the following class definitions. public class Computer { private String memory; public Computer) { memory = "RAM"; } public Computer (String m) { memory = m; } public String getMemory () { return memory; ) } public class Smartphone extends Computer private double screenWidth, screenHeight; public Smart Phone (double w, double h) super("flash"); screenWidth = w; screenHeight = h; } public double get ScreenWidth() { return screenWidth; } public double getScreenHeight() { } return screenHeight; } The following code segment appears in a class other than Computer or Smartphone. + Computer myPhone = new Smart Phone (2.55, 4.53); System. out. println("Device has memory: " + myPhone. getMemory () ", screen area: " + myPhone. getScreenWidth()* myPhone. getScreenHeight() + " square inches."); The code segment is intended to produce the following output. Device has memory: flash, screen area: 11.5515 square inches. Which of the following best explains why the code segment does not work as intended?A. An error occurs during compilation because a Smartphone object cannot be assigned to the Computer reference variable myPhone. B. An error occurs during compilation because the Smartphone class has no getMemory method. C. An error occurs during compilation because the getScreenWidth and getScreenHeight methods are not defined for the Computer object myPhone. D. An error occurs at runtime because the Smartphone class has no getMemory method. E. An error occurs at runtime because the getScreenWidth and getScreenHeight methods are not defined for the Computer object myPhone.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 13:30
Anetwork security application that prevents access between a private and trusted network and other untrusted networks
Answers: 1
question
Computers and Technology, 24.06.2019 02:30
Assume a class window with accessor method getwidth that accepts no parameters and returns an integer. assume further an array of 3 window elements named winarr, has been declared and initialized. write a sequence of statements that prints out the width of the widest window in the array.
Answers: 2
question
Computers and Technology, 24.06.2019 10:00
Which two technologies support the building of single-page applications?
Answers: 2
question
Computers and Technology, 24.06.2019 17:50
Acontact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. write a program that first takes in word pairs that consist of a name and a phone number (both strings). that list is followed by a name, and your program should output that name's phone number.
Answers: 1
You know the right answer?
Consider the following class definitions. public class Computer { private String memory; public Comp...
Questions
Questions on the website: 13722363