Dillon Dillon - 1 year ago 95
Java Question

Java how to import .util into created package

I decided to created a new package and i made class inside that package and tried to Import java.util.Random and it gives me an error "syntax error on token "package", . Expected.

Typing Import java.util.Random Worked in the default package

Answer Source

The package should come before the import

package ballhockeymanagergame;
import java.util.Random;

public class Main { public static void main(String[] args) { } } 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download