Eclipse creates Java classes
Open the New Java Class Wizard
You can use the New Java Class Wizard to create a Java class. You can open the Java Class Wizard in the following ways:
- Click on the "File" menu and select New > Class
- Right-click in the Package Explorer window and select New > Class
- Click the class drop-down button () and select
Before opening the Create Java Class Wizard, it is best to select the package name of the Java class, so that the package name field will be automatically populated when creating the Java class.
Using the New Java Class Wizard
In the pop-up window of the Java class wizard, you can perform the following operations:
- Confirm whether the folder name (Source Folder) and package name (Package) are correct
- Enter class name
- Choose another modifier
- Enter the name of the superclass (Superclass) or click the Browse (Browse) button to select an existing class
- Click the Add button to select the interface implemented by the class
- In the check box, you can choose the method creation method and whether to automatically generate comments
- Click the Finish button
View newly created Java classes
In the Package Explorer view, we can see the newly created class, and we can modify the code through the Java editor on the right.
Eclipse creates a Java interface
Open the New Java Interface Wizard
The New Java Interface wizard creates new Java interfaces. The ways to open the wizard are:
- Click on the File menu and select New > Interface
- Right-click in the Package Explorer window and select New > Interface
- In the drop-down box button () choose
Before opening the wizard for creating a Java interface, it is better to select the package name to which the Java interface belongs, so that the package name field will be automatically populated when creating the Java interface.
Using the New Java Interface Wizard
In the pop-up window of the Java Interface Wizard, you can perform the following operations:
- Confirm whether the folder name (Source Folder) and package name (Package) are correct
- Enter interface name
- Click the Add button and select the interface to be inherited
- Choose whether to automatically generate comments
- Click the Finish button
View the newly created java interface
In the Package Explorer view, we can see the newly created interface, and we can modify the interface code through the Java editor on the right.
Eclipse creates the XML file
Open the New XML File Wizard
You can create an XML file using the New XML File wizard. The ways to open the wizard are:
- Click on the File menu and select New > Other
- Click the New drop-down box () select Other
- Shortcut key combination: ctrl + N
The following operations can be performed in the wizard dialog box:
- Enter XML in the input box, and a wizard for associating XML will be displayed
- Select XML Files in the expanded XML category
- Click the Next button to enter the new XML file wizard
Note: Next in the wizard we can also do the following:
- Click on the File menu and select New > XML File
- Click the XML File button ( )
Using the New XML File Wizard
In the new XML file wizard, we can perform the following operations:
- Enter or select the folder to which the XML file belongs
- Enter the xml file name
- Click the Next button to configure DTD, XML Schema's XML schema description language, or you can directly click the Finish button to complete the creation of the XML file.
View the newly created XML file
In the Package Explorer view, we can see the newly created XML file, and we can modify the newly created XML file in the XML editor on the right.
The XML editor can use view mode or source mode to design XML files.