mIsCheater


#1

I am a little confused about the code on page 108. If I implement private boolean mIsCheater; like that, I get crash if I try to cheat at the first question. Of course, as mIsCheater hat no value after the app starts. Pushing the NextButton sets it to “false” (page 109).

Is this a typo, or did I do something wrong? I changed the declaration to private boolean mIsCheater = false; This works fine.


#2

It sounds like you may have typed capital B “Boolean” rather than lowercase B “boolean” for the type of mIsCheater. Capital B is an object, not an atomic datatype, which means that it can have a null value. Lowercase B is an atomic datatype, so it can only be true or false.


#3

Exactly, you’re right. Sorry for my confusion.
As I am already working on challange 3, mIsCheater has become needless in the meantime.

Nevertheless thanks for your reply.