Код: Выделить всё
public class ClassToRunProgram {
public void main(String[] args){
Class1 a = new Class1(0, "class1"); //I've created 1 main class (Class5) that
Class2 b = new Class2(1, "class2"); //these 4 classes extend.
Class3 c = new Class3(2, "class3");
Class4 d = new Class4(3, "class4");
int randomNum = (int) (Math.random() *3);
Class5[] arrayForClasses = new Class5[]{a, b, c, d}; //since they're extending this
//class I want to make them into
//a single Array?
String numberQuestion = JOptionPane.showInputDialog(null,
"What question do you want to ask? \n
Enter a number: \n
1. First Question? \n
2. Second Question? \n
3. Third Question?");
int question = Integer.parseInt(numberQuestion); //not sure if this part is
//actually relevant at all??
//Think it might be since I want to
//use integers in my if statement below
if(question == 1){
JOptionPane.showMessageDialog(null, "Blah blah"+arrayForClasses.getReturnValue()+" blah");
}
Любая помощь очень ценится.
Спасибо!
Подробнее здесь: https://stackoverflow.com/questions/103 ... for-method