在java编程中~什么时候需要引入import java.util.*;这条语句~

2024-12-24 23:50:11
推荐回答(2个)
回答1:

java.util是一个常用类集的工具包,可能你不知道什么叫常用类集,详细的说java.util包括:接口
Collection
Comparator
Deque
Enumeration
EventListener
Formattable
Iterator
List
ListIterator
Map
Map.Entry
NavigableMap
NavigableSet
Observer
Queue
RandomAccess
Set
SortedMap
SortedSet

AbstractCollection
AbstractList
AbstractMap
AbstractMap.SimpleEntry
AbstractMap.SimpleImmutableEntry
AbstractQueue
AbstractSequentialList
AbstractSet
ArrayDeque
ArrayList
Arrays
BitSet
Calendar
Collections
Currency
Date
Dictionary
EnumMap
EnumSet
EventListenerProxy
EventObject
FormattableFlags
Formatter
GregorianCalendar
HashMap
HashSet
Hashtable
IdentityHashMap
LinkedHashMap
LinkedHashSet
LinkedList
ListResourceBundle
Locale
Observable
PriorityQueue
Properties
PropertyPermission
PropertyResourceBundle
Random
ResourceBundle
ResourceBundle.Control
Scanner
ServiceLoader
SimpleTimeZone
Stack
StringTokenizer
Timer
TimerTask
TimeZone
TreeMap
TreeSet
UUID
Vector
WeakHashMap
枚举
Formatter.BigDecimalLayoutForm
异常
ConcurrentModificationException
DuplicateFormatFlagsException
EmptyStackException
FormatFlagsConversionMismatchException
FormatterClosedException
IllegalFormatCodePointException
IllegalFormatConversionException
IllegalFormatException
IllegalFormatFlagsException
IllegalFormatPrecisionException
IllegalFormatWidthException
InputMismatchException
InvalidPropertiesFormatException
MissingFormatArgumentException
MissingFormatWidthException
MissingResourceException
NoSuchElementException
TooManyListenersException
UnknownFormatConversionException
UnknownFormatFlagsException
错误
ServiceConfigurationError
如果有使用以上的接口、类等就要写上面的语句。

回答2:

用的集合框架和工具类库的时候
常用 List ArrayList Map等