I tried to create a package with some classes in it, but seems like I have some visibility problem.
This is my first class:
package trees;
public class Tree{
private static final int HEIGHT;
private static final String NAME;
public Tree(){
HEIGHT = 5;
NAME = "Basic Tree";
}
public Tree(int a, String n){
HEIGHT = a;
NAME = n;
}
public static int getHeight(){
return HEIGHT;
}
public static String getName(){
return NAME;
}
}
And this is my second class:
package trees;
public class Evergreen{
public static void main(String[] args){
Tree first_tree = new Tree(20, "Fir");
System.out.println(first_tree.getName());
System.out.println(first_tree.getHeight());
}
}
But when I compile, the terminal gives me these errors:
Evergreen.java:6: error: cannot find symbol
Tree first_tree = new Tree(20, "Fir");
^
symbol: class Tree
location: class Evergreen
Evergreen.java:6: error: cannot find symbol
Tree first_tree = new Tree(20, "Fir");
^
symbol: class Tree
location: class Evergreen
The two classes are in a folder called "trees". I tried to insert a "implement trees.*" into the Evergreen class but nothing change. I'm using Mac Maverick, compiling with the terminal and Java is up to date.
Am I doing something wrong?
Thank you for the help.