What happens if I don't create a Package and add a Class directly under the Project in Eclipse?

0 votes
What happens if I don't create a Package and add a Class directly under the Project in Eclipse?
Jul 16, 2019 in Selenium by Avantika
75 views

1 answer to this question.

0 votes

Hello Avantika, its not considered as a good practice to create a Class without a Package in a Project. To understand why, follow these steps:

1. Create a New Java Project named "demoProject" in Eclipse IDE

2. Now, don't create any Package under this Project

3. Next, right click on the Project "demoProject" and select 'New' -> 'Class' option as shown below:

4. Ensure that 'New Java Class' dialog is displayed and observe that Package text box field is displayed empty.

5. In 'New Java Class' dialog, enter the Class Name as "Third" into the 'Name' field  and observe that the warning message "The use of the default package is discouraged" is displayed as shown below:

6. Click on 'Finish' button on the 'New Java Class' dialog and ensure that the "Demo" Class will get added with the Default package and No Package name got added automatically by Eclipse IDE as shown below:

answered Jul 16, 2019 by Anvi
• 14,090 points

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer

How to create a Base Class in Selenium and use it with test scripts?

Hi Donna, you can use following code ...READ MORE

answered Jul 18, 2019 in Selenium by Anvi
• 14,090 points
2,823 views
+1 vote
1 answer

How can I automate the process of adding iPhone to cart in Flipkart using Selenium(java),Page Object Model and TestNG? Also validate if product is added and available in cart?

Hey check this https://www.edureka.co/community/47160/automate-purchase-adding-book-cart-flipkart-using-selenium? It deals with a similar ...READ MORE

answered Jan 13 in Selenium by Karan
• 11,770 points
2,378 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,510 points
3,158 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points
2,373 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,890 points
2,525 views