[CODE=Java]package bankobject;
import java.io.*;
import javax.swing.JOp tionPane;
class Number {
String studentName;
String teacherName;
int[] Number;
public Number () {
studentName = JOptionPane.sho wInputDialog("P lease Enter student name");
teacherName = JOptionPane.sho wInputDialog("P lease Enter the teacher name ");
int numNumber = Integer.parseIn t(JOptionPane.s howInputDialog( "Please enter the number of numbers"));
Number[] obj = new Number [numNumber];
for (i = 0; i < numNumber.lengt h; i++)
obj [i] = new Number ();
}
[/CODE]
I want the array to take as many numbers object, by using a for loop and instantiate each number object by calling the Number constructor.
import java.io.*;
import javax.swing.JOp tionPane;
class Number {
String studentName;
String teacherName;
int[] Number;
public Number () {
studentName = JOptionPane.sho wInputDialog("P lease Enter student name");
teacherName = JOptionPane.sho wInputDialog("P lease Enter the teacher name ");
int numNumber = Integer.parseIn t(JOptionPane.s howInputDialog( "Please enter the number of numbers"));
Number[] obj = new Number [numNumber];
for (i = 0; i < numNumber.lengt h; i++)
obj [i] = new Number ();
}
[/CODE]
I want the array to take as many numbers object, by using a for loop and instantiate each number object by calling the Number constructor.
Comment