Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

vielleicht kann mir ja jemand sagen, was an dem code nicht funktioniert:

class Ratezahl {

public long zZahl;

public int uGr=0,oGr=99,eZahl=45,versuch=0;

public Ratezahl() {

super();

}//eof public Ratezahl()

public void spiel(){

zZahl=meinRatezahl.zZahl();

while(eZahl!=zZahl){

versuch=meinRatezahl.versuch(versuch);

eZahl=meinRatezahl.eMaske(uGr,oGr,versuch,eZahl);

uGr=meinRatezahl.pruefe_uGr(zZahl,eZahl,uGr);

oGr=meinRatezahl.pruefe_oGr(zZahl,eZahl,oGr);

}//eof while(eZahl!=zZahl)

meinRatezahl.ende(zZahl,versuch);

}

public static void main(String[] args) {

Ratezahl meinRatezahl = new Ratezahl();

meinRatezahl.spiel();

}//eof public static void main(String[] args)

also die methoden, die noch angesprochen werden, kommen im quelltext noch... das prob ist, dass er meinRatezahl in der methode spiel nicht erkennt und ich weiß nich warum!!

vielen dank!;)

Hallo,

wie sollte er die auch kennen.

Du definierst meinRatezahl ja in der Methode main und nicht in der Klasse.

Du kannst auf die Methoden des aktuellen Objects einer Klasse immer mit this.zZahl() oder einfach nur zZahl() zugreifen.

Gruß Jaraz

meineRatezahl ist die Instanz, deren spiel-Methode Du aufrufst. Innerhalb dieser Methode brauchst Du keine Ratezahl-Instanz anzugeben, wenn Du auf die Member zugreifen willst, denn Du bist ja schon "in" einer solchen Instanz.

Lass einfach in spiel überall "meineRatezahl." weg, und die Zeile

zZahl=meinRatezahl.zZahl();

kann dann komplett rausfliegen.

:D Vielen Dank

@Klotzkopp

wobei zZahl=zZahl(); nicht rausfliegen kann, da es ja einmal eine Variablen und einmal eine Methode ist!

Grüße

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.