목록io (3)
삶 가운데 남긴 기록 AACII.TISTORY.COM

InetAddress import java.net.InetAddress; import java.net.UnknownHostException; public class InetAddressEx { public static void main(String[] args) { try { InetAddress local = InetAddress.getLocalHost(); System.out.println("호스트 주소: "+local.getHostAddress()); InetAddress[] iaArr = InetAddress.getAllByName("www.google.co.kr"); for(InetAddress remote:iaArr) { System.out.println("구글 주소: "+remote.getH..
문자 기반 스트림으로 변환 소스 스트림이 바이트기반 스트림(InputStream, OutputStream, FileInputStream, FileOutputStream)이면서 문자로 변환해야한다면 Reader와 Writer로 변환해야 합니다. InputStreamReader import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; public class InputStreaReaderEx { public static void main(String[] args) throws IOException { InputStream is = System.in; Reader re..
Console 키보드로 입력받고, 화면으로 출력하는 소프트웨어. System.in import java.io.IOException; import java.io.InputStream; public class SystemInEx { public static void main(String[] args) throws IOException { System.out.println("1. 조회"); System.out.println("2. 출금"); System.out.println("3. 입금"); System.out.println("4. 종료"); System.out.print("메뉴 선택: "); InputStream is = System.in;//키보드 입력 스트림 획득 char inputChar = (char..