Create Project
Close all other projects before starting a new lab.
First, create a Lab2 class containing main. In this step, we will create
Lab2.java
with only a main method in it.
Following are the steps.
-
Create a new project with the name “Lab2” by Clicking File → New Java Project and setting the name as “Lab2”.
-
Create a new package with the name “lab2” by right clicking on the “src” folder, selecting New → Package, and setting the name as “lab2”.
-
Create a new class with the name “Lab2” by right clicking on the package “lab2”, selecting New → Class, and setting the name as “Lab2”. Also create the static main method stub by selecting the checkbox for stubs.
The Lab2 class is generated by Eclipse with a main method stub.