que is from : http://www.4tests.com/exams/questions.asp 6) Which of the following are acceptable? [check bixes are there - RK] Object o = new Button("A"); Frame f = new Panel(); Boolean flag = true; // 3 Boolean flag = true; // 4 Panel p = new Applet();
==== My prob is that ... I can not distinguish the diffrence betn 3 & 4 ... is it same with every one ... is it errata TIA
"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
Valentin Crettaz
Gold Digger
Sheriff
Joined: Aug 26, 2001
Posts: 7610
posted
0
yeah I think it is an errata... Typical cut-paste problem... I'm moving this to Mock Exam Errata
I met the same question in John Hunt Mock exam. Could anyone explain to me why --------------------------- Boolean flag = true; // 3 --------------------------- is not acceptable? Thanks a lot!
Valentin Crettaz
Gold Digger
Sheriff
Joined: Aug 26, 2001
Posts: 7610
posted
0
because: Boolean flag = true tries to assign the boolean literal true to a reference variable of type Boolean (which is a class)... boolean flag = true and Boolean flag = new Boolean("true") Boolean flag = new Boolean(true) are valid statements.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.