June 2018
Beginner
722 pages
18h 47m
English
If several classes or interfaces from the same package are imported, it is possible to import all the package members using the asterisk (*) wildcard character.
If SomeClass and SomeOtherClass belong to the same package, then the import statement may look like this:
package com.packt.javapath;import com.packt.javapath.something.*;public class MyClass { //... SomeClass someClass = new SomeClass(); SomeOtherClass someClass1 = new SomeOtherClass(); //...}
The advantage of using the asterisk is a shorter list of import statements, but such a style hides the names of the imported classes and interfaces. So, the programmer may not know exactly where they come from. Besides, when two or more packages contain members with ...
Read now
Unlock full access