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.

ich braeuchte ...

Empfohlene Antworten

Veröffentlicht

eine Klasse die Tastatureingaben einliest ?

haben sowas @school nur bin ich da gerade nicht mehr .. und komm somit an die Sachen net ran !

*sigh*

Danke schonmal im Vorraus!

mel

:mod:



import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;

public class Start
{
public Start() throws IOException
{
System.out.print("Eingeben: ");
String string = new BufferedReader(new InputStreamReader(System.in)).readLine();
System.out.println("Wert=" + string );
}
public static void main(String[] args)
throws IOException
{
new Start();
}
}
[/PHP]

*ist natürlich Java Code* :D

Was ist das denn für ein Schmutz?

Eine main-Methode und ein Konstruktor, die Exceptions werfen? :eek:

Ich würde es ja eher so machen:


import java.io.*;


public class Eingabe {

    public static void main(String[] args) {

        try {

            System.out.print("Eingabe: "); 

            String eingabe = new BufferedReader(new InputStreamReader(System.in)).readLine(); 

            System.out.println("Die Eingabe lautete:\n" + eingabe);

        }

        catch (IOException e) {

            e.printStackTrace();

        }

    }

}

Oh man du legst echt alles auf die Goldwage was :P

Sie wollte ein Beispiel um was von der Console zu lesen und kein beispiel für gutes Exceptionhandling.... ;)

...nebenbei, alles in die main zu klatschen is auch nicht so toll... (ok jezt hol ich die Goldwage raus :floet: )

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

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.