I am wondering how to use a class from another package
here's a file that inside the package project1
package project1;
class student{
void print(){
System.out.println("s");
}
}
class teacher{
void print(){
System.out.println("t");
}
}
public class Project1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}
}
here's a file inside a the package project2
package project2;
import project1.student;
public class Project2 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
student x = new student();
}
}
but I am getting a error that student is not in public,
Am I importing the student class in a wrong way that I can't use the student class , or it's impossible to do this?