Question: I need the code in Java. please answer all parts and questions. Thanks in advance! PART 1 Type the answers of following questions in a
I need the code in Java. please answer all parts and questions. Thanks in advance!



![definition int [ ] values 2, 5, 6, 4, 71; 1. What](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f97047a9c23_23866f97046daaec.jpg)
PART 1 Type the answers of following questions in a word document named SP2018LAB7 PART1 vourLastName.docx Look at the following array definition int [ ] values 2, 5, 6, 4, 71; 1. What is the output of the following lines? System.out.println(values[2]); x values1] 2 values[4]; System.out.println(x); x-++values[3]; System.out.println(x); 2. setDescription(String str) and setUnit(int num) are the mutor methods of class Inventoryltem void setDescription (String str) void setDescription (String str) str Description = str; The following statement creates an Inventoryltem array: Inventoryltem[ ] items new Inventoryltem[5]; Is it correct or not to execute the following statements? If it is not correct, write the correct one a. items[0]. setDescription("Hammer" b. items.setUnit(10); 3. Use the following int array int [] numbers 78, 29, 12, 56, 98, 44, 75, 99, 17, 25 Write the code to store these values of intArray to a file name numbers.txt with the following format. Numbers 0 78 Numbers 1 29 Numbers 2 12 Numbers 3 56 Numbers 4 98 Numbers 5 44 Numbers 6 75 Numbers 7 99 Numbers 8 17 Numbers 9 25 Remember to close the file PART 1 Type the answers of following questions in a word document named SP2018LAB7 PART1 vourLastName.docx Look at the following array definition int [ ] values 2, 5, 6, 4, 71; 1. What is the output of the following lines? System.out.println(values[2]); x values1] 2 values[4]; System.out.println(x); x-++values[3]; System.out.println(x); 2. setDescription(String str) and setUnit(int num) are the mutor methods of class Inventoryltem void setDescription (String str) void setDescription (String str) str Description = str; The following statement creates an Inventoryltem array: Inventoryltem[ ] items new Inventoryltem[5]; Is it correct or not to execute the following statements? If it is not correct, write the correct one a. items[0]. setDescription("Hammer" b. items.setUnit(10); 3. Use the following int array int [] numbers 78, 29, 12, 56, 98, 44, 75, 99, 17, 25 Write the code to store these values of intArray to a file name numbers.txt with the following format. Numbers 0 78 Numbers 1 29 Numbers 2 12 Numbers 3 56 Numbers 4 98 Numbers 5 44 Numbers 6 75 Numbers 7 99 Numbers 8 17 Numbers 9 25 Remember to close the file
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
