Erste Schritte Probleme beim Einlesen in der Methode

stefani

Mitglied
Hallo,
Ich habe folgende Methode geschrieben:
Java:
	public static Computer liesComputer(){
		Computer pc = new Computer();
		Scanner input = new Scanner(System.in);
		System.out.println("Bezeichnung eingeben: ");
		pc.bezeichnung = input.next();
		System.out.println("Preis eingben: ");
		pc.preis = input.nextInt();
		System.out.println("Netzteil: ");
		pc.ntzteil = input.nextInt();
		System.out.println("BlueRay: ");
		pc.blueRay = input.nextBoolean();
		System.out.println("Festplattenkapazität: ");
		pc.festplattenkapazitaet =input.nextInt();
		System.out.println("Aufrüstbar: ");
		pc.aufruestbarkeit=   pc.ntzteil>700;
		return pc;
		
		
		
	}
Nun an dieser Stelle
Java:
Computer pc = new Computer();
wirft die Compiler
dieser Fehler:
HTML:
No enclosing instance of type probe_klausur is accessible. Must qualify the allocation with an enclosing instance of type probe_klausur (e.g. x.new A() where x is an instance of probe_klausur).
 

Murray

Top Contributor
Offernbar ist Computer innerhalb eine Klasse probe_klausur deklariert - wenn das Absicht ist, dann dürfte es helfen, sie als static zu deklarieren.
 

Neue Themen


Oben