我正在学习Java并编写了一个非常简单的程序.在其中我可以将枚举放在最顶层,但不在方法内.我看到它的方式,枚举几乎就像常量,所以为什么不在方法中使用它们呢?
在我的程序中,允许使用enum1,但不允许使用enum2.为什么?
enum enum1 {A, B, C};
public static void main(String[] args)
{
enum enum2 {A, B, C}; // only on a top level class or interface
}
Run Code Online (Sandbox Code Playgroud) 我的Eclipse中有一个maven项目.我可以单击一个类,Eclipse将打开"Type"导航器,它将显示class(.class)文件,也可能是一些源代码 - 如果有的话 - 但是我如何让Eclipse向我显示maven依赖项或带来的依赖项在那堂课?
编辑:我知道如何在我当地的.m2回购中找到位置.我正在寻找的是一种了解该类关联的maven依赖关系的方法.
例如,如果我点击HTTPClient,Eclipse会告诉我The Jar file /Users/clangdon/.m2/repository/net/authorize/sdk/1.4.6.jar has no source attachment,但我怎么知道这与maven依赖关联
<dependency>
<groupId>net.sf.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>2.3</version>
<scope>compile</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)