MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

public class MainClass {
    public static void main(String[] args) {
        System.out.println(validateAddress("123, Street"));
    }

    // validate address
    public static boolean validateAddress(String address) {
        return address.matches("\\d+\\s+([a-zA-Z]+|[a-zA-Z]+\\s[a-zA-Z]+)");
    } // end method validateAddress

}