Results 1 to 4 of 4
  1. #1
    emtu is offline Member
    Join Date
    Dec 2010
    Posts
    9
    Rep Power
    0

    Default How to use array (double) and to terminate?

    Hi,

    I need some help.

    In my program, i need to input values from users, and to terminate program (example number -99 to terminate).

    Java Code:
    double numb [] = new double[16];
    
    for(int i = 0; i<numb.length;i++){
       System.out.print("Enter values (-99 = exit): ");
       numb[i] = scan.next();
    }
    Okej, this is correct!

    Java Code:
    while(numb != -99){
    do something.
    }
    And same for String [] array?

    How can i do that?

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,407
    Rep Power
    20

    Default Re: How to use array (double) and to terminate?

    Pretty much the same, except that you don't use == to compare Strings (or any Objects) for equality. You use the .equals(...) method instead.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    emtu is offline Member
    Join Date
    Dec 2010
    Posts
    9
    Rep Power
    0

    Default Re: How to use array (double) and to terminate?

    this is not helpfull !

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,407
    Rep Power
    20

    Default Re: How to use array (double) and to terminate?

    Quote Originally Posted by emtu View Post
    this is not helpfull !
    Why, were you expecting your homework on a platter?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Double constructors, with and without array
    By Juukamen in forum New To Java
    Replies: 5
    Last Post: 11-01-2011, 11:08 PM
  2. array multiplication with single double
    By Tien in forum New To Java
    Replies: 1
    Last Post: 10-25-2011, 12:21 PM
  3. Double Array problem
    By AlinkaTroll in forum New To Java
    Replies: 6
    Last Post: 05-03-2011, 01:58 AM
  4. returning double array
    By Billaguana in forum New To Java
    Replies: 2
    Last Post: 01-16-2011, 03:59 AM
  5. Array of 4 bytes to double.
    By blind melon in forum Advanced Java
    Replies: 4
    Last Post: 12-08-2010, 11:19 AM

Posting Permissions

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