Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By doWhile

Thread: Sort an array in a different class

  1. #1
    axelrose is offline Member
    Join Date
    Jul 2012
    Posts
    1
    Rep Power
    0

    Default Sort an array in a different class

    I have to enter integers in a Java class with a GUI and then sort the integers in a different class in the same package. So far I have been able to sort it in the same class but need to only sort it in a different class.
    Please help
    This is my working code so far:

    int k;

    int array1[]=new int[3];
    array1[0] = Integer.parseInt(jTextField1.getText());
    array1[1] = Integer.parseInt(jTextField2.getText());
    array1[2] = Integer.parseInt(jTextField3.getText());

    Arrays.sort(array1);


    for (k=0;k<4;k++)
    {
    jTextArea1.append(Integer.toString(array1[k]));
    jTextArea1.append(" \n");
    }

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default Re: Sort an array in a different class

    DarrylBurke likes this.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: Sort an array in a different class

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

Similar Threads

  1. Need help with Array.sort()
    By Kinney.j in forum New To Java
    Replies: 1
    Last Post: 10-16-2011, 06:51 AM
  2. sort array >> need help
    By hongi in forum New To Java
    Replies: 4
    Last Post: 04-25-2010, 09:37 PM
  3. Need help. Array sort
    By buzz1500 in forum New To Java
    Replies: 3
    Last Post: 11-07-2008, 04:24 AM
  4. Array sort
    By Jeremy720 in forum New To Java
    Replies: 2
    Last Post: 10-07-2008, 11:41 PM
  5. How to sort an array
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-14-2008, 08:48 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
  •