import java.net.URL;


public class dailyCode {

public static void main(String[] args) {

try{

   String google = "http://www.google.com/index.html";

URL url = new URL(google);

System.out.println(url.getProtocol());

System.out.println(url.getHost());

System.out.println(url.getFile());

System.out.println(url.getDefaultPort());

}catch(Exception e){

e.printStackTrace();

}

}


'프로그래밍 > JAVA' 카테고리의 다른 글

Implement Stack  (0) 2016.12.01
LinkedList Implementation  (0) 2016.11.29
How to get google server time (URLConnection Example)  (0) 2016.11.27
Find Google IP (InetAddress class Example)  (0) 2016.11.25
람다 표현식 (Lambda Expression)  (0) 2016.11.24
Arrays class Example  (0) 2016.11.23
Hashtable and HashMap Example  (0) 2016.11.21

+ Recent posts