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
EASY AND I GIVE BRAINLIEST!!! What is a good jeopardy question about operating systems?
madam [21]

 ______ is used in operating system to separate mechanism from policy
<span><span>A. Single level implementation</span><span>B. Two level implementation</span><span>C. Multi level implementation</span><span>D. None</span></span>
3 0
2 years ago
Refer to the exhibit. An administrator is examining the message in a syslog server. What can be determined from the message? Thi
ad-work [718]

Answer:

This is a notification message for a normal but significant condition

Explanation:

Syslog represents the standard for logging message, it sends messages through UDP port 514. Familiar syslog facilities includes IP, OSPF protocols, etc. The messages from syslog are both about facility and level.

A syslog server is a means through which network devices sends messages about events into a logging server which is called syslog server. Since a syslog protocol supports so many devices, it can also be used to log a good number of events.

8 0
2 years ago
Read 2 more answers
Using Word, Maureen is writing an outline of a presentation she plans to give to her company. She will be showing a video during
svlad2 [7]
A copy and paste would be fastest and easiest. As you can pinpoint the exact location to where you want the picture to be. 
5 0
2 years ago
Read 2 more answers
Which port security violation mode does not generate messages or increment the violations counter?
Zanzabum

The number of violations is increased. When a secure port is in the error-disabled condition, the shutdown and restrict command can be used to restore it.

<h3>What is  offence?</h3>

A deviation from a code of conduct or law is referred to as a violation. When driving a car, going over the posted speed limit is a regular legal violation. Invading someone else's privacy could include reading their journal. failure to uphold a duty or right; breaching the law.

The two types of violations are states and acts. A transgression is a violation of the rules that is less serious than a foul and frequently involves technicalities of the game. A disrespectful or vulgar act: profanation.

Hence, The number of violations is increased. When a secure port is in the error-disabled condition, the shutdown and restrict command can be used to restore it.

To learn more about violation, refer to:

brainly.com/question/1274113

#SPJ4

4 0
1 year ago
Your mother wants to purchase a larger hard drive for her computer and asks you to see what type of drive interface she has. her
Darya [45]
Your mom has what is called a Parallel ATA interface. Her computer is very old and I suggest more than just a hard drive :)
5 0
3 years ago
Read 2 more answers
Other questions:
  • Due to the absorption and scattering of shorter wavelengths by interstellar dust, distant stars appear A) bluer. B) brighter. C)
    9·1 answer
  • [20 pts] Assume that Bob wants to send a secret message to Alice using RSA encryption. (a) [5pts] (Key generation step) Assume A
    8·1 answer
  • HTTP is the protocol that governs communications between web servers and web clients (i.e. browsers). Part of the protocol inclu
    5·1 answer
  • A user calls the help line and ask for some help installing a new keyboard. He isn't sure how to plug the keyboard into the comp
    15·1 answer
  • A client contacted you to request your help in researching and supplying the hardware necessary to implement a SOHO solution at
    9·1 answer
  • Why might it be a good idea to choose a bus topology?
    6·2 answers
  • If you design your pages using a font that your user does not have installed, the browser defaults to ____ on a macintosh.
    13·1 answer
  • Who can search the internet and select element base on important words
    13·1 answer
  • Write a method named printGPA that takes in as a parameter a Scanner to read in user input, and calculates a student's grade poi
    8·1 answer
  • What are the benefits and drawbacks of a desktop utilising virtualisation and a server?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!