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
You are configuring NIC teaming on a server with two network adapters. You chose Switch Independent Mode. You now must choose be
zmey [24]

Answer:

The appropriate answer is "Active/Active mode".

Explanation:

  • Now just after the customers or clients respond to the traditional standards, the board is comprised the information rapport with the cloud service, which would be considered as Active mode.
  • The car glides primarily somewhere at a specified constantly controlled rate of the conductor. Currently entering the grounding connection boosts the flow of electrons further into the receiver as well as the transmitter.

Thus the above is the correct solution.

3 0
2 years ago
Does anyone take bca on plato
SVETLANKA909090 [29]
I do. do you need help with it?
7 0
3 years ago
What features are offered by most of the email programs with for receiving and sending messages?
Varvara68 [4.7K]

Answer:

The main features of email is, (1) Attachment :Ability to attach the files along the messages is one of most useful features of email. (2)Address book: It is also most important features of email that allows a user to storing the information.

Explanation:

3 0
2 years ago
Write a recursive function called digit_count() that takes a positive integer as a parameter and returns the number of digits in
Gelneren [198K]

Using the computational knowledge in python it is possible to write a code that Write a recursive function called digit_count()

<h3>What is a function in Python?</h3>

In Python, a function is a sequence of commands that performs some task and that has a name. Its main purpose is to help us organize programs into chunks that correspond to how we envision a solution to the problem.

<h3>Writting the code in python:</h3>

<em>def countDigits(n):</em>

<em>   if n< 10:</em>

<em>      return 1</em>

<em>   else:</em>

<em>       return 1 + countDigits(n / 10)</em>

See more about python at brainly.com/question/13437928

#SPJ1

8 0
2 years ago
Which of these consoles have 64 bit architecture
tigry1 [53]

I don't know if this is on your list, but I know for a fact that the Nintendo 64 system (or N64) has a 64-bit architecture.

8 0
3 years ago
Other questions:
  • In general, what is the leftmost point of a circle with radius r centered at (x,y)?
    8·1 answer
  • Which cloud computing service model will enable an application developer to develop, manage, and test their applications without
    15·1 answer
  • But this time use 16 kib pages instead of 4 kib pages. what would be some of the advantages of having a larger page size? what a
    11·1 answer
  • Select one of the following strategies: active listening, sandwich technique, constructive feedback. in 2-5 paragraphs, define a
    11·1 answer
  • I'd like to edit a picture so that I can remove the background behind an object and have it replaced with a transparent backgrou
    13·2 answers
  • Which of these is a method of selecting multiple items in Impress or PowerPoint? A. holding down the Ctrl key while clicking ite
    9·2 answers
  • Beth would like to run an nmap scan against all of the systems on her organization's private network. These include systems in t
    15·1 answer
  • Given a sorted list of integers, output the middle integer. A negative number indicates the end of the input (the negative numbe
    12·1 answer
  • Compare mini and mainframe computer in terms of speed,memory and storage​
    15·1 answer
  • The designers of a database typically begin by developing a​ __________ to construct a logical representation of the database be
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!