fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static int[] removedups (int[] arr) {
  11. int i = 0;
  12. for (int j=1; j<arr.length; j++) {
  13. if (arr[j] != arr[i]) {
  14. i = i+1;
  15. arr[i] = arr[j];
  16. }
  17. }
  18. return arr;
  19. }
  20.  
  21. public static void main (String[] args) throws java.lang.Exception
  22. {
  23. int[] arr = { 3,4,8,8,9,12,12,12,12,15,15,18,20 };
  24. int[] res = removedups(arr);
  25. for (int i = 0; i < res.length; i++) {
  26. print(res[i]);
  27. }
  28.  
  29. }
  30.  
  31.  
  32. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:26: error: cannot find symbol
			print(res[i]);
			^
  symbol:   method print(int)
  location: class Ideone
1 error
stdout
Standard output is empty