hlo my good friends I greet you. when do we import util in java. | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

hlo my good friends I greet you. when do we import util in java.

28th Sep 2016, 4:23 PM
Jeremy Oceans
Jeremy Oceans - avatar
3 Réponses
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.
28th Sep 2016, 4:35 PM
An Owomoyela
An Owomoyela - avatar
0
it is common practice to import at the beginning of the document before your public static void main(String[] args) line
28th Sep 2016, 6:43 PM
Eric Kershner
Eric Kershner - avatar
0
it is a inbuilt package in java. it have many methods and class .usually for scanner we use this package
5th Oct 2016, 4:54 PM
vinay sharma
vinay sharma - avatar