Natjo
Natjo

Reputation: 2118

Can't import class from the same package

I am new to Java and can't find my mistake, the compiler gives me this error message:

->javac B.java
B.java:3: error: cannot find symbol
import a0.A;
         ^
  symbol:   class A
  location: package a0

My classes are really simple:

package a0;

import a0.A;

public class B{
    public static void main(String[] args){
        System.out.println("Hello!");
    }
}

Class B

package a0;

public class A {
}

Class A

I work under Ubuntu 16.04, both classes are in the same directory.

Upvotes: 1

Views: 4407

Answers (1)

Paulo Henrique
Paulo Henrique

Reputation: 56

You don't need to import classes on the same package!

Upvotes: 2

Related Questions