1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
coldgirl [10]
3 years ago
11

Consider the following classes: public class A { private int myNum; public A(int x) { myNum = x; } public int getNumber() { retu

rn myNum; } public String getLetters() { return "A"; } public String getMessage() { return this.getLetters() + "-" + this.getNumber(); } } public class AB extends A { public AB(int x) { super(x + 1); } public int getNumber() { return super.getNumber() + 1; } public String getLetters() { return "AB"; } } What is the output of the following code segment? A test = new AB(0); System.out.print(test.getMessage());
Computers and Technology
1 answer:
Lady bird [3.3K]3 years ago
7 0

Answer:

The output of the given code is "AB-2".

Explanation:

The description of the java program can be given as:

  • In this program firstly we define a class that is "A". In this class, we define a private integer variable that is "myNum" and parameterized constructor and pass an integer variable that is "x" and use a private variable to holds the constructor variable value.Then we define three function that is "getNumber(), getLetters() and getMessage()" this function we returns values.
  • Then we define another class that is "AB" which inherits the base class "A". In this class we define parameterized constructor and two methods that is "getNumber() and getLetters()". In the parameterized constructor and getNumber() method we use a super keyword that calls above(base class methods) and increases the value by 1. In getLetters() method we return value that is "AB".
  • In calling time we create a class object that is "test", and call the AB class and pass value 0 in the parameter, and call the getMessage() method.

That's why the output of this program is "AB-2".

You might be interested in
How to set up a paper format in any type of Microsoft version ????
Mashcka [7]
Explain further what you mean by that.
7 0
4 years ago
Question 1 Why should a user seek support when troubleshooting a computer problem is beyond his or her technical knowledge?​
sveticcg [70]

A user must seek support when troubleshooting a computer problem is beyond his or her technical knowledge because: <em>When the user seeks support, the computer problem is solved accordingly and further complications are avoided.</em>

Discussion:

Further computer problems may arise from a computer problem. As such, when a user finds it difficult to troubleshoot a computer problem, the user should seek support since the computer problem is beyond his or her technical knowledge

Read more on troubleshooting:

brainly.com/question/18315517

6 0
3 years ago
Computers heat resistant materials breathing systems for fire fighters food-growing technologies improvements in all of the item
Scorpion4ik [409]
<span>Computers heat resistant materials breathing systems for fire fighters food-growing technologies improvements in all of the items in this list were first made possible by :  a.space exploration.</span>
4 0
3 years ago
Attetion developers i have a question can u devlop a website
Eva8 [605]
Yes, you can, with certain apps or with websites. Try Mozilla Web Maker.
3 0
3 years ago
Read 2 more answers
The ________ coordinates the flow of data and information through the computer system by coordinating the hardware, software, us
Irina-Kira [14]

Answer:

Operating System.

Explanation:

All the properties listed in the question are handled by the Operating system.

Operating system:-It is a software that manages the computer hardware,provides common services for the programs of the computer and software resources.

Some of the most popular operating systems are as following:-

  1. Microsoft Windows.
  2. Apple MACOS
  3. Linux.

There are also other operating systems present out there these are some of the mostly used OS's.

8 0
3 years ago
Other questions:
  • Insurance can help you:
    10·1 answer
  • Think about the last business that you purchased a product or a service from. What three types of software might they need? Why
    15·2 answers
  • What is a programming language?
    11·2 answers
  • Write a program that use a switch statement whose controlling expression is the variable area code. If the value of area_code is
    12·1 answer
  • Computer trespass can be harmless.<br> a. True<br> b. False
    15·2 answers
  • A celebrity blogger you have followed for years advises readers to try a new beauty product. Before purchasing the product, a sa
    10·1 answer
  • Describe the evolution of computers.​
    7·1 answer
  • What read a page on website​
    15·1 answer
  • Information that's been collected to help solve a problem is called
    10·1 answer
  • What defines the scope of a project?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!