You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement the multiple array type that allow to overcome the differences between Java and JavaScript.
Expected Behavior
Declaring a Variable to refer to a Multiple Array
Creating, Initializing, and Accessing a Multiple Array
shortcut syntax
Exceptions
array index out of bound exception
Acceptance test
Declaring a Variable to refer to a Multiple Array
letaMultipleArray: Jarray<Jdouble>;
Creating, Initializing, and Accessing a Multiple Array
constaMultipleArray=newJarray<Jdouble>(jint('3'),jint('2'));aMultipleArray.set(jint('0'),jint('0'),jdouble('1.1'));aMultipleArray.set(jint('0'),jint('1'),jdouble('1.2'));aMultipleArray.set(jint('1'),jint('0'),jdouble('2.1'));aMultipleArray.set(jint('1'),jint('1'),jdouble('2.2'));aMultipleArray.set(jint('2'),jint('0'),jdouble('3.1'));aMultipleArray.set(jint('2'),jint('1'),jdouble('3.2'));console.log("Element at index 0,0: "+aMultipleArray.get(jint('0'),jint('0')));console.log("Element at index 0,1: "+aMultipleArray.get(jint('0'),jint('1')));console.log("Element at index 1,0: "+aMultipleArray.get(jint('1'),jint('0')));console.log("Element at index 1,1: "+aMultipleArray.get(jint('1'),jint('1')));console.log("Element at index 2,0: "+aMultipleArray.get(jint('2'),jint('0')));console.log("Element at index 2,1: "+aMultipleArray.get(jint('2'),jint('1')));// shortcut syntaxconstanotherMultipleArray=newJarray<Jdouble>([jdouble('1.1'),jdouble('2.1'),jdouble('3.1')],[jdouble('1.2'),jdouble('2.2'),jdouble('3.2')]);console.log("Element at index 0,0: "+anotherMultipleArray.get(jint('0'),jint('0')));console.log("Element at index 0,1: "+anotherMultipleArray.get(jint('0'),jint('1')));console.log("Element at index 1,0: "+anotherMultipleArray.get(jint('1'),jint('0')));console.log("Element at index 1,1: "+anotherMultipleArray.get(jint('1'),jint('1')));console.log("Element at index 2,0: "+anotherMultipleArray.get(jint('2'),jint('0')));console.log("Element at index 2,1: "+anotherMultipleArray.get(jint('2'),jint('1')));
Output:
Element at index 0,0: 1.1
Element at index 0,1: 1.2
Element at index 1,0: 2.1
Element at index 1,1: 2.2
Element at index 2,0: 3.1
Element at index 2,1: 3.2
Element at index 0,0: 1.1
Element at index 0,1: 1.2
Element at index 1,0: 2.1
Element at index 1,1: 2.2
Element at index 2,0: 3.1
Element at index 2,1: 3.2
Exceptions
constaMultipleArray=newJarray<Jdouble>(jint('3'),jint('2'));console.log("Element at index 3,0: "+anArray.get(jint('3'),jint('0')));console.log("Element at index 0,2: "+anArray.get(jint('0'),jint('2')));console.log("Element at index 3,2: "+anArray.get(jint('3'),jint('2')));
Implement the multiple array type that allow to overcome the differences between Java and JavaScript.
Expected Behavior
Acceptance test
Declaring a Variable to refer to a Multiple Array
Creating, Initializing, and Accessing a Multiple Array
Output:
Exceptions
Output:
The text was updated successfully, but these errors were encountered: