为什么Eclipse Editor中的更改不会影响我的代码?

时间:2015-06-27 16:40:35

标签: java eclipse

我试图在其他设备上更改我的代码并将Dropbox上的代码从一个设备上移到另一个设备上,但是当我在代码中进行更改时,程序的行为方式与之前相同。我不知道为什么?!

//when collecting an Powerup-Item start a random Powerup
public static void pupHit() {

    ItemCreator.powerUp.setLocation(new Point(-50, -50));
    //usually I would generate a random number between 1 and 6 
    //with the commented 2 lines below and save it in the variable pup
    //Random rand = new Random();
    int pup = 6; //rand.nextInt(6) + 1;
    //even if I give pup a static value of 6, pup differs between 1 and 5/6
    switch(pup){
        case 1: ItemPowerups.speed(); Stats.points += 10; break;
        case 2: ItemPowerups.slow(); Stats.points += 5; break;
        case 3: ItemPowerups.lsd(); Stats.points += 15; break;
        case 4: ItemPowerups.invert(); Stats.points += 25; break;
        case 5: ItemPowerups.obstacle(); Stats.points += 10; break;
        case 6: ItemPowerups.steelJawbone(); Stats.points += 10; break;
    }   
}

我在宣布并初始化System.out.printl(pup);后尝试添加pup。这也不会影响我的代码。

1 个答案:

答案 0 :(得分:1)

尝试再次构建它:D。 (我知道最后一个人解决了它,但我们需要问题才能得到答案)。