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
When computer networks are connected to each other, the system is called a(n) ____.
KiRa [710]
LAN - Local area network :P
5 0
3 years ago
What are the main components of a desktop PC and briefly describe their purposes.​
Norma-Jean [14]

Answer:

8 Standard Computer Components and What They Do

Explanation:

Motherboard. The motherboard is an important computer component because it’s what everything else connects to!

Power Supply. True to its name, the power supply powers all other components of the machine.

Central Processing Unit (CPU)

Random-access Memory (RAM)

Hard Disk Drive / Solid State Drive.

Video Card.

Optical Drives.

6 0
2 years ago
The text discusses three approaches to combining overall cost leadership and differentiation competitive advantages. Which of th
dedylja [7]

Answer:

C. deriving benefits from highly focused and high technology markets

Explanation:

Firms that engage in cost-leadership approach seek to combine a low per-unit income with large sales for profit making purposes. Typically, but not always, they are more inclined to market their products and services to a large population base or a niche with a high demand volume. While differentiation enables a company to accomplish a competitive advantage. A Competitive advantage enables a company to achieve more strides over other companies offering related product substitutes. It is an important marketing process that is of critical economic importance to a business.

It should be noted that deriving benefits from highly focused and high technology markets is not part of the approaches to combining overall cost leadership and differentiation competitive advantages.

3 0
3 years ago
Which two security regulations does the PCI enforce with regard to electronic banking?
Sever21 [200]

The two security regulations the PCI enforce in regards to electronic banking are an external Qualified Security Assessor (QSA) or by a firm specific Internal Security Assessor that creates a Report on Compliance for organizations handling large volumes of transactions, or by Self-Assessment Questionnaire (SAQ) for companies handling smaller volumes.

5 0
3 years ago
Read 2 more answers
The ability to create slide shows is a major advantage of word processing software.
Gennadij [26K]
The correct answer is false
8 0
3 years ago
Other questions:
  • You are troubleshooting a network issue on a client computer and discover that the network card has an IP address of 169.254.196
    6·1 answer
  • Only business writing requires an editing stage
    8·1 answer
  • The acronym LAH stands for
    14·2 answers
  • Your car must have two red stoplights, seen from ______ feet in the daytime, that must come on when the foot brake is pressed.
    6·1 answer
  • _____________ refers to know-what and know-why of technology.
    12·1 answer
  • you have a small network in your business with just a few network devices connected along with 22 linux computers and you want t
    7·1 answer
  • Problem: Mr. James Reid, the director of admissions at MOGCHS University, has
    14·1 answer
  • I need some help with this assignment. I'm having difficulty trying come up ideas to use here. Can I get any help?
    5·1 answer
  • How do we add questions on sam Blockly?​
    6·1 answer
  • How can I use HTML to express a personal value
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!