Page 1 of 1

About Question enthuware.ocpjp.i.v11.2.3241 :

Posted: Mon Jan 13, 2020 9:36 am
by evgeniyN
I cant understand, why bool b = null; is not valid?

Code: Select all

class bool {}

...
bool b = null;

Re: About Question enthuware.ocpjp.i.v11.2.3241 :

Posted: Mon Jan 13, 2020 9:50 am
by admin
Did you try compiling it? What error message did you see?

Re: About Question enthuware.ocpjp.i.v11.2.3241 :

Posted: Mon Jan 13, 2020 9:53 am
by admin
BTW, the explanation explains why it is not a correct option:
bool is an invalid keyword. Therefore, 1 and 4 can't be right. (Although 1 could be right if bool were a user defined class but as per Java coding conventions, a class name should start with a capital letter.)