How do i run this piece of code? It's a clicker.
public class Counter{
private int value;
public Counter(int initialValue){
value = initialValue;
}
public void click(){
value = value + 1;
}
public int getValue(){
return value;
}
}
I'm running osX and i want this 'executed' in the terminal. The file (Counter.java) is placed on the desktop, therefor the first thing i do in the terminal is
cd desktop
javac Counter.java
After this i want to call click, but i'm not sure how to. I tried 'java Counter.click()' but it gives me the error: -bash: syntax error near unexpected token `(' .
This is a very noobish question, sorry :)