0
0
Javaprogramming~15 mins

Why packages are used in Java - Test Your Understanding

Choose your learning style8 modes available
ads_clickPractice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare a package named 'com.example.app'.

Java
package [1];
🎯 Drag options to blanks, or click blank then click option
Acom.example.app
Bexample.com.app
Capp.example.com
Dcom_app_example
Attempts:
3 left
2fill in blank
medium

Complete the code to import the class 'MyClass' from package 'com.example.utils'.

Java
import [1].MyClass;
🎯 Drag options to blanks, or click blank then click option
Autils.example.com
Bcom.example.utils
Cexample.com.utils
Dcom_utils_example
Attempts:
3 left
3fill in blank
hard

Fix the error in the package declaration to follow Java conventions.

Java
package [1];
🎯 Drag options to blanks, or click blank then click option
ACom.Example.App
Bcom_example_app
Cexample.com.app
Dcom.example.app
Attempts:
3 left
4fill in blank
hard

Fill both blanks to create a package and import statement for 'utils' package.

Java
package [1];
import [2].Helper;
🎯 Drag options to blanks, or click blank then click option
Acom.example.utils
Bcom.example.helpers
Attempts:
3 left
5fill in blank
hard

Fill all three blanks to declare a package, import a class, and create an object of that class.

Java
package [1];
import [2].Service;
public class Main {
    public static void main(String[] args) {
        [3] obj = new Service();
    }
}
🎯 Drag options to blanks, or click blank then click option
Acom.example.app
Bcom.example.service
CService
Attempts:
3 left