Results 1 to 5 of 5
  1. #1
    elizas is offline Member
    Join Date
    Jan 2010
    Location
    India
    Posts
    4
    Rep Power
    0

    Default Enhanced for loop in java

    Old form of looping.

    for (int i=0; i < nameArray.length; i++)
    {
    System.out.println("Name: " + array[i]);
    }
    With Java SE 5.0. an enhanced looping would be like

    for (String name : nameArray)
    {
    System.out.println("Name: " + name);
    }

    where nameArray is an array of Strings

  2. #2
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,016
    Rep Power
    20

    Default

    And your question is?

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,537
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Tolls View Post
    And your question is?
    Nothing; those enhanced for loops are ever so applicable to Java 2D. *ahem*

    kind regards,

    Jos ;-)

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

    Default

    Quote Originally Posted by Tolls View Post
    And your question is?
    None, pure link sig spam.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  5. #5
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,016
    Rep Power
    20

    Default

    Not much of a sales pitch, though...
    Look! I know this really, really basic thing!
    Hire me!

Similar Threads

  1. Enhanced for loop, the other "element"
    By Java Riser in forum New To Java
    Replies: 5
    Last Post: 02-23-2010, 11:47 PM
  2. Help for Enhanced for loop
    By jboy in forum New To Java
    Replies: 6
    Last Post: 09-13-2009, 06:45 AM
  3. Enhanced for loop
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-03-2007, 09:24 PM
  4. Enhanced For loop In Java
    By goldhouse in forum Advanced Java
    Replies: 1
    Last Post: 05-06-2007, 04:26 PM

Tags for this Thread

Posting Permissions

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