Results 1 to 15 of 15
  1. #1
    rakeshkool27 is offline Member
    Join Date
    Nov 2013
    Posts
    12
    Rep Power
    0

    Default Question on java.util.Enumeration

    Can anyone make me understand what do this line means??

    Enumeration<NetworkInterface> interfaceList = NetworkInterface.getNetworkInterfaces();

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,516
    Rep Power
    25

    Default Re: Question on java.util.Enumeration

    Have you read the API doc for the getNetworkInterfaces() method? Do you have any questions about what it says?
    Post the API doc and your questions about it.

    I'm assuming you know what an assignment statement is and what a static call to a method is.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,050
    Rep Power
    6

    Default Re: Question on java.util.Enumeration

    MAKE you understand? No, that is entirely up to you. You have to WANT to understand it first. Usually that starts by doing a simple google.

    Google search: java NetworkInterface.getNetworkInterfaces()
    First hit: Listing Network Interface Addresses (The Java™ Tutorials > Custom Networking > Programmatic Access to Network Parameters)
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  4. #4
    rakeshkool27 is offline Member
    Join Date
    Nov 2013
    Posts
    12
    Rep Power
    0

    Default Re: Question on java.util.Enumeration

    About the NetworkInterface, I got that its a class of java.net and getNetworkInterfaces() is a method which returns the list of interfaces. Thats part is fine.

    I am not getting the "Enumeration<NetworkInterface> interfaceList " properly. Actually I am new to Java, I am acquainted with C and have some understanding of enum, but this Enumeration thing here is making me confused.

    I also checked out the API documentation for Enumeration
    Enumeration (Java Platform SE 7 )

    but not much gone through my head by this documentation.

  5. #5
    rakeshkool27 is offline Member
    Join Date
    Nov 2013
    Posts
    12
    Rep Power
    0

    Default Re: Question on java.util.Enumeration

    Yup gimbal2, I obviously google it then I ask when I dont get a proper answer from Google.

    I just want to know about the assignment in a plain language, thats what I want.

    Suppose in C

    int* array[30];

    If you need to explain it you need to say -- its an array of integer pointers for storing 30 integer addresses.

    This is the type of explanation I want to know.

  6. #6
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,050
    Rep Power
    6

    Default Re: Question on java.util.Enumeration

    Why? If you can't translate a piece of code to English, you need to learn the language, not ask questions in a forum. That's a wrong and utterly unrelated example.

    Step 2 in WANTING to understand: taking the time to ask a properly informed question. "What is this" (which your question boils down to) hardly is one, wouldn't you agree? Start by asking what about that line you don't understand. What an Enumeration is? What network interfaces are? Perhaps you don't understand that <NetworkInterface> bit (generics) ?
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  7. #7
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default Re: Question on java.util.Enumeration

    Enumeration<NetworkInterface> interfaceList basically means that interfaceList is an Enumeration that holds Objects of type NetworkInterface , FWIW.

    EDIT: as gimbal said, read the docs and google generics.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  8. #8
    rakeshkool27 is offline Member
    Join Date
    Nov 2013
    Posts
    12
    Rep Power
    0

    Default Re: Question on java.util.Enumeration

    Quote Originally Posted by PhHein View Post
    Enumeration<NetworkInterface> interfaceList basically means that interfaceList is an Enumeration that holds Objects of type NetworkInterface , FWIW.

    EDIT: as gimbal said, read the docs and google generics.
    Hmmmm......

  9. #9
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,516
    Rep Power
    25

    Default Re: Question on java.util.Enumeration

    Is the problem with the syntax? The classname inside of <>?
    See the tutorial about Generics: Lesson: Generics (The Java™ Tutorials > Bonus)
    If you don't understand my response, don't ignore it, ask a question.

  10. #10
    rakeshkool27 is offline Member
    Join Date
    Nov 2013
    Posts
    12
    Rep Power
    0

    Default Re: Question on java.util.Enumeration

    Quote Originally Posted by gimbal2 View Post
    Why? If you can't translate a piece of code to English, you need to learn the language, not ask questions in a forum. That's a wrong and utterly unrelated example.

    Step 2 in WANTING to understand: taking the time to ask a properly informed question. "What is this" (which your question boils down to) hardly is one, wouldn't you agree? Start by asking what about that line you don't understand. What an Enumeration is? What network interfaces are? Perhaps you don't understand that <NetworkInterface> bit (generics) ?
    Hey gimbal2,
    I have already said I am new to Java. Actually I was going through Socket Programming part while reading Computer Networks, so I found some Java program codes which I am not much acquainted with. Yep I do agree to understand the whole thing I need to see through the whole documents but for the time being I just wanted to know what this line is contributing to the code. I have not still now explored the Java Enumeration package much.

    Asking a human is more understandable and better rather than exploring through the HTML links I guess, so I dropped my question here. I know u people are experts and genius people and so I guessed u people could explain easily. But the scenario is not the same as I thought.

    Fine. Thanks for wasting your precious time then. No issues with you gimbal2.

  11. #11
    rakeshkool27 is offline Member
    Join Date
    Nov 2013
    Posts
    12
    Rep Power
    0

    Default Re: Question on java.util.Enumeration

    Quote Originally Posted by Norm View Post
    Is the problem with the syntax? The classname inside of <>?
    See the tutorial about Generics: Lesson: Generics (The Java™ Tutorials > Bonus)
    Exactly....

  12. #12
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,050
    Rep Power
    6

    Default Re: Question on java.util.Enumeration

    Quote Originally Posted by rakeshkool27 View Post
    Hey gimbal2,
    I have already said I am new to Java.
    I understand that, but that says nothing about needing to read and needing to clarify yourself.

    Fine. Thanks for wasting your precious time then.
    You're not! But for heaven's sake, make your own life easier and do the right thing in stead of the easy thing.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  13. #13
    rakeshkool27 is offline Member
    Join Date
    Nov 2013
    Posts
    12
    Rep Power
    0

    Default Re: Question on java.util.Enumeration

    Quote Originally Posted by gimbal2 View Post
    I understand that, but that says nothing about needing to read and needing to clarify yourself.



    You're not! But for heaven's sake, make your own life easier and do the right thing in stead of the easy thing.
    Hello gimbal2,
    If you want to prove that you are smarter guy, fine I have no issue....coz I perfectly understand that only people with limited knowledge have big mouths like you...Happy day dreaming....
    And please no need to waste your time by replying again...I do agree that I am more dumb than you and you are the smartest guy...

  14. #14
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,516
    Rep Power
    25

    Default Re: Question on java.util.Enumeration

    Hey you guys. Try keeping it non-personal. Leave out the you, your and I words. Talk about programming.
    If you don't understand my response, don't ignore it, ask a question.

  15. #15
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,050
    Rep Power
    6

    Default Re: Question on java.util.Enumeration

    Sigh :(
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. StringArray Enumeration
    By loopsnhoops in forum New To Java
    Replies: 1
    Last Post: 06-01-2011, 06:30 PM
  2. nxn 0-1 array enumeration
    By hollygrove in forum Advanced Java
    Replies: 3
    Last Post: 10-16-2009, 09:33 AM
  3. Enumeration
    By kishan in forum Advanced Java
    Replies: 3
    Last Post: 06-19-2009, 12:27 AM
  4. java.util.zip Question
    By acp26b in forum New To Java
    Replies: 3
    Last Post: 08-07-2008, 05:12 AM
  5. Declaring Enumeration
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-04-2007, 05:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •