+ 1

In java,when we should use import java.util.* and when use import java.util.Scanner?

15th Aug 2017, 10:57 AM
Gaurav Thakur
Gaurav Thakur - avatar
5 odpowiedzi
+ 2
if u want to get input frm user then u can use scanner if u want to use packages classes then u can import packages even we can create packages on our own
15th Aug 2017, 11:31 AM
corejava
+ 1
You should never import util.* unless you're sure you need all of them. that will import every packages inside util which will make the project bloated. It's always good to mention each package explicitly like import java.util.scanner
15th Aug 2017, 11:12 AM
Salekin
Salekin - avatar
+ 1
if u use * then u can use all classes on that package if u want just scanner alone then u can write as import Java.util.Scanner;
15th Aug 2017, 11:30 AM
corejava
0
If you want to give message, Actually it is very helpful suppose You made any program and anyone else is Using it, than import java. Until is very helpful Because its give you message.
15th Aug 2017, 11:30 AM
Irwin Lopez
Irwin Lopez - avatar
0
Just experience it and see its uses.
15th Aug 2017, 11:33 AM
Irwin Lopez
Irwin Lopez - avatar