Page 1 of 1
enthuware.ocpjp.v11.2.3061
Posted: Sat Mar 27, 2021 6:52 am
by Seán Kennedy
Hi,
Just wondering about the second parts of the answers to options b and e. It seems to imply that "var i = " is required to get the code to compile and that "var i[] = " will be an issue (especially option e which says instead of). See attached file.
Kind regards,
Seán.
PS. When I click Discuss on this question I am being brought to "v6.2.736".
Re: enthuware.ocpjp.v11.2.3061
Posted: Sat Mar 27, 2021 7:35 am
by admin
Right, neither of the following will compile.
var i[] = new int[] {1, 2} ;
var[] i = new int[] {1, 2} ;
Because 'var' is not allowed as an element type of an array
var i = new int[] {1, 2} ; otoh, is ok and declares i to be of type int[].
Re: enthuware.ocpjp.v11.2.3061
Posted: Sat Mar 27, 2021 7:57 am
by Seán Kennedy
Sorry, I must be missing something. The screenshot is from Netbeans and I got no compiler errors?
Re: enthuware.ocpjp.v11.2.3061
Posted: Sat Mar 27, 2021 8:05 am
by admin
Seán Kennedy wrote: ↑Sat Mar 27, 2021 7:57 am
Sorry, I must be missing something. The screenshot is from Netbeans and I got no compiler errors?
Not sure why your NetBeans is not showing the error. Mine is. See attached.
Btw, you are breaking the first (or second or third
) rule of certification preparation - don't use IDE. Use command line.
- test.png (6.01 KiB) Viewed 4152 times
Re: enthuware.ocpjp.v11.2.3061
Posted: Sat Mar 27, 2021 8:46 am
by Seán Kennedy
Thanks very much. I am getting those errors in javac. My own personal first rule for certification preparation is Enthuware!
Thanks again,
Seán.