I'm just beginning to learn java, I created an object counter:
public class Counter
{
private int value;
public void setCounter(int count)
{
value = count;
}
public void click()
{
value = value + 1;
}
public int getValue()
{
return value;
}
public void reset()
{
value = 0;
}
}
When I tried to creat an object of Counter into my Driver class it gave me the error: Exception in thread "main" java.lang.Error: Unresolved compilation problems: Counter cannot be resolved to a type Counter cannot be resolved to a type at Driver.main(Driver.java:4)
public class Driver {
public static void main(String[] args) {
Counter count = new Counter();
count.setCounter(0);
}
}
I'm not sure if this is necessary but I use eclipse.
Edit: I copied and pasted both of the classes into new classes in a different project and it worked so I think it might have something to do with eclipse rather that my code.