I created a file Organ.java
package OrganProject;
public class Organ{
private String name;
private String condition;
public Organ(String name, String condition){
this.name = name;
this.condition = condition;
}
public String getName(){
return this.name;
}
public String getCondition(){
return this.condition;
}
public void setName(String name){
this.name = name;
}
public void setCondition(String condition){
this.condition = condition;
}
public void display(){
System.out.println("Name: " + this.getName());
System.out.println("Condition: " + this.getCondition());
}
}
however, when I call this class in Main.java
package OrganProject;
public class Main {
public static void main(String[] args) {
Organ organ = new Organ("eye", "good");
organ.display();
}
}
There was an error showing that
Main.java:7: error: cannot find symbol
Organ organ = new Organ("eye", "good");
^
symbol: class Organ
location: class Main
Main.java:7: error: cannot find symbol
Organ organ = new Organ("eye", "good");
^
symbol: class Organ
location: class Main
2 errors
The 2 files are all in the same folder called OrganProject; however, they seem unable to interlink each other. May I ask what is the reason behind it and how to resolve this problem?
I had tried to create new folder and move the files into that new folder, hope can refresh the compile, however, it did not work.