0
hlo my good friends I greet you. when do we import util in java.
3 Respuestas
0
In your code, it's convention to import packages after your package name (if you're working inside a package with the name), but before you open your class declaration. So, a code would be structured like this:
package mypackage;
import java.util.*;
public class MyClass {
/* All your class code */
}
If you're asking when you would want the functionality in java.util, there are a lot of cases. java.util offers solutions to a lot of things it'd be tedious to hand-code: it provides frameworks for collections; it has functions for dates and times; it has data structures like hash tables, linked lists, hash maps, and dictionaries; it offers string parsing and formatting support... it does a lot. You may want to look up a list of what's available in java.util and just scan down the descriptions.
0
it is common practice to import at the beginning of the document before your public static void main(String[] args) line
0
it is a inbuilt package in java. it have many methods and class .usually for scanner we use this package