May 2021 1 118 Report
Java for loop problem...?

Hi there, I am just curious if I got the right answer for the following code fragment:

int[][] p = {{8,3},{4,3},{7,2}};

String s = "";

for (int i = 0; i < p.length; i++{

Arrays.sort(p[i]);

for (int j = 0; j < p[i].length; j++) {

s += p[i][j];

}

}

System.out.println(s);

My answer "38342"

Thank-you!

Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Helpful Social

Copyright © 2024 Q2A.ES - All rights reserved.