Syntax to import multiple packages
Answers
Answered by
0
A class can have only one package declaration but it can have more than one package import statements.
Answered by
7
Answer:
In Java, you can import entire package using *. to import multiple packages. e.g. import com.to import*; everything from package1. To import multiple packagepackage1.s, e.g.
import com.package1.*;
import com.package2.*;
import com.package3.*;
Importing on a single line like import package1.*,package2.*,package3.*; is not possible in java but you can import entire directory if the packages are in the same directory as in import com.*;
Similar questions