Loading…

How we can create packages in Java?

Here are the steps for creating a package:

  • Choose a name for the package
  • On top of every source file, put the package statement with the package name. Source file must contain classes and types that you want in the package.
  • Package statement is the first line of source file.
  • You can only have one package statement in each file
  • It applies to all file types.

Suggest An Answer

No suggestions avaliable!

Latest post from Java interview questions

Ask Question