Top Posters
Since Sunday
L
4
d
4
3
k
3
k
3
j
3
k
3
b
3
f
3
b
3
d
3
h
3
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 110 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
Thank you, thank you, thank you!
wrote...

Yesterday
Helped a lot
wrote...

2 hours ago
Smart ... Thanks!
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  934 People Browsing
Related Images
  
 34
  
 436
  
 165
Your Opinion