Why does my java code not compile -
the file compiles , works expected when try use in file keeps saying when attempt compile. don't know how import code file correctly. how import file use within , have read many explanations require ide don't plan on using, using notepad++.
you import readfile.*;
readfile
not package name class name. package allows categorize classes. take @ http://en.wikipedia.org/wiki/java_package more details.
put readfile.java
package (for example: package org.your-company.io
) in second class:
import org.your-company.io.readfile;
the instruction import somepackage.*
indicates can use classes package somepackage
in current class. example, if do:
import java.sql.*;
i able call, in code, directly:
date dsql = ... // java.sql.date drivermanager driver = ... // java.sql.drivermanager etc.
edit
as dukeling mentionned in comment, if classes in same "folder" (i mean package), can remove instruction import readfile.*
wrong , useless.
Comments
Post a Comment