1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Rep Power

    Please help with passing to a new class

    I have no knowledge of passing to and from a class to another class so if anyone can please help me.

    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 and then pass the sorted array back to be displayed in the main 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());


    for (k=0;k<4;k++)
    jTextArea1.append(" \n");
  2. #2
  3. /*
    Devshed Novice (500 - 999 posts)

    Join Date
    Mar 2007
    Sydney, Australia
    Rep Power
    You will need to understand how to create classes, methods (with return values), how to work with instances of a class or how to create static classes. Perhaps this tutorial will help.

IMN logo majestic logo threadwatch logo seochat tools logo