Paste-bin.xyz
Archive
Sign In
Login
Register
Username
Current Password
Keep me signed in.
Username
Full Name
Email
New Password
JAVA
56
counter
Guest on 5th July 2022 05:12:07 PM
class
Counter
{
// fields
private
int
count
;
private
int
limit
;
// constructor
Counter
(
int
count,
int
limit
)
{
this
.
count
=
count
;
this
.
limit
=
limit
;
}
// operations
void
click
(
)
{
count
=
(
++
count
)
%
limit
;
}
int
get
(
)
{
return
count
;
}
}
Raw Paste
class Counter { // fields private int count; private int limit; // constructor Counter(int count, int limit){ this.count = count; this.limit = limit; } // operations void click(){ count = (++count)%limit; } int get(){ return count; } }
Login
or
Register
to edit or fork this paste. It's free.