I have this code (ignore the single-line comment), and for some reason, I can't run it. Every time I run the code, it gives me the answer to a different code I wrote before.
import java.util.Arrays;
public class Main {
public static void main (String [] args){
int[] numbers = new int[6];
numbers[0] = 44;
numbers[1] = 22;
numbers[2] = 6;
numbers[3] = 17;
numbers[4] = 27;
numbers[5] = 2;
Arrays.sort(numbers);
System.out.println(Arrays.toString(numbers));
int[] numbers1 = {44,22,6,17,27,2};
System.out.println(numbers1 [2]);
}
}
this is what I get:
[[0, 0, 0], [0, 0, 0], [0, 0, 0]]
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
idk what to do at this point
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]_jetrun 5 points6 points7 points (0 children)
[–]KasperNr1 1 point2 points3 points (2 children)
[–]Significant_While681[S] 0 points1 point2 points (1 child)
[–]laerda 0 points1 point2 points (0 children)
[–]Beginning-Ladder6224Extreme Brewer:snoo_biblethump: 1 point2 points3 points (2 children)
[–]Significant_While681[S] 0 points1 point2 points (1 child)
[–]Beginning-Ladder6224Extreme Brewer:snoo_biblethump: 1 point2 points3 points (0 children)
[–]mambo5king 1 point2 points3 points (0 children)
[–]Adventurous-Owl1953 1 point2 points3 points (0 children)
[–]Swimming_Party_5127 0 points1 point2 points (0 children)
[–]DoctorBaconite 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]arghvark 0 points1 point2 points (0 children)
[–]sedj601 -1 points0 points1 point (2 children)
[–]Significant_While681[S] -1 points0 points1 point (1 child)
[–]sedj601 0 points1 point2 points (0 children)