일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- html youtube
- #2차원배열
- 하이퍼레저패브릭
- #자바상속#자바이즈어#is~a
- relative path
- mac terminal command
- html object
- html multimedia
- html charset
- #3차원배열
- #C++ 연산자함수오버로딩
- html plug-in
- html video
- #성적관리프로그램
- hyperledger transaction
- #binary
- #CallByAddress
- html id
- border-box
- #C++ has~a
- #android activity
- #bubbleSort
- #1차원배열
- html5 new tag
- #JAVASCRIPT
- html code
- #다차원포인터
- docker example
- 토큰경제
- git flow
- Today
- Total
A sentimental robot
InetAddress Class 본문
import java.net.*;
public class CC {
public static void main(String []args) throws UnknownHostException{
//로컬 호스트를 이용한 InetAddress 객체 생성
InetAddress a=InetAddress.getLocalHost();
//호스트 이름을 문자열로 반환
System.out.printf("호스트 이름: %s %n", a.getHostName());
//호스트에 대한 IP주소 반환
System.out.printf("호스트 IP주소 :%s %n", a.getHostAddress());
//java.sun.com에 대응하는 InetAddress 객체 반환
a=InetAddress.getByName("java.sun.com");
System.out.printf("호스트 이름: %s %n", a.getHostName());
System.out.printf("호스트 IP주소 :%s %n", a.getHostAddress());
//매개변수 host에 대응하는 InetAddress 배열을 반환
InetAddress s[]=InetAddress.getAllByName("www.naver.com");
for(InetAddress temp_s:s){
System.out.printf("호스트 이름: %s ,", temp_s.getHostName());
System.out.printf("호스트 IP주소 :%s %n", temp_s.getHostAddress());
}
}
}
'Java' 카테고리의 다른 글
도서관리프로그램 (0) | 2017.12.29 |
---|---|
Reference's reference (0) | 2017.12.29 |
Map을 이용한 성적관리 (0) | 2017.12.29 |
Map (0) | 2017.12.29 |
Exception Handling (0) | 2017.12.29 |