Skip to content

Instantly share code, notes, and snippets.

@PatchRowcester
Created January 4, 2013 02:38
Show Gist options
  • Save PatchRowcester/4449458 to your computer and use it in GitHub Desktop.
Save PatchRowcester/4449458 to your computer and use it in GitHub Desktop.
Accept a character and display it. Also, accept a string and look for two consecutive digits and display them.
import java.util.Scanner;
public class FindWithinHorizon_Test {
public static void main(String args[]) {
Scanner myScanner = new Scanner(System.in);
char t,x;
t = myScanner.findWithinHorizon(".", 0).charAt(0);
System.out.println(t);
x = myScanner.findWithinHorizon(".", 0).charAt(0);
System.out.println(x);
String t1 = myScanner.findWithinHorizon("\\d\\d", 0);
System.out.println(t1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment