Top Posters
Since Sunday
c
6
r
4
c
3
m
3
h
3
1
3
n
3
s
3
d
3
c
3
a
3
r
3
New Topic  
be beautiful be beautiful
wrote...
Posts: 483
Rep: 9 0
4 years ago
Analyze the following code:

public class Test {
public static void main(String[] args) {
new B();
}
}

class A {
int i = 7;
 
public A() {
System.out.println("i from A is " + i);
}
 
public void setI(int i) {
this.i = 2 * i;
}
}

class B extends A {
public B() {
setI(20);
// System.out.println("i from B is " + i);
}
 
public void setI(int i) {
this.i = 3 * i;
}
}


▸ The constructor of class A is called and it displays "i from A is 60".

▸ The constructor of class A is called and it displays "i from A is 40".

▸ The constructor of class A is called and it displays "i from A is 7".

▸ The constructor of class A is not called.
Textbook 
Introduction to Java Programming, Comprehensive Version

Introduction to Java Programming, Comprehensive Version


Edition: 10th
Author:
Read 67 times
1 Reply
Replies
Answer verified by a subject expert
Brittany08196Brittany08196
wrote...
Posts: 368
4 years ago
Sign in or Sign up in seconds to unlock everything for free
More solutions for this book are available here

Related Topics

be beautiful Author
wrote...

4 years ago
This site is awesome
wrote...

Yesterday
This calls for a celebration Person Raising Both Hands in Celebration
wrote...

2 hours ago
Thanks
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  1327 People Browsing
Related Images
  
 2594
  
 2671
  
 391
Your Opinion
What percentage of nature vs. nurture dictates human intelligence?
Votes: 436