• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

any java person out there??

Bacardi151

Senior member
i was wondering if the statement "import java.util.*" actually imports all the stuff such as Collection, LinkedList etc. all together or if i have to separately import one by one....i.e. import java.util.AbstractCollection, import java.util.AbstractList, and so forth

thanks in advance!
 
havent used java in a while but IIRC:

import java.util.* will import ALL classes one banch directly undeneath. so java.util.abstractcollection will import but NOT java.util.abstractcollection.blurb
although, i'm sure its better to only import what you need, unless the compiler/interpreter does that for you.
 
Originally posted by: WannaFly
havent used java in a while but IIRC:

import java.util.* will import ALL classes one banch directly undeneath. so java.util.abstractcollection will import but NOT java.util.abstractcollection.blurb
although, i'm sure its better to only import what you need, unless the compiler/interpreter does that for you.

i dont think thats correct. Import java.util.* should import all the child classes of java.util package.
if you have java.util.color.rgb or something, rgb will get imported if you do java.util.*
 
Originally posted by: halik
Originally posted by: WannaFly
havent used java in a while but IIRC:

import java.util.* will import ALL classes one banch directly undeneath. so java.util.abstractcollection will import but NOT java.util.abstractcollection.blurb
although, i'm sure its better to only import what you need, unless the compiler/interpreter does that for you.

i dont think thats correct. Import java.util.* should import all the child classes of java.util package.
if you have java.util.color.rgb or something, rgb will get imported if you do java.util.*

I just tested it (haven't used Java in about 4 months) and it imports EVERYTHING under util.

Edit: here's the structure for LinkedList

java.util.AbstractCollection
java.util.AbstractList
java.util.AbstractSequentialList
java.util.LinkedList
 
Originally posted by: halik
Originally posted by: WannaFly
havent used java in a while but IIRC:

import java.util.* will import ALL classes one banch directly undeneath. so java.util.abstractcollection will import but NOT java.util.abstractcollection.blurb
although, i'm sure its better to only import what you need, unless the compiler/interpreter does that for you.

i dont think thats correct. Import java.util.* should import all the child classes of java.util package.
if you have java.util.color.rgb or something, rgb will get imported if you do java.util.*

i think you are correct. it should get everything underneath.
 
is there some sort of update that i need because i seem to have trouble importing some of the utilities, such as Queue, HashMap...should those be inherited when i do the import of java.util.*; ??

and is Edge an actual class?...likewise with Vertex, anybody heard of those two? (this is for a network/graph)
 
Originally posted by: Bacardi151
is there some sort of update that i need because i seem to have trouble importing some of the utilities, such as Queue, HashMap...should those be inherited when i do the import of java.util.*; ??

and is Edge an actual class?...likewise with Vertex, anybody heard of those two? (this is for a network/graph)


Edge and Vertex are not default classes in Java. Queue is not a class in java. HashMap is a class and its java.util.HashMap;

EDIT: I remember in my AP CS class that they provided us with a Queue interface and we built our own class off of it, ListQueue, etc;

BTW: The JavaDocs are your friend.
 
Back
Top