Guest User

Untitled

a guest
Jan 17th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. public static void main(String[] args){
  2. int[] result = insertionSort({10,3,4,12,2});
  3. }
  4.  
  5. public static int[] insertionSort(int[] arr){
  6. return arr;
  7. }
  8.  
  9. Exception in thread "main" java.lang.Error: Unresolved compilation problems:
  10. Syntax error on token(s), misplaced construct(s)
  11. Syntax error on token ")", delete this token
  12.  
  13. public static void main(String[] args){
  14. int[] arr = {10,3,4,12,2};
  15. int[] result = insertionSort(arr);
  16. }
  17.  
  18. public static int[] insertionSort(int[] arr){
  19. return arr;
  20. }
  21.  
  22. int[] result = insertionSort(new int[]{10,3,4,12,2});
  23.  
  24. int[] arr = {10,3,4,12,2};
  25.  
  26. int[] arr; // already declared here but not initialized yet
  27. arr = {10,3,4,12,2}; // not a declaration statement so not allowed
  28.  
  29. insertionSort({10,3,4,12,2})
  30.  
  31. int[] result = insertionSort(new int[]{10,3,4,12,2});
Add Comment
Please, Sign In to add comment