Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: how do i return which array entered is the lowest not the number entered

  1. #1
    Junior Member
    Join Date
    Dec 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default how do i return which array entered is the lowest not the number entered

    hi

    can someone show me how do i print out which array entered is the lowest not the number entered
    public static double lowest( double[] rain)
        {
            double lowest = rain[0];
     
            for (int i=0;i<rain.length;i = i + 1)
            {
                if(rain[i]< lowest)
                    lowest = rain[i];
            }
            return lowest;
        }
    thanks
    Last edited by helloworld922; December 4th, 2010 at 05:24 PM.


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: how do i return which array entered is the lowest not the number entered

    I'm confused, what is it you want? Do you want the value returned from lowest to be printed out to the console? If so, try the print/println commands.

    System.out.println("this prints out some text");
    double number = 3;
    System.out.println("The number is: " + number);

Similar Threads

  1. Loop to note position of lowest number
    By fortune2k in forum Loops & Control Statements
    Replies: 3
    Last Post: November 23rd, 2010, 10:05 AM
  2. Replies: 1
    Last Post: October 16th, 2010, 03:32 PM
  3. Need this to end when a negative number is entered
    By ponyexpress in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 28th, 2010, 09:02 AM
  4. Finding the highest number in an array?
    By halfwaygone in forum Algorithms & Recursion
    Replies: 1
    Last Post: April 17th, 2010, 03:56 PM
  5. Replies: 1
    Last Post: March 22nd, 2010, 04:34 PM