This is my first Java piece of code.
I have AnotherClass
defined in anotherClass.java in this fiddle:
Although both classes are in the same file path, the HelloWorld
class is unable to access AnotherClass
.
What have I done wrong?
I reproduce the code in the fiddle below:
HelloWorld.java:
public class HelloWorld{
public static void main(String []args){
System.out.println("Hello World");
AnotherClass c = new AnotherClass();
}
}
anotherClass.java:
public class AnotherClass {
public AnotherClass() {
//do nothing
}
}