About Question enthuware.ocajp.i.v8.-2-.2015 :
Moderator: admin
-
- Posts: 5
- Joined: Tue Apr 20, 2021 3:30 am
- Contact:
About Question enthuware.ocajp.i.v8.-2-.2015 :
The answer would give an java.lang.ArrayIndexOutOfBoundsException: 5
-
- Posts: 5
- Joined: Tue Apr 20, 2021 3:30 am
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.2015 :
I believe the answer should be:
int[][] matrix = new int[5][4];
for(int i=0;i<5; i++) matrix[1] = 1;
int[][] matrix = new int[5][4];
for(int i=0;i<5; i++) matrix[1] = 1;
-
- Site Admin
- Posts: 10061
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.2015 :
Why do you believe so? Specifically, what makes you think that matrix[1] = 1; is valid?
Try compiling and running the code exactly as given in the question/option.
Try compiling and running the code exactly as given in the question/option.
If you like our products and services, please help us by posting your review here.
-
- Posts: 5
- Joined: Tue Apr 20, 2021 3:30 am
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.2015 :
Apologies, there should be before [1]
-
- Posts: 5
- Joined: Tue Apr 20, 2021 3:30 am
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.2015 :
When posting a square bracket with letter i inside,it is removed as soon as i submit the post.
-
- Posts: 5
- Joined: Tue Apr 20, 2021 3:30 am
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.2015 :
Apologies, I made a mistake the answer to the question is correct in your material. DUH moment for me.
Who is online
Users browsing this forum: gadsgadsx and 90 guests