Hi:
Just on the question below. Why is line 5 not compiling. It must be something very simple I am missing here...any help would be appreciated
1. class ArrayTest {
2.
3. static int [ ] intArray = new int [5] ;
4. static int [ ] intArray1 = new int [1] ;
5. intArray1 [0] = 5 ;
6. static char [ ] charArray = new char [5] ;
7.
8. public static void main (String [ ] args) {
9.System.out.println (charArray [1] ) ;
10.intArray1 = intArray ;
11.intArray = charArray ;
12. }
13. }
a. The compiler objects to line 5.
b. The compiler objects to line 10.
c. The compiler objects to line 11.
d. Omitting lines 5,10 and 11 would make the program print 0.
e. There is nothing wrong with the code and the program prints 0
Just on the question below. Why is line 5 not compiling. It must be something very simple I am missing here...any help would be appreciated
1. class ArrayTest {
2.
3. static int [ ] intArray = new int [5] ;
4. static int [ ] intArray1 = new int [1] ;
5. intArray1 [0] = 5 ;
6. static char [ ] charArray = new char [5] ;
7.
8. public static void main (String [ ] args) {
9.System.out.println (charArray [1] ) ;
10.intArray1 = intArray ;
11.intArray = charArray ;
12. }
13. }
a. The compiler objects to line 5.
b. The compiler objects to line 10.
c. The compiler objects to line 11.
d. Omitting lines 5,10 and 11 would make the program print 0.
e. There is nothing wrong with the code and the program prints 0