Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please see the code below and fill in the gaps so that the given output is correctly generated. public class Worksheet 4 _ 1 {

Please see the code below and fill in the gaps so that the given output is correctly generated.
public class Worksheet4_1{
counter =0;
int timer;
public static void main (String [] args){
Worksheet4_1 object1= new Worksheet4_1();
object1. setCoutner();
object1.setTimer(10);
System.out.println("Counter ="+,+"\tTimer =+
Worksheet4_1 object2= new Worksheet4_1();
object2.setCoutner();
object2. setTimer(20);
System.out.println("Counter =+quad+ "tTimer =+
object2. resetCounter();
System.out.println(
}
public Worksheet4_1(){
this. timer =0;
}
public void setCoutner (){
this.counter++;
}
public void resetCounter(){
this. counter =0;
}
public void setTimer(int second){
this.timer = second;
}
}
Output:
Counter =1 Timer =10
Counter =2 Timer =20
0
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

Recommended Textbook for

More Books

Students also viewed these Databases questions