Why the Output is as it is in this Java Code?

The alpha method returns an array that is sorted in reverse way, while the omega method directly reverses the array passed in parameter.
Hence alpha(matrix[0]); does nothing you can see while omega(matrix[1]); changes the order of the second row of your matrix.
As Shree Krishna said, you can find it by debugging.

Leave a Comment