📄 main.java
字号:
/*
* Main.java
*
* Created on 9 octobre 2008, 15:00
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package reseaux;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
/**
*
* @author Administrateur
*/
public class Main {
/** Creates a new instance of Main */
public Main() {
}
/**
* @param args the command line arguments
*/
// public static void main(String[] args) throws UnknownHostException, IOException {
// TODO code application logic here
//InetAddress adress = InetAddress.getLocalHost();
/*InetAddress adress = InetAddress.getByName("www.developpez.com");
System.out.println("nom du hot"+ adress.getHostName());
System.out.println("IP"+ adress.getHostAddress());*/
// }
static boolean isValidAddress(String host) {
try {
return InetAddress.getByName(host).isReachable(1);
}
catch(Exception e) {
return false;
}
}
/**
* @param args
* @throws UnknownHostException
* @throws SocketException
*/
public static void main(String[] args) throws Exception {
System.out.println(isValidAddress("http://www.developpez.com"));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -