12-file.key

Similar documents
12-file.key

rmi_박준용_final.PDF

PowerPoint 프레젠테이션

02 C h a p t e r Java

05-class.key

Cluster management software

Java

JAVA PROGRAMMING 실습 09. 예외처리

Microsoft PowerPoint - 04-UDP Programming.ppt

PowerPoint 프레젠테이션

<4D F736F F F696E74202D20C1A63234C0E520C0D4C3E2B7C228B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

비긴쿡-자바 00앞부속

Microsoft PowerPoint - Supplement-03-TCP Programming.ppt [호환 모드]

PowerPoint 프레젠테이션

Microsoft PowerPoint - 03-TCP Programming.ppt

歯JavaExceptionHandling.PDF

슬라이드 1

07 자바의 다양한 클래스.key

(Microsoft PowerPoint - java1-lecture11.ppt [\310\243\310\257 \270\360\265\345])

<4D F736F F F696E74202D20C1A63235C0E520B3D7C6AEBFF6C5A920C7C1B7CEB1D7B7A1B9D628B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

Network Programming

자바-11장N'1-502

09-interface.key

신림프로그래머_클린코드.key

파일로입출력하기II - 파일출력클래스중에는데이터를일정한형태로출력하는기능을가지고있다. - PrintWriter와 PrintStream을사용해서원하는형태로출력할수있다. - PrintStream은구버전으로가능하면 PrintWriter 클래스를사용한다. PrintWriter

PowerPoint Presentation

untitled

Microsoft PowerPoint - java2-lecture2.ppt [호환 모드]

Chap12

Microsoft PowerPoint - Java7.pptx

01-OOPConcepts(2).PDF

PowerPoint Presentation

4장.문장

PowerPoint 프레젠테이션

목차 BUG DEQUEUE 의 WAIT TIME 이 1 초미만인경우, 설정한시간만큼대기하지않는문제가있습니다... 3 BUG [qp-select-pvo] group by 표현식에있는컬럼을참조하는집합연산이존재하지않으면결괏값오류가발생할수있습니다... 4

목차 INDEX JSON? - JSON 개요 - JSONObject - JSONArray 서울시공공데이터 API 살펴보기 - 요청인자살펴보기 - Result Code - 출력값 HttpClient - HttpHelper 클래스작성 - JSONParser 클래스작성 공공

Microsoft PowerPoint - java1-lab5-ImageProcessorTestOOP.pptx

歯9장.PDF

ch09

JMF2_심빈구.PDF

PowerPoint 프레젠테이션

교육자료

Semantic Consistency in Information Exchange

중간고사

Connection 8 22 UniSQLConnection / / 9 3 UniSQL OID SET

Java ...

5장.key

ilist.add(new Integer(1))과 같이 사용하지 않고 ilist.add(1)과 같이 사용한 것은 자바 5.0에 추가된 기본 자료형과 해당 객체 자료 형과의 오토박싱/언박싱 기능을 사용한 것으로 오토박싱이란 자바 컴파일러가 객체를 요구하는 곳에 기본 자료형

PowerPoint Presentation

Mobile Service > IAP > Android SDK [ ] IAP SDK TOAST SDK. IAP SDK. Android Studio IDE Android SDK Version (API Level 10). Name Reference V

PowerPoint Presentation

13-Java Network Programming

자바 프로그래밍

[ 정보 ] 과학고 R&E 결과보고서 Monte Carlo Method 를이용한 고교배정시뮬레이션 연구기간 : ~ 연구책임자 : 강대욱 ( 전남대전자컴퓨터공학부 ) 지도교사 : 최미경 ( 전남과학고정보 컴퓨터과 ) 참여학생 : 박진명 ( 전

fundamentalOfCommandPattern_calmglow_pattern_jstorm_1.0_f…

JMF3_심빈구.PDF

FileMaker ODBC and JDBC Guide

<4D F736F F F696E74202D20C1A63038C0E520C5ACB7A1BDBABFCD20B0B4C3BC4928B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

PowerPoint Template

Secure Programming Lecture1 : Introduction

자바GUI실전프로그래밍2_장대원.PDF

Microsoft PowerPoint - lec11_1516.ppt [호환 모드]

슬라이드 1

슬라이드 1

MasoJava4_Dongbin.PDF

14-Servlet

PowerPoint 프레젠테이션

FileMaker ODBC and JDBC Guide

04장

mytalk

예외 예외정의예외발생예외처리예외전파 단정 단정의선언 단정조건검사옵션 2

03-JAVA Syntax(2).PDF

java.lang 패키지 java.util 패키지 java.io 패키지 콜렉션 2

Contents Contents 2 1 Abstract 3 2 Infer Checkers Eradicate Infer....

Microsoft PowerPoint - VHDL02_full.ppt [호환 모드]

Microsoft PowerPoint - RMI.ppt

다중 한것은 Mahout 터 닝알 즘몇 를 현 다는것외 들을 현 Hadoop 의 MapReduce 프 워크와결 을 다는것 다. 계산 많은 닝은 컴퓨터의큰메 와연산기 을 만 Mahout 는최대한 MapReduce 기 을활용 터분 다용 졌다.. Mahout 의설 Mahou

JAVA PROGRAMMING 실습 02. 표준 입출력

1

PowerPoint 프레젠테이션

13ÀåÃß°¡ºÐ

교육2 ? 그림

JSP 의내장객체 response 객체 - response 객체는 JSP 페이지의실행결과를웹프라우저로돌려줄때사용되는객체이다. - 이객체는주로켄텐츠타입이나문자셋등의데이터의부가정보 ( 헤더정보 ) 나쿠키 ( 다음에설명 ) 등을지정할수있다. - 이객체를사용해서출력의방향을다른

Java XPath API (한글)

9장.예외와 단정

Analytics > Log & Crash Search > Unity ios SDK [Deprecated] Log & Crash Unity ios SDK. TOAST SDK. Log & Crash Unity SDK Log & Crash Search. Log & Cras

歯처리.PDF

쉽게 풀어쓴 C 프로그래밍

03장

Design Issues

쉽게 풀어쓴 C 프로그래밊

JavaGeneralProgramming.PDF

Spring Boot/JDBC JdbcTemplate/CRUD 예제

초보자를 위한 C# 21일 완성

Java ~ Java program: main() class class» public static void main(string args[])» First.java (main class ) /* The first simple program */ public class

歯NetworkKawuiBawuiBo.PDF

제11장 자바 입출력

03장.스택.key

Spring Data JPA Many To Many 양방향 관계 예제

Interstage5 SOAP서비스 설정 가이드

Transcription:

11

(String).. java.lang.stringbuffer. s String s = "abcd"; s = s + "e"; a b c d e a b c d e

,., "910359,, " "910359" " " " " (token) (token),, (delimiter).

java.util.stringtokenizer String s = "910359,, "; StringTokenizer t = new StringTokenizer(s, ","); t.nexttoken(); // "910359" t.nexttoken(); // " " t.nexttoken(); // " " t.nexttoken(); // NoSuchElementException

String s = "$13.46"; StringTokenizer t = new StringTokenizer(s, "$."); t.nexttoken(); // "13" t.nexttoken(); // "46" t.nexttoken(); // NoSuchElementException

class StringTokenizer new StringTokenizer (String text, String delim) text delim nexttoken(): String nexttoken(string new_delimiters): String hasmoretokens(): boolean, 0 nexttoken() counttokens(): int

(Files) (file): (character file): (binary file): 0 1 (open) (close).. (input) : (output) :

FileWriter.. PrintWriter FileWriter print, println PrintWriter ofile = new PrintWriter (new FileWriter("file.txt")); PrintWrit er print FileWriter file

, IO import java.io.*; public class Output1 { IOException. public static void main(string[] args) throws IOException { PrintWriter outfile = new PrintWriter(new FileWriter("test.txt")); outfile.println("hello to you"); outfile.print("how are"); outfile.println(" you?"); outfile.println(47+2); outfile.close();

FileReader.. BufferedReader FileReader readline BufferedReader ifile = new BufferedReader (new FileReader("file.txt")); BufferedRe ader readline FileReader file

, import java.io.*; import javax.swing.*; public class CopyFile { public static void main(string[] args) throws IOException { String f = JOptionPane.showInputDialog("Input filename, please: "); BufferedReader infile = new BufferedReader(new FileReader(f)); PrintWriter outfile = new PrintWriter(new FileWriter(f + ".out")); while (infile.ready()) { outfile.println(infile.readline()); infile.close(); outfile.close();

GUI

, import java.io.*; import javax.swing.*; public class CopyFile { public static void main(string[] args) throws IOException { JFileChooser chooser = new JFileChooser(); chooser.setdialogtitle("."); int result = chooser.showdialog(null, "Copy"); if(result = JFileChooser.APPROVE_OPTION) System.exit(0); String f = chooser.getselectedfile().tostring(); BufferedReader infile = new BufferedReader(new FileReader(f)); PrintWriter outfile = new PrintWriter(new FileWriter(f + ".out")); while (infile.ready()) { outfile.println(infile.readline()); infile.close(); outfile.close();

: System.out: System.out.println System.in: System.in InputStream. System.in BufferedReader BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in)); String s = keyboard.readline();

, 31 20250 42 24500 18 18000 627750 1029000 324000 PayrollReader.,, PayrollWriter.,.

class PayrollReader Methods getnextrecord(): boolean.. nameof(): String. hoursof(): int. payrateof(): double close()..

mport java.io.*; import java.util.*; public class PayrollReader { private BufferedReader infile; private String EOF = ""; private String name; private int hours, payrate; public PayrollReader(String file_name) { infile = new BufferedReader(new FileReader(file_name)); public String nameof() { return name; public int hoursof() { return hours; public int payrateof() { return payrate; public void close() { infile.close();

public boolean getnextrecord() { if(infile.ready()) return false; String line = infile.readline(); StringTokenizer t = new StringTokenizer(line, " "); String s = t.nexttoken().trim(); if(s.equals(eof) t.counttokens() = 2) return false; name = s; hours = new Integer(t.nextToken().trim()).intValue(); payrate = new Integer(t.nextToken().trim()).intValue(); return true;

import javax.swing.*; public class Payroll { private static void processpayroll(string in, String out) { PayrollReader reader = new PayrollReader(in); PayrollWriter writer = new PayrollWriter(out); while(reader.getnextrecord()) { int pay = reader.hoursof() * reader.payrateof(); writer.printcheck(reader.nameof(), pay); reader.close(); writer.close(); public static void main(string[] args) { String in_name = JOptionPane.showInputDialog("Plead type input payroll name: "); String out_name = JOptionPane.showInputDialog("Plead type output payroll name: "); if(in_name = null && out_name = null) processpayroll(in_name, out_name);

getnextrecord??.?. false (log)

? infile.readline() IOException. false. t.counttoken() = 2

try, catch. catch try { ;... catch ( ) { ;...

public boolean getnextrecord() { if(infile.ready()) return false; String line = infile.readline(); StringTokenizer t = new StringTokenizer(line, " "); String s = t.nexttoken().trim(); if(s.equals(eof) t.counttokens() = 2) return false; name = s; hours = new Integer(t.nextToken().trim()).intValue(); payrate = new Integer(t.nextToken().trim()).intValue(); return true;

public boolean getnextrecord() { boolean result = false; try { if(infile.ready()) return false; String line = infile.readline();... if(s.equals(eof) && t.counttokens() == 2) {... result = true; catch (IOException e) { System.out.println("PayrollReader error: " + e.getmessage()); return result;

public boolean getnextrecord() { boolean result = false; try { if(infile.ready()) return false; String line = infile.readline();... if(s.equals(eof)) { if(t.counttokens() == 2) {... result = true; else { System.out.println("PayrollReader: bad record format: " + line + " Skipping record"); result = getnextrecord(); catch (IOException e) { System.out.println("PayrollReader error: " + e.getmessage()); return result;

public boolean getnextrecord() { boolean result = false; try {... if(s.equals(eof)) { if(t.counttokens() == 2) {... result = true; else throw new RuntimeException(line); catch (IOException e) { System.out.println("PayrollReader error: " + e.getmessage()); catch (RuntimeException e) { System.out.println("PayrollReader error: bad record format: " + e.getmessage() + " Skipping record"); result = getnextrecord(); return result;

., Exception in thread "main" java.io.filenotfoundexception: /Volumes/Pamela/ Users/oukseh/11.csv (Permission denied) at java.io.fileinputstream.open(native Method) at java.io.fileinputstream.<init>(fileinputstream.java:120) at java.io.fileinputstream.<init>(fileinputstream.java:79) at java.io.filereader.<init>(filereader.java:41) at CopyFile.main(CopyFile.java:11)

getmessage(): String tostring(): String. printstacktrace (),

ArithmeticException ArrayIndexOutOfBound sexception ClassCastException NullPointerException FileNotFoundExcept EOFException InterruptedIOExcept

catch catch(< > e) {... < >. Exception RuntimeException IOException

, private int readanintfrom(bufferedreader view) throws IOException { int num; try { System.out.print("Type an int: "); String s = view.readline(); num = new Integer(s).intValue(); catch (Exception e) { System.out.println("Error: " + e.getmessage() + " not an integer; try again."); num = readanintfrom(view); // restart return num; Exception RuntimeException RuntimeException NumberFormatException

throws.. Java RuntimeException..

public class ExceptionExample { public ExceptionExample() { public void f() { try { g(); catch (RuntimeException e) { System.out.println("caught at f"); System.out.println("f completes"); public void g() { try { PrintWriter outfile = new PrintWriter(new FileWriter("text.out")); try { outfile.println( h() ); catch (NullPointerException e) { System.out.println("null pointer caught at g"); catch (IOException e) { System.out.println("io error caught at g"); System.out.println("g completes"); private int h() { int[] r = new int[2]; return r[3]; f?

A, B. try {... catch (?) {... 1: throw new RuntimeException("A"); throw new RuntimeException("B"); try {... catch (RuntimeException e) { String m = e.getmessage(); if(m.equals("a"))... if(m.equals("b"))...

2: class MyExceptionA extends Exception { class MyExceptionB extends Exception { throw new MyExceptionA(); throw new MyExceptionB(); try {... catch (MyExceptionA e) {... catch (MyExceptionB e) {...