私はJavaにかなり慣れていないので、このコードがコンパイルされない理由がわかりません。また、結果が返されないこともあります。助言がありますか?
public static char isPrime(int x)
{
for(int y=2;y<x;y++)
char result = 'r';
if(x%y==0)
result = 't';
else
result = 'f';
return result;
}
また
public static char isPrime(int x)
{
char result = 'r';
for(int y=2;y<x;y++)
if(x%y==0)
result = 't';
else
result = 'f';
return result;
}