java - can't import own class -
i have photosscanner.java
, photosscanner.class
in same folder main.java
. , want use photosscanner
in class main
code:
import photosscanner; public class main { public static void main(string[] args) { photosscanner ps = new photosscanner(); } }
when try compile main.java
, error:
d:\space\newphotos>javac main.java main.java:1: error: '.' expected import photosscanner; ^ main.java:1: error: ';' expected import photosscanner; ^ 2 errors
in java 7 compiles without errors (i'm using java 8 now). how can import photosscanner
class?
imports in java used importing classes outside current package.
you don't need import class same package.
Comments
Post a Comment