How to start creating Java class in Eclipse
Create a new class
First you create a new Java project.
To create a Java class in Eclipse you need to use the new Java Class Wizard. The Java Class Wizard can be invoked in different ways. Any of the methods described below can be used.
>> By clicking the File menu.
Click File > New > Class
>> By clicking on the class drop down button on ribbon.
>> By right clicking in the anywhere on package explorer.
Using the new Java Class Wizard
- The source folder automatically captures.
- Package – keep it blank (Takes the default package)
- Enter the name of the class
- Select class modifier. Now select public
- Select method – we choose public void main method.
You can click the Finish button to create a new class of Java.
Package Explorer window
A class named Newly Generated Tutorials can be viewed in Package Explorer. The same appears in the editor area.
Auto generated Java Code
public class Tutorials { public static void main(String[] args) { // TODO Auto-generated method stub } }
Example Java Code
Sample Java Code
public class Tutorials { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("WELCOME to techsiter.com"); } }
Run the code
To run the code you have to press the play button which appears on the ribbon bar.
Result
Once the code is run, the result of the code can be viewed in the console window.
Popular post
-
Eclipse IDE – Create New Java Project.
Opening the New Java Project…
-
How to start the project in android studio
Android Studio Open the Android…
-
How to use ACOSH function in excel
The ACOSH function returns the…
-
Complete Header tags in html – easy to learn
H tags can be used…
-
Best features in Python programme – easy to learn
Python is the most widely…