-1

I try to understand the concept of packages, why do I get this error?

->javac B.java
->java B
Error: Could not find or load main class B

Class B:

package a0;

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

I work under Ubuntu 16.04.

Natjo
  • 2,005
  • 29
  • 75

1 Answers1

2

Apparently the B.class must be in a folder named like the package itself, and executed via java a0.B.

Natjo
  • 2,005
  • 29
  • 75