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



我试图在另一台设备上更改代码,并通过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;
    }   
}

在声明和初始化pup之后,我尝试添加System.out.printl(pup);。这不会影响我的代码。

尝试重新构建它:D。(我知道最后一个人解决了这个问题,但我们需要这个问题的答案)。

最新更新