Hi Please help me with this problem

Write the definition of a class Play containing:
An instance variable counter of type int , initialized to 0.
A method called increment that adds one to the instance variable counter . It does not accept parameters or return a value.
A method called getValue that doesn't accept any parameters. It returns the value of the instance variable counter .

my code:
public class play
{
int counter =0;
public void increment()
public getValue(){       //something is wrong here 
return counter;}
}

Any advice would be appreciated

Ok, your method increment needs to increment that counter variable, which you aren't doing...

There actually isn't anything wrong with the method getValue.

Try to think about what should happen in the increment method and then post again what you have if it isn't working.

public void increment() {
   // something needs to happen here.
}

[wrong]Why did you think there was something wrong with your return statement?[/wrong]
Ok, there is something wrong there, every method in Java needs to know what its return value is.

Black Box.

thanks Black Box I fixed it now tyty !!:D

No problem, welcome to DaniWeb btw. :)
If you're pretty new to Java, you might want to check out the sticky topic posted by sos at the top of this Java-forum. A lot of basic useful information which will take you to the next level in no time.

Black Box.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.