0
Can anyone tell me the difference between these two?
javac-d.*.java vs javac.usingpackage.java
9 Answers
+ 2
🅰🅹 🅐🅝🅐🅝🅣 please clarify this
+ 1
Atul
packages are also a directory and there may be subdirectory.
+ 1
Atul
Yes java is a main package and sub-packages are like util, lang, awt. That's why we use like:
java.util.*; // here dot(.) star (*) means all classes.
java.util.Scanner; //here we are importing single class.
java.lang.Integer;
java.lang.Long;
java.awt.*;
+ 1
🅰🅹 🅐🅝🅐🅝🅣 thanks
0
Atul
-d means directory and *.java means all java files exist in that directory so if you do like this then all java files will be compile.
But if you compile your java file with package name then it will compile that file only.
0
Directory is the upper version of packages i.e is it a term referred to a group of packages?
0
Is a subdirectory equivalent to classes or in between classes and objects? And is it possible to use directory word in place of packages?
0
Atul
packages are just use to organize classes and prevent name collision between same classes nothing else. Packages are like as directory and sub-packages are like sub-directory.
0
🅰🅹 🅐🅝🅐🅝🅣
If util and lang are sub package then java is a package means. Java stands at the greatest peak with its subdivisions starting from sub packages which we use?