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".
enthuware.ocpjp.v11.2.3061
Moderator: admin
-
- Posts: 12
- Joined: Wed Feb 17, 2021 6:55 am
- Contact:
enthuware.ocpjp.v11.2.3061
- Attachments
-
- enthuware.ocpjp.v11.2.3061.PNG (8.77 KiB) Viewed 4923 times
Last edited by Seán Kennedy on Sat Mar 27, 2021 7:51 am, edited 1 time in total.
Online
-
- Site Admin
- Posts: 10152
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: enthuware.ocpjp.v11.2.3061
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[].
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[].
If you like our products and services, please help us by posting your review here.
-
- Posts: 12
- Joined: Wed Feb 17, 2021 6:55 am
- Contact:
Re: enthuware.ocpjp.v11.2.3061
Sorry, I must be missing something. The screenshot is from Netbeans and I got no compiler errors?
Online
Btw, you are breaking the first (or second or third
) rule of certification preparation - don't use IDE. Use command line.
-
- Site Admin
- Posts: 10152
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: enthuware.ocpjp.v11.2.3061
Not sure why your NetBeans is not showing the error. Mine is. See attached.Seán Kennedy wrote: ↑Sat Mar 27, 2021 7:57 amSorry, I must be missing something. The screenshot is from Netbeans and I got no compiler errors?
Btw, you are breaking the first (or second or third
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
If you like our products and services, please help us by posting your review here.
-
- Posts: 12
- Joined: Wed Feb 17, 2021 6:55 am
- Contact:
Re: enthuware.ocpjp.v11.2.3061
Thanks very much. I am getting those errors in javac. My own personal first rule for certification preparation is Enthuware!
Thanks again,
Seán.
![Smile :)](./images/smilies/icon_e_smile.gif)
Thanks again,
Seán.
Who is online
Users browsing this forum: Bing [Bot] and 25 guests