2016-07-17 7 views
-2

このメソッドは親クラスにあり、 "getEasterAttack"という名前です。 "Method Call Expected"エラーがどのように発生したかをninjaGetDamageRecievedという別のクラスで呼び出しようとしています。それは私のメソッドシグネチャの受信がintを要求していないためですか?または私のアクセス修飾子のためですか?ヘルプIntelliJの究極の "メソッド呼び出しが必要"を使用しているエラー

public int getEasterAttack() { 
    int shark = 100; 
    int randnum = RandInt.randomInt(0, 125); 

    if (randnum == getHealth()) { 

    } 
    return shark; 
public int ninjaDamageReceivedCalculator(int rawDamageDealt) { 
    int damage = 0; 
    int protection = 0; 
    if (getPlayerWeapon().equalsIgnoreCase("blade")) { 
     damage = rawDamageDealt - (getRandomBladeRangeProtection() * getRandomAccuracyDamage()); 
    } else { 
     damage = rawDamageDealt - (getRandomStarRangeProtection() * getRandomAccuracyDamage()); 
    } 
    if (rawDamageDealt > protection + getForestProtection()) { 
     damage = rawDamageDealt - (protection + getForestProtection()); 
    } 
    this.removeHealth(damage); 
    return damage(getEasterAttack()); 
} 
+0

*クラス*の名前は* getEasterAttack *ですか?そして、別のクラスは* ninjaDamangeReceivedCalculate *と呼ばれますか?あなたのユースケースでは無効です – Li357

+0

'' damage(getEasterAttack()) 'は何をすると思いますか? – azurefrog

+0

'getEasterAttack'ファンクションの括弧を閉じることから始めることができます – smac89

答えて

2

damageのおかげでは、方法が、int値ではありません。したがって、方法として使用すると機能しないことがIntellijから警告されています。

damage(getEasterAttack())intではできません。

関連する問題