fork(1) download
  1. class Try{
  2.  
  3. public static void main(String args[]){
  4. int[] collection = new int[6];
  5.  
  6. collection[0] = 8;
  7. collection[1] = 2;
  8. collection[2] = 4;
  9. collection[3] = 2;
  10. collection[4] = 21;
  11. collection[5] = 3;
  12.  
  13. Random rnd = new Random();
  14. int[] result = new int[4];
  15.  
  16. int j;
  17. for(int j = 0; j<4; j+++){
  18. boolean exist = false;
  19.  
  20. int r, temp;
  21. r = rnd.get( 5 );
  22. System.out.println("r = "+r);
  23.  
  24. //losowanie indeksu do tablicy collection[]
  25. temp = collection[r];
  26.  
  27. }
  28.  
  29. for(int i = 0; i<6; i++)
  30. {
  31. //sprawdzanie czy tej wartosci juz nie ma w tablicy result
  32. if(temp == result[i]){
  33. exist = true;
  34. break;
  35. }
  36. }
  37. if(exist == false){
  38. result[j] = temp;
  39. }
  40.  
  41. }
  42. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:17: error: illegal start of expression
		for(int j = 0; j<4; j+++){
		                        ^
Main.java:17: error: not a statement
		for(int j = 0; j<4; j+++){
		                       ^
2 errors
stdout
Standard output is empty