Answered step by step
Verified Expert Solution
Question
1 Approved Answer
public static void swap(int n1, int n2){ int temp = n1; n1 = n2; n2 = temp; } public static void main(String[ ] args){ int[
public static void swap(int n1, int n2){ int temp = n1; n1 = n2; n2 = temp; } public static void main(String[ ] args){ int[ ] array = {1,2,3,4,5}; swap(array[1], array[4]); for(int i=0; i < array.length; i++){ System.out.print(array[i] + ); } }
what would be the answer for this coding? I got errors...
a)1,5,3,4,2 | |
b) | 1,2,3,4,5 |
c) | 4,2,3,1,5 |
d) 5,4,3,2,1
(answer should be one of above the list) |
please help me out! (java)
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