Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security XI Status And Prospects

Authors: T.Y. Lin, Shelly Qian

1st Edition

0412820900, 978-0412820908

More Books

Students also viewed these Databases questions

Question

What lessons in intervention design, does this case represent?

Answered: 1 week ago