Question: What will be printed by the given variables? public class Worksheet4_1 { static int counter; int timer; public static void main (String [] args) {

![{ static int counter; int timer; public static void main (String []](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f39f8e0565f_12566f39f8da5f0a.jpg)
What will be printed by the given variables? public class Worksheet4_1 { static int counter; int timer; public static void main (String [] args) { Worksheet4_1 object1 = new Worksheet4_1(); object1.setCoutner(); object1.setTimer(10); System.out.println("Counter = " + object1.counter + "\tTimer = " + objec Worksheet4_1 object2 = new Worksheet4_1(); object2.setCoutner(); object2.setTimer (20); System.out.println("Counter = " + object2.counter + "\tTimer = + objec } public Worksheet4_1() { this.timer = 0; this.counter = 0; } public void setCoutner () { this.counter++; } public void resetCounter() { this.counter = 0; } public void setTimer(int second) { this.timer = second; } } object1.counter 20 object1.timer 1 object2.counter 20 object2.timer 10
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
