Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static void isLegalHttpUrl(String url) {
        int idx = url.indexOf("://");
        if (idx == -1) {
            throw new IllegalArgumentException(url + " is not an right http url,no '://'");
        }
        if (!url.startsWith("http")) {
            throw new IllegalArgumentException(url + " is not an right http url,no \"http\"");
        }

    }
}