Biology Forums - Study Force

Science-Related Homework Help Computer Studies Topic started by: stevengu246 on May 5, 2020



Title: What is the value of myCount.count displayed?public class Test { public static void main(String[] ...
Post by: stevengu246 on May 5, 2020
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


Title: What is the value of myCount.count displayed?public class Test { public static void main(String[] ...
Post by: Va97001 on May 5, 2020
Content hidden