When a subclass method has the same name, parameter list and return type as a method in the parent class, the method is said to be: extended O overriden O overloaded O overexte

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 8RQ
icon
Related questions
Question
Given
class x{
static int a;
int b=12;
void m1(0){ }
static void m2(){ }
}
class Ab extends x{
static int a;
int b=10;
void m10{ }
static void m20){ }
public static void main (String[] args){
int b=3;
x obj=new Ab();
}
}
How can you display the contents of the variable "b" in the child
class
cast obj before getting access to it
O just use obj.b
O you cannot get access to the "b" in the child class
O use the super keyword
Transcribed Image Text:Given class x{ static int a; int b=12; void m1(0){ } static void m2(){ } } class Ab extends x{ static int a; int b=10; void m10{ } static void m20){ } public static void main (String[] args){ int b=3; x obj=new Ab(); } } How can you display the contents of the variable "b" in the child class cast obj before getting access to it O just use obj.b O you cannot get access to the "b" in the child class O use the super keyword
When a subclass method has the same name, parameter list and
return type
as a method in the parent class, the method is said to be:
extended
overriden
overloaded
overextended
Transcribed Image Text:When a subclass method has the same name, parameter list and return type as a method in the parent class, the method is said to be: extended overriden overloaded overextended
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,