Witam, mam sobie kodzik programu, kompiluję go w Javie pod Ubuntu i wszystko gra, wszystko działa.
Pod Windowsem niestety się nie kompiluje - 2 Errors.
Pytam co zrobić kiedy zachodzą takie nieoczekiwane komunikaty?
Kod poniżej:
import java.util.*;
import java.lang.*;
public class Main {
public static void main(String args[]) throws Throwable {
Curr curr = new Curr();
for(Integer i=0;i<20;i++) {
System.out.println(curr.next());
}
}
}
class Curr implements Iterator
{
private int count = 0;
Vector numbers = new Vector();
Curr() {
numbers.add(2);
}
public boolean hasNext() {
if(count+1 < numbers.size()) return true;
return false;
}
public Integer next() {
int liczba;
if(count>0) {
boolean goodenough=false;
liczba = numbers.elementAt(count-1);//ostatni element
while(!goodenough) {
goodenough=true;
liczba++;
for(int i=0;i
if(liczba % numbers.elementAt(i) == 0) goodenough=false;
}
}
numbers.add(liczba);
count++;
}
else {
liczba = numbers.elementAt(count);
count++;
}
return liczba;
}
public void remove() {
System.out.println("Remove");
}
public Iterator iterator() {
return this;
}
}
I błąd: