Page 1 of 1
[HD Pg 95, Sec. 4.1.2 - creating-and-initializing-array-objects]
Posted: Tue Jan 22, 2019 2:31 pm
by OCAJO1
Just curious,
Is there any advantage(s) in initializing using
int[] ia = new int[]{ 1, 2, 3, 4, 5 };
over
int[] ia = {1, 2, 3, 4, 5 };
Thanks
Re: [HD Pg 95, Sec. 4.1.2 - creating-and-initializing-array-objects]
Posted: Tue Jan 22, 2019 10:04 pm
by admin
Some may find the former more clear while others may find the later less tedious. But no other adv/disadv.
Re: [HD Pg 95, Sec. 4.1.2 - creating-and-initializing-array-objects]
Posted: Wed Jan 23, 2019 12:33 pm
by OCAJO1
One of the things that I've noticed about Java. It gives the exam producers lots of options to play with:)
Re: [HD Pg 95, Sec. 4.1.2 - creating-and-initializing-array-objects]
Posted: Tue Jun 18, 2019 5:48 pm
by Username987654
boolean[] ba = new boolean[3]; //an array of booleans of size 2
should be
boolean[] ba = new boolean[3]; //an array of booleans of size 3
?
Re: [HD Pg 95, Sec. 4.1.2 - creating-and-initializing-array-objects]
Posted: Wed Jun 19, 2019 5:12 am
by admin
Correct. Added to errata.
thank you for your feedback!