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 in Selenium by Avantika
24 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 by Anvi
• 13,840 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 in Selenium by Anvi
• 13,840 points
139 views
0 votes
1 answer

How should I configure the chromedriver.exe in eclipse

Use the page factory pattern, working example: public ...READ MORE

answered Mar 27, 2018 in Selenium by Atul
• 5,530 points
4,730 views
0 votes
1 answer

What are the differences between getText() and getAttribute() functions in Selenium WebDriver?

See, both are used to retrieve something ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,090 points
5,678 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,090 points
799 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,130 points
1,039 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,130 points
743 views