Java package folders with a dot in the name

前端 未结 2 987
臣服心动
臣服心动 2021-01-21 01:37

Is it by spec that, given a MyClass.java file containing

package com.mycorp.foo;

public class MyClass {
  public static void main (String[] args) {         


        
2条回答
  •  甜味超标
    2021-01-21 02:02

    The Oracle documentation points to the fact the source tree does not have to match the object files tree. javac lets anything go for that very reason, but java will require the directory structure to follow the standard of having one subdirectory per element of the dot-separated package name.

提交回复
热议问题