Java类中的静态变量无法解析或不是字段

时间:2014-12-02 15:37:01

标签: java eclipse

package project.groupsoftware.com;

public class TrackBuilder {


    public TrackBuilder(String name) {
         m_track = new Track(name);
    }

    public static void addInitialTile(float length, int m_pointX, int m_pointY, double m_direction) {
        InitialTile tile = new InitialTile(length, m_pointX, m_pointY, m_direction);
        m_track.getTrackList().add(tile);

    }

    public void printTrackName() {
        System.out.println("The name of Track"+ m_track.getTrackName());
    }
    public static void addStraightTile(double length, Track track) {
        StraightTile tile = new StraightTile(length);
        m_track.getTrackList().add(tile);
    }

    public static void addCurvedTile(double angle, double radius, Track track) {
        CurvedTile tile = new CurvedTile(angle, radius);
        m_track.getTrackList().add(tile);
    }

    public static void removeLastTile() {
        m_track.getTrackList().remove(m_track.getTrackList().size()-1);
    }

    public void loadTrack() {
        // TODO implement here
    }

    public void saveTrack() {
        // TODO implement here
    }

    public void updateDisplay() {
        // TODO implement here
    }

    private static Track m_track;

}

我得到的错误是

  

类型m_track无法解析或不是字段TrackBuilder.java / group-software-project / src / project / groupsoftware / com li 25 25 Java问题

我在Eclipse LUNA中得到这个

1 个答案:

答案 0 :(得分:2)

它应该编译没有错误,请尝试清理您的项目。转到Project - > Eclipse中的Clean并重试。