Q.– Which two array initialization statements are valid?
A) int array[ ] = new int [ 3 ];
array[0]= 1;
array[1]= 2;
array[2]= 3;
B) int array[ ] = new int [ ] {1,2,3};
C) int array[ ] = new int [3] {1, 2, 3};
D) int array[ ] = new int [3];
array = {1, 2, 3};
E) int array[3] = new int [ ] {1, 2, 3};
⧪ please give your answer in a comment section.
A) int array[ ] = new int [ 3 ];
array[0]= 1;
array[1]= 2;
array[2]= 3;
B) int array[ ] = new int [ ] {1,2,3};
C) int array[ ] = new int [3] {1, 2, 3};
D) int array[ ] = new int [3];
array = {1, 2, 3};
E) int array[3] = new int [ ] {1, 2, 3};
⧪ please give your answer in a comment section.
9 Comments
A D
ReplyDeleteA d
ReplyDeleteAd
ReplyDeleteAD
ReplyDeleteAD
ReplyDeleteA D
ReplyDeleteA D
ReplyDeleteA B
ReplyDeleteThis comment has been removed by the author.
Delete