.
Java . 2. .
megabax   
20.08.2011 .
. , ? . Delphi

Java . 2. .

. . , :

import java.io.IOException;

 

public class Example2 {

    public static void main(String[] args) {

        char inChar;

        System.out.println("Input simbol");

        try {

            inChar=(char)System.in.read();

            System.out.println("You input "+inChar);

        } catch  (IOException e) {

            System.out.println("Input ERROR");

        }

    }

}

 

. :

 

 

IOException:

import java.io.IOException;

 

IOException - : catch ( {}). , - Java ( , ). , , try {...} catch (IOException e) {...}:

 

        try {

            inChar=(char)System.in.read();

            System.out.println("You input "+inChar);

        } catch  (IOException e) {

            System.out.println("Input ERROR");

        }

 

 {...} catch (IOException e) {...}:

       inChar=(char)System.in.read();

       System.out.println("You input "+inChar);

 

.

 

()

 

 

( 20.08.2011 . )