Java - Can't import com.package.*(wildcard)

后端 未结 2 1778
难免孤独
难免孤独 2021-01-19 07:01

This may be a simple issue, but Google has returned nothing.

I have read Help with packages in java - import does not work

I still don\'t understand why a di

2条回答
  •  既然无缘
    2021-01-19 07:50

    In java, you can import an entire package:

    import package.name.*;
    

    Or you can import a specific member of a package

    import package.name.class_name;
    

    Don't confuse the dots in package names with the member access operator - they're just literal dots. You can't try to import multiple packages by breaking apart the package names.

    import package.*;  //doesn't work
    import packa*;  //doesn't work for the same reason
    

提交回复
热议问题