Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started