English

What is the significance of '*' while importing a package? - Computer Applications

Advertisements
Advertisements

Question

What is the significance of '*' while importing a package? 

Answer in Brief

Solution

  1. The asterisk sign imports all classes from the imported package. To import a specific class, replace the "*" sign with its name in the import declaration. 
  2. Example: 
    import java.util.*; // imports all classes in the util package
    import java.util.Scanner; // imports only Scanner class from the util package 
shaalaa.com
  Is there an error in this question or solution?
Chapter 2: Library Classes - EXERCISES [Page 179]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 2 Library Classes
EXERCISES | Q VII. 2. | Page 179
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×