Учу Java, При компиляции кода
public class Evolution {
public static void main(String[] args) {
Amoeba a1 = new Amoeba(5);
a1.setChromosomes(5);
a1.infoAmoeba();
}
}
class Amoeba {
static int Amount;
static boolean established = false;
public Amoeba(int n) {
if (established) {
Amount += 1;
} else {
Amount = n;
}
int num = Amount;
established = true;
}
private int Chromosomes;
public void setChromosomes(int x) {
Chromosomes = x;
}
public void infoAmoeba() {
System.out.println("Amoeba №: " + num + ":");
if (Chromosomes == 0) {
System.out.println("Chromosomes: unknown " + "; " + "Amount: " + Amount + ";");
} else {
System.out.println("Chromosomes: " + Chromosomes + "; " + "Amount: " + Amount + ";");
}
}
}
выдает ошибку
Evolution.java:28: error: cannot find symbol
System.out.println("Amoeba тДЦ: " + num + ":");
^
symbol: variable num
location: class Amoeba
1 error
Переводил искал в интернете, не нашел.