Requirement:- How to write a Java program in Eclipse?
Solution:-
Step1:-
After downloading Eclipse, launch the IDE and select the WorkSpace.
![]() |
Launching Eclipse |
Step2:-
File ->New->JavaProject
Click Finish
![]() |
Creating Java Project |
Step3:-
Program will be created,under Package Explorer(On the Top Left Corner)
Note:-Incase “Package Explorer” is not visible, follow the path, Window->ShowView->Package Explorer
![]() |
Package Explorer |
Step4:-
File->New->Class
or
Right Click the “Java Project ” in Package Explorer ->New ->Class
Step5:-
Give the Name of “Class” and click Finish
Note:- Select the option “public static void main(String[] args)” incase you want default method to be included in the code
![]() |
Adding Class with default Method |
Step6:-
Type “sysout” -> Press “CTRL+SpaceBar” -> Select the sysout option.
Note:- We can use -> “main” + CTRL+SpaceBar for creating “Public static void Main” method.
![]() |
SYSOUT shortcut |
Step7:-
Write most awaited “HelloWorld!” inside the System.out.println(); and “File->Save”
Step8:-
RightClick the ProgramName ->RunAs->JavaApplication
or
Directly click the “Run” icon on the ToolBar(CTRL+F11)
![]() |
Run Java Program |
Step9:-
On the bottom, check the results under “Console”
![]() |
Console Result |
Congrats!!We are done with our First Program 🙂
Now let us learn how to write our first selenium test case..