Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In java I am trying to find the second smallest and second largest number in a 2d array. int array[][] = {{1,2.3},{3,4,5,},{6,7,8}}; int n =

In java I am trying to find the second smallest and second largest number in a 2d array.

int array[][] = {{1,2.3},{3,4,5,},{6,7,8}};

int n = array.length;

for (int i = 0; i < n; i++) {

for(int j = 0; j < n; j++) {

if(array[i] < [j]) }

int temp = array[i];

array[i] = array[j];

array[j] = temp;

}

}

}

System.out.print(array[1]);

system.out.print(array[n-2]);

However I get an error and I am not sure how to fix it.

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions

Question

8. Explain the relationship between communication and context.

Answered: 1 week ago