Examples of some common java pacakges are below
IO contains InputStream Class,OutStream Class,PrintStream Class etc.
Sql package contains classes related to database.
lang package contains System Class,Object Class,Class Class and reflect package.
awt package contains component Class,Button Class,event package etc.
Packages are used to group similar classes together.
Importing packages in java . We can either import a package in java and then the classes from that package later on like this
import javafx.scene.Node
Or we can simply use the Node Class without importing the package just like this
javafx.scene.Node = null;
Please note if we have two different nodes in that we are using in our package we can't just import both of them .We have to use atleast one of them the way we are using here
org.wj3.done.Node nodeTwo = null;
Also note we can either import single classes from a package like this import java.awt.Frame; Or simply import all the classes of a particular package like this
import java.awt.*
Also note that event is a seperate package within the awt all together so java.awt.* wont import it as it will only import all the classes in awt package and not any pacakges inside it so we and have to import it separately using
import java.awt.event.*
But also note that only those classes which we are using in our class will be compiled and loaded into JVM at runtime and not all the classes event or awt package.
Also note we can go external libraries on the left hand side in intellij and see all available packages there.
Or we can click on any classes in the imports like click on Frame in import java.awt.Frame and then see what the Frame class does.
Benefits of packages