給定兩個數字,返回true,如果其中任何一個劃分等,否則返回false給定兩個數字,返回true,如果其中任何一個劃分等,否則返回false
public class DividesAB {
static int testcase11 = 208;
static int testcase12 = 7;
boolean aDivisblebyb, bDivisblebya, answer;
public static void main(String args[]){
DividesAB testInstance = new DividesAB();
boolean result = testInstance.divides(testcase11,testcase12);
System.out.println(result);
}
//write your code here
public boolean divides(int a, int b){
boolean aDivisiblebyb = a%b == 0;
boolean bdivisiblebya = b%a == 0;
boolean answer = aDivisiblebyb||bDivisiblebya;
return answer;
}
}
我已經越來越錯誤如cannot find symbol
如果你需要幫助,你應該更好地解釋你的問題。最好解釋你的邏輯和你所嘗試過的。 – dc5553
...或者只是學習如何閱讀和理解編譯器錯誤(告訴你包含錯誤的確切行號)。 – jahroy