0
How do you use packages in java?
Hi! I use Sublime Text and I wanted to know how you insert java packages, do you just write package and the file extension?
3 ответов
+ 1
if you have class LibClass and want add it to package Lib and then call it from Main code
- LibClass must be public
- LibClass must be in file LibClass.java
- first statement in LibClass.java must be:
package Lib;
- in directory where you run Main code create subdirectory Lib
- move LibClass.java into subdirectory Lib
- in your Main code must be at beginning of file
import Lib.LibClass;
//or
import Lib.*;
+ 1
yes, folder.
0
Thank you so much. One question: what do you mean by subdirectory? Is it a folder?