Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.regex.Pattern;

public class Main {
    public static boolean checkPhone(String phone) {
        if (phone.length() != 11) {
            return false;
        } else {
            Pattern p = Pattern.compile("^1[3|4|5|7|8]\\d{9}$");
            if (p.matcher(phone).matches()) {
                return true;
            } else {
                return false;
            }
        }
    }
}