我一直不能运行, 我不懂应该怎样改, 我很苦恼啊
只一直弹出
Exception in thread "main" java.lang.NullPointerException
at Line.<init>(Te​​stLine.java:29)
at TestLine.main(TestLine.java:230)
谁可以帮帮忙, 麻烦各位了.../**
* @(#)Test.java
*
*
* @author
* @version 1.00 2011/3/30
*/class Line {
        protected String[] str,str2;
        private String name;
        private Station[] stops;
        private int[] distance;
        private double passengerFarePerKm,cargoFarePerKm;
        private int crossBorderSurcharge,reservationSurcharge;    public Line(String lineName,String stations,String fares) {
            name = lineName;
            str = fares.split(":");
            passengerFarePerKm = Double.parseDouble(str[0]);
            cargoFarePerKm = Double.parseDouble(str[1]);
            crossBorderSurcharge = Integer.parseInt(str[2]);
            reservationSurcharge = Integer.parseInt(str[3]);
            str = stations.split(" ");
            stops = new Station[str.length];
            for(int i=0; i<str.length;i++){
             str2 = str[i].split(":");
             stops[i] = new Station(str2[0],str2[1]);
             distance[i] = Integer.parseInt(str2[2]);
            }
    }
    public String getName(){
            return name;
    }    public Station[] getStops(){
            return stops;
    }    public double getPassengerFarePerKm(){
            return passengerFarePerKm;
    }    public double getCargoFarePerKm(){
            return cargoFarePerKm;
    }    public int getCrossBorderSurcharge(){
            return crossBorderSurcharge;
    }    public int getReservationSurcharge(){
            return reservationSurcharge;
    }    public String toString(){
            String output = "";
            for (int i=0;i<stops.length;i++){
                    output += stops[i].getName() + stops[i].getCountry() + "(" + distance[i] + ")";
            }
            output += "\n\nFares Summary:\nPassenger Per KM: EUR" + passengerFarePerKm + "\nCargo Per KG Per KM: EUR" + cargoFarePerKm + "\nSurcharge: Cross Border: EUR" + crossBorderSurcharge + "\nSurcharge: Seat Reservation: EUR" + reservationSurcharge + "\n\n";
            return output;
    }   public int calculateDistance(Station start,Station end){
           int dis = 0;
    /*        for(int i = 0; i< stops.length;i++){
                    if(start == stops[i]){dis = distance[i];
                    }
            }
            for(int i = 0; i< stops.length;i++){
                    if(start == stops[i]){dis -= distance[i];
                    }
            }*/
          return Math.abs(dis);
   }}class Station {        private String name,country;    public Station(String name,String country) {
            this.name = name;
            this.country = country;
    }    public String getName(){
            return name;
    }    public String getCountry(){
            return country;
    }    public String toString(){
            return name + "," + country;
    }}/*
abstract class Train {        private String code,startTime;
        private Line line;
        private Station start,end;    public Train(String code,String startTime,Line line,Station start,Station end) {
            this.code = code;
            this.startTime = startTime;
    }    public String getCode(){
            return code;
    }    public String getStartTime(){
            return startTime;
    }    public Line getLine(){
            return line;
    }    public Station getStart(){
            return start;
    }    public Station getEnd(){
            return end;
    }    public Station[] getIntermediateStops(){
            return
    }    public int getCrossBorderCount(Station from,Station to){    }    public abstract double calculateDistanceFare(Station from,Station to);    public boolean isValidRoute(Station from,Station to){
            return
    }    public double calculateFare(Station from,Station to,Station quantity){
            //Total Fare = Distance Fare * quantity + Cross Border Surcharge
    }    public abstract String toString();}class CargoTrain extends Train{        private int cargoCapacity;    public CargoTrain(String code,String startTime,Line line,Station start,Station end,int cargoCapacity) {
            super(code,startTime,line,start,end);
            this.cargoCapacity = cargoCapacity;
    }    public double calculateDistanceFare(Station from,Station to){
            //distance fare = unit fare (fare per 1KG per 1KM) * distance of the journey.
            return * 0.01;
    }    public int getCargoCapacity(){
            return cargoCapacity;
    }    public String toString(){
            return
    }}class PassengerTrain extends Train{        private int passengerCapacity;    public PassengerTrain(String code,String startTime,Line line,Station start,Station end,int passengerCapacity) {
            super(code,startTime,line,start,end);
            this.passengerCapacity = passengerCapacity;
    }    public double calculateDistanceFare(Station from,Station to){
            //distance fare = unit fare (fare per passenger per 1KM) * distance of the journey.
            return * 0.06;
    }    public int getPassengerCapacity(){
            return passengerCapacity;
    }    public String toString(){
            return
    }}class ExpressPassengerTrain extends PassengerTrain{    public ExpressPassengerTrain(String code,String startTime,Line line,Station start,Station end,int passengerCapacity) {
            super(code,startTime,line,start,end,passengerCapacity);
    }    public double calculateDistanceFare(Station from,Station to){
            //total fare = Normal Passenger Train Fare + Reservation Surcharge
            return super.calculateDistanceFare(from,to) + 10;
    }    public String toString(){
            return "Seat Reservation Req’d";
    }}*/public class TestLine {        public static void main(String[] args) {
                //Line information
                Line line = new Line("Paris-Zurich-Munich", "Paris:France:0 Lyon:France:450 Geneve:Switzerland:600 Zurich:Switzerland:870 St.Gallen:Switzerland:950 Memmingen:Germany:1070 Munich:Germany:1180", "0.06:0.01:30:10");                System.out.println(line);                Station stations[] = line.getStops();                System.out.println(stations[0]);
                System.out.println(stations[1]);
                System.out.println("...");
                System.out.println(stations[stations.length-2]);
                System.out.println(stations[stations.length-1]);                System.out.println("Distance from " + stations[1] + " to " + stations[3] + " is " + line.calculateDistance(stations[1], stations[3]));
                System.out.println("Distance from " + stations[3] + " to " + stations[1] + " is " + line.calculateDistance(stations[3], stations[1]));
        }
}