import java.lang.*;
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
char cCharacter1,
cCharacter2;
Scanner scanner = new Scanner(System.in);
System.out.print("Type in a character ");
cCharacter1 = scanner.findWithinHorizon(".", 0).charAt(0);
System.out.print("And now another one... ");
cCharacter2 = scanner.findWithinHorizon(".", 0).charAt(0);
System.out.print("The characters you typed are " + cCharacter1 + " and " + cCharacter2);
}
}
Example of an interaction:
Type in a character mAnd now another one... yThe characters you typed are m and y
No comments:
Post a Comment