Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What will be printed by the given variables? public class Worksheet 4 _ 1 { static int counter; int timer; public static void main (

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 ="+ object1.timer);
Worksheet4_1 object2= new Worksheet4_1();
object2. setCoutner();
object2. setTimer(20);
System.out.println("Counter ="+ object2.counter +"\tTimer ="+ object2.timer);
}
public Worksheet4_1(){
this. timer ?b=ar(0);
this. counter =;
}
public void setCoutner (){
this. counter++;
}
public void resetCounter(){
this. counter =0;
}
public void setTimer(int second){
this.timer = second;
}
}
object1.counter
object1.timer
object2.counter
object2.timer
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What is conservative approach ?

Answered: 1 week ago

Question

Identify five strategies to prevent workplace bullying.

Answered: 1 week ago