Top Posters
Since Sunday
j
3
s
3
j
2
J
2
e
2
n
2
t
2
d
2
b
2
t
2
J
2
b
2
New Topic  
stevengu246 stevengu246
wrote...
Posts: 475
4 years ago
What is the value of myCount.count displayed?

public class Test {
public static void main(String[] args) {
Count myCount = new Count();
int times = 0;
for (int i=0; i<100; i++)
increment(myCount, times);
System.out.println(
"myCount.count = " + myCount.count);
System.out.println("times = "+ times);
}

public static void increment(Count c, int times) {
c.count++;
times++;
}
}

class Count {
int count;

Count(int c) {
count = c;
}

Count() {
count = 1;
}
}


▸ 98

▸ 101

▸ 100

▸ 99
Textbook 
Introduction to Java Programming, Comprehensive Version

Introduction to Java Programming, Comprehensive Version


Edition: 10th
Author:
Read 120 times
1 Reply
Replies
Answer verified by a subject expert
Va97001Va97001
wrote...
Posts: 395
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

stevengu246 Author
wrote...

4 years ago
This helped my grade so much Perfect
wrote...

Yesterday
This site is awesome
wrote...

2 hours ago
Helped a lot
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  845 People Browsing
Related Images
  
 330
  
 381
  
 387