DP
2013-03-27 05:41:53 UTC
========================================
public class FlightBooking {
public String destination, time;
public Flight[] flightNum;
public FlightBookingSystem(int i) {
Flight[] flightNum=new Flight[i];
}
public static void main(String[] args) {
FlightBooking fb = new FlightBooking(3);
fb.example();
}
public void example(){
int count=0;
flightNum[count]= new Flight("america", "5pm");
System.out.println("time: "+ flightNum[count].getTime()+"destination: "+flightNum[count].getDestination());
}
}
==================================================
2nd class:
====================================================
public class Flight {
private String destination, time;
public Flight(String destination, String time){
this.destination=destination;
this.time=time;
}
public String getDestination() {
return destination;
}
public String getTime() {
return time;
}
}
==============================================
i keep getting an error