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
KiRa [710]
4 years ago
12

question 4 What is the output of following program: public class Test { public static void main(String[] args) { A a = new A();

a.methodB(); } } class A { public A() { System.out.println("A's constructor is executed"); } public void methodA() { System.out.println("methodA is executed"); } public void methodAB() { System.out.println("A's methodAB is executed"); } } class B extends A { private int num = 0; public B() { super(); System.out.println("B's constructor is executed"); } public B (int n) { num = n; System.out.println("B's constructor is executed"); } public void methodB() { System.out.println("num is " + num); System.out.println("methodB is executed"); } public void methodAB() { System.out.println("B's methodAB is executed"); } }
Computers and Technology
1 answer:
beks73 [17]4 years ago
8 0

Answer:

The answer to this question can be given as:

This program will give an error message that is cannot find symbol.

a.methodB(); //error  

Explanation:

In this question, the program will give an error message that is cannot find symbol. Because in this question there are three class Test, class A, and class B. In this question first, we explain class A and class B then the class Test. In class A we create constructor then we create two methods that is methodA() and methodAB(). In the constructor and methods, we print  the message.  In class B class inherits class A. In this class we declare an integer variable that is used as a parameter in the parameterized constructor. but first, we declare the default constructor then parameterized constructor. In the default constructor, we use the super keyword. Super keyword is  used to call the above class method or constructors. Then we declare the two methods that are methodB() and methodAB ()  in these methods we print messages.  Then we define the main class that is the class Test. In this class, we define the main method and create class A object and call the class B method. that is not possible in java.

You might be interested in
Which of the following best describes contextual design?
skelet666 [1.2K]

Answer:

B

Explanation:

3 0
3 years ago
When you select the data range for a pie chart, you should be sure to include the total cell on the worksheet?
Daniel [21]
This is not a question...
5 0
3 years ago
Microsoft words spell checker
Degger [83]
The answer it is A i hope is good
3 0
3 years ago
13. What is the suggested rpm on a hard drive for a laptop?
mario62 [17]
Usually it’s either 5400 or 7200RPM
3 0
4 years ago
How have you improved the technology function to provide the right services at the right price and right level of quality?
kaheart [24]
What did you do? Write that as the first part
7 0
2 years ago
Other questions:
  • How does an employer judge a candidate?<br> The employer judge's the candidate's ? for a job.
    12·1 answer
  • Which of the following types of access controls do not describe a lock? (a)- Directive (b)- Physical (c)- Preventative (d)- Dete
    8·1 answer
  • HI GIVING BRAINLIEST Tyra used the software development life cycle to create a new game. She released it to her friends in order
    14·2 answers
  • What was one complication caused by the tsunami that struck japan in 2011?
    15·1 answer
  • You might have trouble interpreting a message if:
    15·1 answer
  • Visual culture is an area of academic study that deals with the totality of images and visual objects produced in ____________,
    6·1 answer
  • An IT security threat is anything that might cause serious harm to a computer system, including someone stealing a laptop that c
    8·2 answers
  • 2. Discuss CORBA functions<br><br>​
    6·2 answers
  • The people, procedures, hardware, software, data, and knowledge needed to develop computer systems and machines that can simulat
    13·1 answer
  • LAB: Phone number breakdown Given a long long integer representing a 10-digit phone number, output the area code, prefix, and li
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!