Shivi Singla
Shivi Singla

Reputation: 23

importing class from one file to another file java package does not exist

I have two files: file1:

package firstclass.dep;
public class Main {
    public static void main(String[] args) {
        System.out.println("Hello world!");
        final firstclass abc = new firstclass() ;
        abc.dep();
}
}

File2:

class firstclass{
    public void dep(){
        System.out.println("Hi");
}
}

I am trying to import first-class file to main class file and its showing me error:

Main.java:1: error: package firstclass does not exist import firstclass.dep; ^ 1 error

Upvotes: 0

Views: 61

Answers (0)

Related Questions