• Package meaning: actually is the folder classification management

  • Package definition format:

    Package the package name; DZM package com.dzm; DZM package com.dzm; DZM package com.dzm;Copy the code
  • In sample code, create a new test. Java file and specify package com.dzm in the header; , that is, the test.class file will be compiled to the current directory in the /com/ DZM folder, the full path is: /com/ DZM /test.class

    package com.dzm; Public class test {public static void main(String[] args) {system.out.println (" test Package"); }}Copy the code
  • Run the compile command to compile the test. Java file and then generate /com/dzm/test.class

    $ javac -d . test.java
    Copy the code
  • Perform/com/DZM/test. The class

    $ java com.dzm.test
    Copy the code

    Output test Package

  • Guide package use