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.
BY Best Interview Question ON 13 Jan 2019