Given the code fragment from three files:
Which code fragment, when inserted at line 2, enables the code to compile?
Given the code fragment from three files:
Which code fragment, when inserted at line 2, enables the code to compile?
To compile the code, you need to import classes from both the 'sales' package and the 'sales.products' package. Specifically, 'SalesMan' is located in the 'sales' package and 'Product' is located in 'sales.products' package. Therefore, the correct code to insert at line 2 is 'import sales.*;' and 'import sales.products.*;'. This will ensure that both 'SalesMan' and 'Product' are available to the 'USMarket' class. The correct option is E.
Correct E
import sales.*; import sales.products.*; OR import sales.SalesMan; import sales.products.Product;
Agreeed, Option E is correct!
Answer is E, but there is a typo for last class. file name mentioned as Market.java however the class name is defined as USMarket.java.
correct anser is E
Import sales* - Imports all classes in sales but sales itself. Correct answer is C
E ist correct!
Incorrect question: if class name of public class is USMarket then file can't have name Market.java If we rename public class or file - correct answer "E"
Answer - E
E is the correct
Correct - E
E is the correct answer.
Answer E
Answer C
Sorry it's answer E