Eclipse 简明教程

Eclipse - Create Java Interface

Opening the New Java Interface Wizard

可以使用“新建 Java 接口”向导新建 java 接口。有许多打开此向导的方法 −

The New Java Interface wizard can be used to create a new java interface. There are many ways of opening this wizard −

  1. Clicking on the File menu and selecting New → Interface.

  2. Right clicking in the package explorer and selecting New > Interface.

  3. Clicking on the class drop down button () in the tool bar and selecting Interface ().

  1. 启动“新建 Java 接口”向导之前,如果可能,请选择要创建接口的包,以便向导可以自动为您填写包名。

Before bringing up the New Java Interface wizard, if possible, select the package in which the interface is to be created so that the wizard can automatically fill in the package name for you.

Using the New Java Interface Wizard

  1. “java 接口”向导启动后 −

Once the java interface wizard comes up −

  1. Ensure the source folder and package are correct.

  2. Enter the interface name.

  3. Click on the Add button to select the extended interfaces.

  4. Select the Generate comments check box if you like comments to be generated.

  5. Click on the Finish button.

new java interface

Viewing the Newly Created Java Interface

  1. 新创建的接口应显示在“包资源管理器”视图中,并且允许您修改新接口的 java 编辑器实例应显示在编辑器区域中。

The newly created interface should appear in the Package Explorer view and a java editor instance that allows you to modify the new interface should appear in the editor area.

new java interface pe