Question: undefined 3- Declaring, instantiating, and using arrays In java, indicating the size of the array during the declaration is a syntax error (what is a

undefined 3- Declaring, instantiating, and using arrays In java, indicating the sizeundefined

3- Declaring, instantiating, and using arrays In java, indicating the size of the array during the declaration is a syntax error (what is a syntax error?). So to declare an array in java you will only need a name and a type for your array, example: int[] foo; To actually create the array you will write the following: int[] foo=new int[5]; (you can replace int with the data type needed) To create and instantiate your array in one step, do the following: int[] foo={1,2,3,4,5); //this is an array named foo of type int and has value 1 in index 0, value 2 in index 1, etc. Create a string array of size 2 and name it "myName" and in index 0 write your name and index 1 write your family name, and then print on the screen: My name is [index zero of the array] [index one of the array]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!