Object[] Flights = new Object[10];
This is an Object array, now what i want is to add 4 attributes to each object which includes String and integer?
How can I do this ?
I believe you can't do this in Java, you absolutely need to create a class.
public class Myclass {
public String myString;
public int myInteger;
}
and create an instance of that class :
public mainClass {
public void main(String args[]){
MyClass myInstance = new MyClass();
myInstance.myString = "the value you want";
myInstance.myInteger = 1;
}
}
Object.