코딩선배
[Java] 현재 IP 주소 구하기 본문
try {
InetAddress ip = InetAddress.getLocalHost();
System.out.println("IP 주소 : " + ip.getHostAddress());
System.out.println("컴퓨터 이름 : " + ip.getHostName());
} catch (UnknownHostException e) {
e.printStackTrace();
}
'Backend > Java' 카테고리의 다른 글
[Java] for문으로 별 찍기 (0) | 2023.05.19 |
---|---|
[Java] 현재 날짜, 시간, 요일 구하기 (0) | 2023.05.09 |
[Java] println, print, printf 차이 (2) | 2022.12.26 |
[Java] nextInt 다음 nextLine 안될 때 해결 방법 (0) | 2022.12.23 |
Comments