MAK:
私は、このコーディングものにかなり新しいだと私たちはRPGゲームをコーディングする必要が原因まもなく割り当てを、持っています。私はキラがステートメント場合は使用して殺すためにどのような方法選んでいる私の死、ノートベースのゲームのチャンクに取り組んでいます。何らかの理由で、「互換性のない型を:チャーはブールに変換することができません」と言うと、私はなぜ見当もつかない。
public class test
{
public static void main (String args[])
{
new test();
}
public test ()
{
System.out.println ("You take the notebook with you and walk to the nearest");
System.out.print (" comic book store where you see a young girl being robbed by a");
System.out.print (" group of men. The man who appears to be the leader of the gang speaks.");
System.out.print (" \"My name is Takuo, Shibui-Maru, that’s Shibutaku for short. Heh heh.\"");
System.out.print ("You decide to write his name and see what happens.");
System.out.print ("Do you choose to kill him by:");
int points = 50;
System.out.println (" ");
char kill = IBIO.inputChar ("a)heart attack or b)fire: ");
if (kill = 'a') //heres the error
{
points = +10;
System.out.println (" Within minutes, the man falls to the ground and the girl runs away. The death note works! +points+ ");
}
else
{
points = -20;
System.out.println (" All of a sudden, flames engulf the comic book store.");
System.out.println (" You attempt to leave the store as quickly as possible but have trouble seeing.");
System.out.println (" You return safely with the notebook in your hands, but an innocent old man fails to come outside in time. +points");
}
System.out.println ("So it wasen't a myth!");
}
}
YanickBélanger:
あなたは、単一の等号を使用しているためですif
。これは、割り当てのために使用されている、あなたは二重の等しい演算子(探している==
2つの値を比較します)。
コンパイラはことを言っているif
期待しているboolean
(またはそれにどの解決される式boolean
)が、あなたの代わりに、比較の割り当てを渡しています。
代わりにこれを試してみてください。
if (kill == 'a') {
// ...
}