Results 1 to 2 of 2
  1. #1
    mazzer07 is offline Member
    Join Date
    Oct 2013
    Rep Power

    Default How to access the elements form .length individually ?

    Hello Guys, I am struggling with one program. I need to access each one of the elements individually so I can compare them (numbers) and in the end to tell which is the maximum value. If there are 2 maximum values the program should report in which "position" there are in the list. So this is what I got so far and I am stuck of how to tell Java to get the nums individual.
    Java Code:
    public class BiggestNumber
     public static void main(String[] args)
      double number = Double.parseDouble(args[0]);
      double maxFoundSoFar = number;
      for (int listOfNumbers = 0; listOfNumbers < args.length; listOfNumbers ++)
       int restOfNumbers = Integer.parseInt(args[listOfNumbers]);
       if (restOfNumbers > maxFoundSoFar)    <---- So here how to tell it I want to compare with a num from the lenght ?
      maxFoundSoFar ++;

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Northern Virginia, United States
    Rep Power

    Default Re: How to access the elements form .length individually ?

    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Replies: 1
    Last Post: 02-11-2013, 01:29 PM
  2. access parent form public member from child form
    By .paul. in forum New To Java
    Replies: 1
    Last Post: 07-21-2012, 02:12 AM
  3. Access HTML form in Java
    By K-ML in forum Advanced Java
    Replies: 3
    Last Post: 03-01-2012, 09:48 AM
  4. Replies: 2
    Last Post: 02-13-2012, 06:39 AM
  5. JLabel, HTML Form: How to access the data?
    By q.kontinuum in forum AWT / Swing
    Replies: 0
    Last Post: 01-27-2010, 02:23 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