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
91 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,110 points

Related Questions In Selenium

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,110 points
3,381 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
• 16,530 points
2,629 views
0 votes
2 answers

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,563 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31 in Selenium by Sri
• 2,970 points
4,569 views
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,611 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 2 in Selenium by Sri
• 2,970 points
2,905 views