Java Scanner with Regex Hello World..

..for future reference!

HelloScanner.java
import java.util.Scanner;
 
public class HelloScanner {
 
    public static void main(String[] args) {
        final String foo = "423 true fkor false 3 _?*! koraytugay 243";
 
        final Scanner defaultScanner = new Scanner(foo);
        // Default delimiter for Scanner is whitespace..
        // We are using the default delimiter here. 
        while (defaultScanner.hasNext()) {
            final String defaultScannerNext = defaultScanner.next();
            System.out.println(defaultScannerNext);
        }
 
        final Scanner stillDefaultButSpecialized = new Scanner(foo);
        while (stillDefaultButSpecialized.hasNext()) {
            if (stillDefaultButSpecialized.hasNextInt()) {
                int asInt = stillDefaultButSpecialized.nextInt();
                System.out.println("asInt: " + asInt);
            } else {
                stillDefaultButSpecialized.next(); // ignore, just keep walking
            }
        }
 
        System.out.println("== Regex Scanner ==");
        final Scanner regexScanner = new Scanner(foo);
        regexScanner.useDelimiter("[yf]");
        while (regexScanner.hasNext()) {
            System.out.println("#" + regexScanner.next() + "#");
        }
 
    }
}

and the output is..
MacBook-Pro:~ koraytugay$ java HelloScanner
423
true
fkor
false
3
_?*!
koraytugay
243
asInt: 423
asInt: 3
asInt: 243
== Regex Scanner ==
#423 true #
#kor #
#alse 3 _?*! kora#
#tuga#
# 243#