Java

Similar documents

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션

12-file.key

rmi_박준용_final.PDF

Microsoft PowerPoint - 04-UDP Programming.ppt

4장.문장

Microsoft PowerPoint - Java7.pptx

02 C h a p t e r Java

자바-11장N'1-502

PowerPoint 프레젠테이션

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

Microsoft PowerPoint - 03-TCP Programming.ppt

PowerPoint 프레젠테이션

untitled

Java ...

PowerPoint 프레젠테이션

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

슬라이드 1

»ê¾÷¿¬±¸¿øÇ¥Áö

PowerPoint Presentation

비긴쿡-자바 00앞부속

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

Connection 8 22 UniSQLConnection / / 9 3 UniSQL OID SET

슬라이드 1

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

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

03장.스택.key

<4D F736F F F696E74202D20C1A63235C0E520B3D7C6AEBFF6C5A920C7C1B7CEB1D7B7A1B9D628B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

03-JAVA Syntax(2).PDF

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

슬라이드 1

Cluster management software

Interstage5 SOAP서비스 설정 가이드

JMF3_심빈구.PDF

<4D F736F F F696E74202D20C1A63234C0E520C0D4C3E2B7C228B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

FileMaker ODBC and JDBC Guide

rosaec_workshop_talk

JAVA PROGRAMMING 실습 09. 예외처리

11 템플릿적용 - Java Program Performance Tuning (김명호기술이사)

PowerPoint Presentation

PowerPoint Presentation

PowerPoint Presentation

Microsoft PowerPoint - java1-lab5-ImageProcessorTestOOP.pptx

JAVA PROGRAMMING 실습 02. 표준 입출력

05-class.key

FileMaker ODBC and JDBC Guide

Design Issues

K&R2 Reference Manual 번역본

fundamentalOfCommandPattern_calmglow_pattern_jstorm_1.0_f…

JMF2_심빈구.PDF

Chap12

PowerPoint Presentation

자바 프로그래밍

C프로-3장c03逞풚

5장.key

class Sale void makelineitem(productspecification* spec, int qty) SalesLineItem* sl = new SalesLineItem(spec, qty); ; 2. 아래의액티비티다이어그램을보고 Java 또는 C ++,

ch09

gnu-lee-oop-kor-lec11-1-chap15

Microsoft PowerPoint 자바-기본문법(Ch2).pptx

JAVA 프로그래밍실습 실습 1) 실습목표 - 메소드개념이해하기 - 매개변수이해하기 - 새메소드만들기 - Math 클래스의기존메소드이용하기 ( ) 문제 - 직사각형모양의땅이있다. 이땅의둘레, 면적과대각

PowerPoint Presentation

PowerPoint Presentation

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

09-interface.key

0. 표지에이름과학번을적으시오. (6) 1. 변수 x, y 가 integer type 이라가정하고다음빈칸에 x 와 y 의계산결과값을적으시오. (5) x = (3 + 7) * 6; x = 60 x = (12 + 6) / 2 * 3; x = 27 x = 3 * (8 / 4

스레드를적용하지않은결과와스레드를적용한결과의비교 1) 두개의작업을스레드를사용하지않고수행한예 ) : 순차작업 class ThreadTest2 { System.out.print("-");// 화면에 - 를출력하는작업 System.out.print(" ");// 화면에 를출력

Microsoft Word - java19-1-midterm-answer.doc

C++-¿Ïº®Çؼ³10Àå

untitled

¾Ë·¹¸£±âÁöħ¼�1-ÃÖÁ¾

01....b

2007백서-001-특집

00목차

(291)본문7

歯JavaExceptionHandling.PDF

Spring Boot/JDBC JdbcTemplate/CRUD 예제

歯9장.PDF

, ( ),, ( ), 3, int kor[5]; int eng[5]; int Microsoft Windows 4 (ANSI C2 ) int kor[5] 20 # define #define SIZE 20 int a[10]; char c[10]; float

PowerPoint 프레젠테이션

01-OOPConcepts(2).PDF

Microsoft PowerPoint - lec3.ppt

Semantic Consistency in Information Exchange

MasoJava4_Dongbin.PDF

교육자료

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

스레드의우선순위 우선순위설정메소드 : void setpriority(int newpriority) newpriority 에설정할수있는등급 : 1( 가장낮은우선순위 ) 부터 10( 가장높은우선순위 ) 가장높은우선순위 : MAX_PRIORITY, 보통우선순위 : NORM_

PowerPoint Presentation

Network Programming

프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어

12-file.key

제11장 프로세스와 쓰레드

<4D F736F F F696E74202D20C1A63036C0E520BCB1C5C3B0FA20B9DDBAB928B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

59

14-Servlet

PowerPoint 프레젠테이션


PowerPoint Presentation

쉽게 풀어쓴 C 프로그래밊

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

Transcription:

Java http://cafedaumnet/pway

Chapter 1 1 public static String format4(int targetnum){ String strnum = new String(IntegertoString(targetNum)); StringBuffer resultstr = new StringBuffer(); for(int i = strnumlength(); i < 4 ; i++){ resultstrappend(' '); return (resultstrappend(strnum))tostring(); 11 public static void main(string args[]){ Systemoutprintln("This is my first Program"); public static void main(string args[]){ Systemoutprintln("------------------------"); Systemoutprintln("This is my first Program"); Systemoutprintln("------------------------"); public static void main(string args[]){ Systemoutprint("------------------------\n"); Systemoutprint("This is my first Program\n"); Systemoutprint("------------------------\n"); 12

public static void main(string args[]){ int a, b, c; a = 1; b = 2; c = a + b; Systemoutprintln("a = "+ a + ", b = " + b + ", c = " + c); 13 public static void main(string args[])throws Exception{ int a, b, c; Systemoutprint("please enter first number(a): "); BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); a = IntegerparseInt(inputNumreadLine()); Systemoutprint("please enter second number(b): "); inputnum = new BufferedReader(new InputStreamReader(Systemin)); b = IntegerparseInt(inputNumreadLine()); c = a + b; Systemoutprintln("a = "+ a + ", b = " + b + ", c = " + c); 14 public static void main(string args[])throws Exception{ int n;

Systemoutprint("please enter number : "); BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); n = IntegerparseInt(inputNumreadLine()); for(int i =0; i<n; i++) { Systemoutprint("yes "); Systemoutprintln("i=" + i + ": print " + n +" many yes "); public static void main(string args[])throws Exception{ int n; Systemoutprint("please enter number : "); BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); n = IntegerparseInt(inputNumreadLine()); for(int i =0; i<n; i++) { Systemoutprintln("i=" + i + ": print the numbers from 0 to " + (n-1)); 141 for 1 for(int i=0;i<10;i++) Systemoutprintln("yes "); for(int i=0;i<100;i++) Systemoutprintln("happy "); for(int i=0;i<1000;i++) Systemoutprintln("laugh "); 142 for 2 for(int i=0;i<n;i++) Systemoutprintln("yes ");

143 for 3 for(int i=0;i<n;i++) Systemoutprintln("yes "); for( ; ; ) 144 for 4 for(int i=0;i<n;i++) Systemoutprintln( i );

Chapter 2 2 21 public static void main(string args[])throws Exception{ int n; Systemoutprint("please enter number : "); BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); n = IntegerparseInt(inputNumreadLine()); for(int i =0; i<n; i++){ Systemoutprint( (i+1) ); public static String format4(int targetnum){ String strnum = new String(IntegertoString(targetNum)); StringBuffer resultstr = new StringBuffer(); for(int i = strnumlength(); i < 4 ; i++){ resultstrappend(' '); return (resultstrappend(strnum))tostring(); public static void main(string args[])throws Exception{ int n; Systemoutprint("please enter number : "); BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); n = IntegerparseInt(inputNumreadLine()); for(int i =0; i<n; i++){ Systemoutprint(format4(i+1)); public static String format4(int targetnum){ String strnum = new String(IntegertoString(targetNum)); StringBuffer resultstr = new StringBuffer(); for(int i = strnumlength(); i < 4 ; i++){ resultstrappend(' '); return (resultstrappend(strnum))tostring();

public static void main(string args[])throws Exception{ int n; Systemoutprint("please enter number : "); BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); n = IntegerparseInt(inputNumreadLine()); for(int i =0; i<n; i++){ for(int j =0; j<n; j++){ Systemoutprint(format4(j+1)); 211 for 5 1: 2: 3: 4: 5: public static String format4(int targetnum){ 6: String strnum = new String(IntegertoString(targetNum)); 7: StringBuffer resultstr = new StringBuffer(); 8: for(int i = strnumlength(); i < 4 ; i++){ 9: resultstrappend(' '); 10: 11: return (resultstrappend(strnum))tostring(); 12: 13: public static void main(string args[])throws Exception{ 14: int n; 15: Systemoutprint("please enter number : "); 16: BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); 17: n = IntegerparseInt(inputNumreadLine()); 18: 19: 20: for(int i =0; i<n; i++){ 21: for(int j =0; j<n; j++){ 22: Systemoutprint(format4(j+1)); 23: 24: 25: 26: 27: 212 for 6

1: 2: 3: 4: 5: public static String format4(int targetnum){ 6: String strnum = new String(IntegertoString(targetNum)); 7: StringBuffer resultstr = new StringBuffer(); 8: for(int i = strnumlength(); i < 4 ; i++){ 9: resultstrappend(' '); 10: 11: return (resultstrappend(strnum))tostring(); 12: 13: public static void main(string args[])throws Exception{ 14: int n; 15: Systemoutprint("please enter number : "); 16: BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); 17: n = IntegerparseInt(inputNumreadLine()); 18: 19: 20: for(int i =0; i<n; i++){ 21: for(int j =0; j<n; j++){ 22: Systemoutprint(format4(j+1)); 23: 24: 25: 26: 27: 20 for : i=0 i 0 : i<3 : 21-25 21 for : j=0 j 0 : j<3 : Systemoutprint( format4(j+1) ); 1 : j++ j 1 : j<3 : Systemoutprint( format4(j+1) ); 2 : j++ j 2 : j<3 : Systemoutprint( format4(j+1) ); 3 : j++ j 3 j<3 for (21 ) 24 (21-25 ) : i++ i 1 : i<3 : 21-25 21 for : j=0 j 0 : j<3 : Systemoutprint( format4(j+1) ); 1 : j++ j 1 : j<3 : Systemoutprint( format4(j+1) ); 2 : j++ j 2 : j<3 : Systemoutprint( format4(j+1) ); 3 : j++ j 3 j<3

for (21 ) 24 (21-25 ) : i++ i 2 : i<3 : 21-25 21 for : j=0 j 0 : j<3 : Systemoutprint( format4(j+1) ); 1 : j++ j 1 : j<3 : Systemoutprint( format4(j+1) ); 2 : j++ j 2 : j<3 : Systemoutprint( format4(j+1) ); 3 : j++ j 3 j<3 for (21 ) 24 (21-25 ) : i++ i 3 : i<3 for (20 ) 22 public static String format4(int targetnum){ String strnum = new String(IntegertoString(targetNum)); StringBuffer resultstr = new StringBuffer(); for(int i = strnumlength(); i < 4 ; i++){ resultstrappend(' '); return (resultstrappend(strnum))tostring(); public static void main(string args[])throws Exception{ int n; Systemoutprint("please enter number : "); BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); n = IntegerparseInt(inputNumreadLine()); for(int i =0; i<n; i++){ for(int j =0; j<n; j++){ Systemoutprint(format4(j+1));

23 public static String format4(int targetnum){ String strnum = new String(IntegertoString(targetNum)); StringBuffer resultstr = new StringBuffer(); for(int i = strnumlength(); i < 4 ; i++){ resultstrappend(' '); return (resultstrappend(strnum))tostring(); public static void main(string args[])throws Exception{ int n, k; Systemoutprint("please enter number : "); BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); n = IntegerparseInt(inputNumreadLine()); k = 1; for(int i =0; i<n; i++){ for(int j =0; j<n; j++){ Systemoutprint( format4(k++) ); 24 public static String format4(int targetnum){ String strnum = new String(IntegertoString(targetNum)); StringBuffer resultstr = new StringBuffer(); for(int i = strnumlength(); i < 4 ; i++){ resultstrappend(' '); return (resultstrappend(strnum))tostring(); public static void main(string args[])throws Exception{ int n; Systemoutprint("please enter number : "); BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); n = IntegerparseInt(inputNumreadLine()); for(int i =0; i<n; i++){

for(int j =0; j<i+1; j++){ Systemoutprint( format4(j+1) ); public static String format4(int targetnum){ String strnum = new String(IntegertoString(targetNum)); StringBuffer resultstr = new StringBuffer(); for(int i = strnumlength(); i < 4 ; i++){ resultstrappend(' '); return (resultstrappend(strnum))tostring(); public static void main(string args[])throws Exception{ int n; Systemoutprint("please enter number : "); BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); n = IntegerparseInt(inputNumreadLine()); for(int i =0; i<n; i++){ for(int j =0; j<n-i; j++){ Systemoutprint(format4(j+1)); 241 for 7 1: 2: 3: 4: 5: public static String format4(int targetnum){ 6: String strnum = new String(IntegertoString(targetNum)); 7: StringBuffer resultstr = new StringBuffer(); 8: for(int i = strnumlength(); i < 4 ; i++){ 9: resultstrappend(' '); 10: 11: return (resultstrappend(strnum))tostring(); 12: 13: 14: public static void main(string args[])throws Exception{ 15: int n, k; 16: Systemoutprint("please enter number : "); 17: BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); 18: n = IntegerparseInt(inputNumreadLine()); 19: 20: 21: k = 1; 22: for(int i =0; i<n; i++){ 23: for(int j =0; j<n; j++){ 24: Systemoutprint(format4(k++)); 25: 26: 27: 28: 29:

21 k=1; k 1 22 for : i=0 i 0 : i<3 : 23-27 23 for : j=0 j 0 : j<3 : Systemoutprint(format4(k++)); 1 k 2 : j++ j 1 : j<3 : Systemoutprint(format4(k++)); 2 k 3 : j++ j 2 : j<3 : Systemoutprint(format4(k++)); 3 k 4 : j++ j 3 j<3 for (23 ) 26 (23-27 ) : i++ i 1 : i<3 : 23-27 23 for : j=0 j 0 : j<3 : Systemoutprint(format4(k++)); 4 k 5 : j++ j 1 : j<3 : Systemoutprint(format4(k++)); 5 k 6 : j++ j 2 : j<3 : Systemoutprint(format4(k++)); 6 k 7 : j++ j 3 j<3 for (23 ) 26 (23-27 ) : i++ i 2 : i<3 : 23-27 23 for : j=0 j 0 : j<3 : Systemoutprint(format4(k++)); 7 k 8 : j++ j 1 : j<3 : Systemoutprint(format4(k++)); 8 k 9 : j++ j 2 : j<3 : Systemoutprint(format4(k++)); 9 k 10 : j++ j 3 j<3 for (23 ) 26

(23-27 ) : i++ i 3 : i<3 for (22 ) 242 for 8 1: 2: 3: 4: 5: public static String format4(int targetnum){ 6: String strnum = new String(IntegertoString(targetNum)); 7: StringBuffer resultstr = new StringBuffer(); 8: for(int i = strnumlength(); i < 4 ; i++){ 9: resultstrappend(' '); 10: 11: return (resultstrappend(strnum))tostring(); 12: 13: 14: public static void main(string args[])throws Exception{ 15: int n; 16: Systemoutprint("please enter number : "); 17: BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); 18: n = IntegerparseInt(inputNumreadLine()); 19: 20: 21: for(int i =0; i<n; i++){ 22: for(int j =0; j<i+1; j++){ 23: Systemoutprint(format4(j+1) ); 24: 25: 26: 27: 28: 243 for 9 1: 2: 3: 4:

5: public static String format4(int targetnum){ 6: String strnum = new String(IntegertoString(targetNum)); 7: StringBuffer resultstr = new StringBuffer(); 8: for(int i = strnumlength(); i < 4 ; i++){ 9: resultstrappend(' '); 10: 11: return (resultstrappend(strnum))tostring(); 12: 13: 14: public static void main(string args[])throws Exception{ 15: int n; 16: Systemoutprint("please enter number : "); 17: BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); 18: n = IntegerparseInt(inputNumreadLine()); 19: 20: 21: for(int i =0; i<n; i++){ 22: for(int j =0; j<n-i; j++){ 23: Systemoutprint(format4(j+1)); 24: 25: 26: 27: 28:

Chapter 3 -

Chapter 4 if 1) 1-1) number = 5 1-2) number = 5 1-3) number = 5 1-4) number = 5 1-5) number = 5 1-6) number = 5

1-7) number = 5 1-8) number = 5 1-9) number = 5 1-10) number = 5

Chapter 5 for Systemoutprint 2) 2-1) number = 5 2-2) number = 5 2-3) number = 5 2-4) number = 5 2-5) number = 5

2-6) number = 5 2-7) number = 5 [ n, 2-8 ] 2-8) number = 5 [ 2*n ] 2-9) number = 5

2-10) number = 5 [ n+2 + n+1 = 2*n + 3 ] [ *2 ] [ *1 ]

Chapter 6 61 public static String format4(int targetnum){ String strnum = new String(IntegertoString(targetNum)); StringBuffer resultstr = new StringBuffer(); for(int i = strnumlength(); i < 4 ; i++){ resultstrappend(' '); return (resultstrappend(strnum))tostring(); public static void main(string args[])throws Exception{ int[][] a = new int[30][30]; int n, k; Systemoutprint("please enter number : "); BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); n = IntegerparseInt(inputNumreadLine()); k=0; for(int i =0; i<n; i++){ for(int j =0; j<n; j++){ a[i][j] = k++; for(int i =0; i<n; i++){ for(int j =0; j<n; j++){ Systemoutprint(format4(a[i][j]));

611 1 1) int a[][] = new int[30][30]; 2) int a[] = {1, 2, 3, 4, 5, 6; 3) int a[][] = {{1, 2, 3, 4, 5, 6,{ 7, 8, 9, 10, 11, 12;

612 2 1: 2: 3: 4: public static String format4(int targetnum){ 5: String strnum = new String(IntegertoString(targetNum)); 6: StringBuffer resultstr = new StringBuffer(); 7: for(int i = strnumlength(); i < 4 ; i++){ 8: resultstrappend(' '); 9: 10: return (resultstrappend(strnum))tostring(); 11: 12: 13: public static void main(string args[])throws Exception{ 14: int[][] a = new int[30][30]; 15: int n, k; 16: Systemoutprint("please enter number : "); 17: BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); 18: n = IntegerparseInt(inputNumreadLine()); 19: 20: k=0; 21: 22: for(int i =0; i<n; i++){ 23: for(int j =0; j<n; j++){ 24: a[i][j] = k++; 25: 26: 27: for(int i =0; i<n; i++){ 28: for(int j =0; j<n; j++){ 29: Systemoutprint(format4(a[i][j])); 30: 31: 32: 33: 34: 62 public static String format4(int targetnum){ String strnum = new String(IntegertoString(targetNum)); StringBuffer resultstr = new StringBuffer(); for(int i = strnumlength(); i < 4 ; i++){ resultstrappend(' '); return (resultstrappend(strnum))tostring(); public static void main(string args[])throws Exception{ int[][] a = new int[30][30]; int n; Systemoutprint("please enter number : "); BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); n = IntegerparseInt(inputNumreadLine()); for(int i =0; i<n; i++){

for(int j =0; j<n; j++){ a[i][j] = j+1; //[A] for(int i =0; i<n; i++){ for(int j =0; j<n; j++){ Systemoutprint(format4(a[i][j])); : a[i][j] = i+1; : a[i][j] = i+j+1; : a[i][j] = i-j; : a[i][j] = j-i; : a[i][j] = (i+1)*(j+1); 63 public static String format4(int targetnum){ String strnum = new String(IntegertoString(targetNum)); StringBuffer resultstr = new StringBuffer(); for(int i = strnumlength(); i < 4 ; i++){ resultstrappend(' '); return (resultstrappend(strnum))tostring(); public static void main(string args[])throws Exception{ int[][] a = new int[30][30]; int n; Systemoutprint("please enter number : "); BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); n = IntegerparseInt(inputNumreadLine()); for(int i =0; i<n; i++){ a[i][i] = i+1; //[A] for(int i =0; i<n; i++){ for(int j =0; j<n; j++){ Systemoutprint(format4(a[i][j])); : a[i][i]=n-i; : a[0][i]=i+1; : a[n-1][i]=i+1; : a[i][0]=i+i; : a[i][n-1]=i+1; : a[i][n-i-1]=i+1;

64 public static String format4(int targetnum){ String strnum = new String(IntegertoString(targetNum)); StringBuffer resultstr = new StringBuffer(); for(int i = strnumlength(); i < 4 ; i++){ resultstrappend(' '); return (resultstrappend(strnum))tostring(); public static void main(string args[])throws Exception{ int[][] a = new int[30][30]; int n, k; Systemoutprint("please enter number : "); BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); n = IntegerparseInt(inputNumreadLine()); k=0; for(int i =0; i<n; i++){ a[i][i] = k++; //[A] for(int i =0; i<n; i++){ for(int j =0; j<n; j++){ Systemoutprint(format4(a[i][j])); : a[0][i]=k++; : a[n-1][i]=k++; : a[i][0]=k++; : a[i][n-1]=k++; : a[i][n-i-1]=k++; : a[n-i-1][i]=k++; 65 public static String format4(int targetnum){ String strnum = new String(IntegertoString(targetNum)); StringBuffer resultstr = new StringBuffer(); for(int i = strnumlength(); i < 4 ; i++){ resultstrappend(' '); return (resultstrappend(strnum))tostring(); public static void main(string args[])throws Exception{ int[][] a = new int[30][30]; int n, k; Systemoutprint("please enter number : "); BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); n = IntegerparseInt(inputNumreadLine());

k=0; for(int i =0; i<n; i++){ for(int j =0; j<n; j++){ a[i][j] = k++; //[A] for(int i =0; i<n; i++){ for(int j =0; j<n; j++){ Systemoutprint(format4(a[i][j])); : a[j][i]=k++; : a[i][n-j-1]=k++; : a[n-i-][j]=k++; : a[n-i-1][n-j-1]=k++; : a[j][n-i-1]=k++; : a[n-j-1][i]=k++; 66 public static void main(string args[])throws Exception{ int[][] a = new int[30][30]; int n; Systemoutprint("please enter number : "); BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); n = IntegerparseInt(inputNumreadLine()); for(int i=0; i<n; i++){ if((i%2)==0){ Systemoutprintln("i = "+ i+" is even number");// else{ Systemoutprintln("i = "+ i+" is odd number");// 67 public static String format4(int targetnum){ String strnum = new String(IntegertoString(targetNum)); StringBuffer resultstr = new StringBuffer(); for(int i = strnumlength(); i < 4 ; i++){ resultstrappend(' '); return (resultstrappend(strnum))tostring();

public static void main(string args[])throws Exception{ int[][] a = new int[30][30]; int n; Systemoutprint("please enter number : "); BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); n = IntegerparseInt(inputNumreadLine()); for(int i =0; i<n; i++){ for(int j =0; j<n; j++){ if(i==j){ a[i][j] = 9; else{ a[i][j] = 1; for(int i =0; i<n; i++){ for(int j =0; j<n; j++){ Systemoutprint(format4(a[i][j])); public static String format4(int targetnum){ String strnum = new String(IntegertoString(targetNum)); StringBuffer resultstr = new StringBuffer(); for(int i = strnumlength(); i < 4 ; i++){ resultstrappend(' '); return (resultstrappend(strnum))tostring(); public static void main(string args[])throws Exception{ int[][] a = new int[30][30]; int n; Systemoutprint("please enter number : "); BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); n = IntegerparseInt(inputNumreadLine()); for(int i =0; i<n; i++){ for(int j =0; j<n; j++){ if(i>j){ a[i][j] = 9; else{ a[i][j] = 1; for(int i =0; i<n; i++){ for(int j =0; j<n; j++){ Systemoutprint(format4(a[i][j]));

Chapter 7 (2 ) 3) 2 3-1) 1 3-2) 1 3-3) 1 3-4) 1 i

3-5) 9 0 number = 7 9 9 9 9 9 9 9 9 9 0 0 0 9 9 9 0 9 0 9 0 9 9 0 0 9 0 0 9 9 0 9 0 9 0 9 9 9 0 0 0 9 9 9 9 9 9 9 9 9 3-6) (i j) 0 1 (+,-,*,/) number = 5 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 3-7) 3-6 number = 6 1 1 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 0 0 1 1 0 0 1 1 0 0 1 1 1 1 0 0 1 1 3-8) 3-6 number = 6 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 3-6, 3-7, 3-8) 3-9) 1 number = 5 1 2 3 4 5 16 0 0 0 6 15 0 0 0 7 14 0 0 0 8 13 12 11 10 9

3-10) 1 number = 5 1 2 3 4 5 16 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9 3-11) number number = 5 3 3 3 3 3 3 2 2 2 3 3 2 1 2 3 3 2 2 2 3 3 3 3 3 3 3-12) 1 number = 5 1 3 6 10 15 2 5 9 14 19 4 8 13 18 22 7 12 17 21 24 11 16 20 23 25 3-13) number = 3 : 8 1 6 3 5 7 4 9 2 number = 5 : 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 1 (3X3, 5x5) 2 3 4 5 3x3 1 a[0][1] 2 a[-1][2] -1 a[2][2] 3

a[1][3] 3 a[1][0] 4 a[0][1] a[2][0] 5 a[1][1] 6 a[0][2] 7 a[-1][3] -1, 3 a[2][0] a[0][2] a[1][2] 8 a[0][3] 3 a[0][0] 9 a[-1][1] a[2][1]

Chapter 8 - public static String format4(int targetnum){ String strnum = new String(IntegertoString(targetNum)); StringBuffer resultstr = new StringBuffer(); for(int i = strnumlength(); i < 4 ; i++){ resultstrappend(' '); return (resultstrappend(strnum))tostring(); public static void main(string args[])throws Exception{ int n; Systemoutprint("please enter number : "); BufferedReader inputnum = new BufferedReader(new InputStreamReader(Systemin)); n = IntegerparseInt(inputNumreadLine()); int i=0; while(i<n){ Systemoutprintln(" i =" + format4(i) ); i++; for(int i=0;i<n;i++) Systemoutprintln(" i =" + format4(i) ); while( ) { ; public static String format4(int targetnum){ String strnum = new String(IntegertoString(targetNum)); StringBuffer resultstr = new StringBuffer(); for(int i = strnumlength(); i < 4 ; i++){ resultstrappend(' '); return (resultstrappend(strnum))tostring(); public static void main(string args[])throws Exception{ int[] a = new int[100]; Systemoutprintln("Print the contents of array a[]"); a[0] = 1; a[1] = 2; a[2] = 3; a[3] = 4; a[4] = 5;

a[5] = 6; a[6] = 7; a[7] = 8; a[8] = 9; a[9] = 10; int i=0; while(a[i]>0){ Systemoutprint(" i =" + format4(a[i]) ); i++; public static String format4(int targetnum){ String strnum = new String(IntegertoString(targetNum)); StringBuffer resultstr = new StringBuffer(); for(int i = strnumlength(); i < 4 ; i++){ resultstrappend(' '); return (resultstrappend(strnum))tostring(); public static void main(string args[])throws Exception{ int[] a = new int[100]; Systemoutprintln("Print the contents of array a[]"); a[0] = 11; a[1] = 12; a[2] = 13; a[3] = 14; a[4] = 15; a[5] = 6; a[6] = 7; a[7] = 8; a[8] = 9; a[9] = 10; int i=0; while(a[i]>0){ if(a[i]>10){ Systemoutprint(" big"); else{ Systemoutprint(" small"); i++; public static String format4(int targetnum){ String strnum = new String(IntegertoString(targetNum));

StringBuffer resultstr = new StringBuffer(); for(int i = strnumlength(); i < 4 ; i++){ resultstrappend(' '); return (resultstrappend(strnum))tostring(); public static void main(string args[])throws Exception{ int[] a = new int[100]; Systemoutprintln("Print the contents of array a[]"); a[0] = 11; a[1] = 12; a[2] = 13; a[3] = 14; a[4] = 15; a[5] = 6; a[6] = 7; a[7] = 8; a[8] = 9; a[9] = 10; int i=0; while(true){ if(a[i]<=0){ break; if(a[i]>10){ Systemoutprint(" big"); else{ Systemoutprint(" small"); i++; public static String format4(int targetnum){ String strnum = new String(IntegertoString(targetNum)); StringBuffer resultstr = new StringBuffer(); for(int i = strnumlength(); i < 4 ; i++){ resultstrappend(' '); return (resultstrappend(strnum))tostring(); public static void main(string args[])throws Exception{ int[] a = new int[100]; int[] b = new int[100]; Systemoutprintln("Print the contents of array a[]"); a[0] = 11; a[1] = 12; a[2] = 13; a[3] = 14; a[4] = 15; a[5] = 6; a[6] = 7; a[7] = 8; a[8] = 9;

a[9] = 10; int i=0; while(a[i]>0){// a[] b[] b[i]=a[i]; i++; Systemoutprintln("Print the array b[]"); i=0; while(b[i]>0){ Systemoutprint(format4(b[i])); i++;

Chapter 9 91 92 for(i=0;i<1000;i++) a[i]=i; 2 4 2 2 a[] 0 4, 6, 8, 10, 12, 14,,,, 2 3 3 6 3 3 6, 9, 12, 15, 18, 21,,,, 3 5 5 10 5 5 10, 15, 20, 25, 30, 35,,,, 5 7 7 14 7 7 14, 21, 28, 35, 42, 27,,,, 7 11 11

93 a[0]=2; a[1]=3; 5 5 3 3 9 9 5 5 a[2]=5; 7 3 3 9 9 7 7 a[3]=7 9 3 3 9 9 9 9 11 3 3 9 9 11 11 3 11 5 5 25 25 11 11 a[4]=11 13 3 3 9 9 13 13 3 13 5 5 25 25 13 13 a[5]=13 15 3 3 9 9 15 15 3 17 3 3 9 9 17 17 3 17 5 5 25 25 17 17 a[6]=17 19 3

Chapter 10 public class FileEx1 { public static void main(string[] args) throws Exception { Systemoutprintln("\nPlease enter File name:"); BufferedReader inputname; inputname = new BufferedReader(new InputStreamReader(Systemin)); String filename = inputnamereadline(); int c; RandomAccessFile raf = new RandomAccessFile(filename, "r"); c = rafread(); while(c!= -1) { Systemoutprint((char)c); c = rafread(); rafclose(); c = rafread(); c = rafread(); while(c!= -1) { Systemoutprint((char)c); c = rafread();

101 public class FileEx2 { public static void main(string[] args) { char a, b, c; a = 'A'; b = 'B'; c = 'C'; Systemoutprintln(a + " " + b + " " + c); A B C Systemoutprintln((int)a + " " + (int)b + " " + (int)c); 65 66 67 public class FileEx3 { public static void main(string[] args) { int a, b, c; a = 65; b = 66; c = 67; Systemoutprintln((char)a + " " + (char)b + " " + (char)c); A B C public class FileEx4 { public static void main(string[] args) throws Exception { String filename; String foutname; int c;

BufferedReader inputname; inputname = new BufferedReader(new InputStreamReader(Systemin)); Systemoutprintln("\nPlease enter input file name:"); filename = inputnamereadline(); Systemoutprintln("\nPlease enter output file name:"); foutname = inputnamereadline(); RandomAccessFile fin = new RandomAccessFile(filename, "r"); RandomAccessFile fout = new RandomAccessFile(foutname, "rw"); c = finread(); while(c!= -1) { foutwrite(c); c = finread(); finclose(); foutclose(); 102 public class FileEx4 { public static void main(string[] args) throws Exception { public class FileEx5 { public static void main(string[] args) throws Exception { String fname; int c; Systemoutprintln("\nPlease enter input file name:");

BufferedReader inputname; inputname = new BufferedReader(new InputStreamReader(Systemin)); fname = inputnamereadline(); RandomAccessFile fin = new RandomAccessFile(fname, "r"); c = finread(); while(c!= -1) { Systemoutprint(IntegertoHexString(c) + " "); c = finread(); finclose();

Chapter 11 4-1) ( ) ;*oiavaj tropmi { 1xE ssalc cilbup { )sgra ][gnirts(niam diov citats cilbup ;n,j,i tni 4-2) ( ) int i, j, n; public static void main(string[] args) { public class Ex2 { 4-3) ( ) i p m u p b o l r i p t c u b j c l a l i v a c i a s n s s t i t o E a i x t, * 3 i ; c j {, v o n i ; d 4-4) $$$ ( ) $$$ public class Ex4 {$$$public class Ex4-2 { public static void main(string[] args) {$$$public static void main(string[] args) { int i, j, n;$$$int a10={0,; 4-5) 4-4

$$$;*oiavaj tropmi public class Ex5 {$$${ 5xE ssalc cilbup public static void main(string[] args) {$$${ )sgra ][gnirts(niam diov citats cilbup int i, j, n;$$$;n,j,i tni 4-6) hexa ( 16 ) 1 6 2 16 3 4 8 5 3 6 <!-- ( isprint )--> 7 000000 69 6d 70 6f 72 74 20 6a 61 76 61 2e 69 6f 2e 2a import javaio* 000010 3b 0d 0a 0d 0a 70 75 62 6c 69 63 20 63 6c 61 73 ;public clas 000020 73 20 73 6f 6c 34 35 20 7b 0d 0a 20 20 20 20 70 s sol45 { p 000030 75 62 6c 69 63 20 73 74 61 74 69 63 20 76 6f 69 ublic static voi 000040 64 20 6d 61 69 6e 28 53 74 72 69 6e 67 5b 5d 20 d main(string[] 000050 61 72 67 73 29 20 74 68 72 6f 77 73 20 49 4f 45 args) throws IOE 000060 78 63 65 70 74 69 6f 6e 20 7b 0d 0a 0d 0a 20 20 xception { 000070 20 20 20 20 20 20 69 6e 74 20 69 3b 0d 0a 20 20 int i; 000080 20 20 20 20 20 20 53 74 72 69 6e 67 20 73 74 20 String st 000090 3d 20 22 20 22 2c 20 73 74 72 20 3d 20 22 20 22 = " ", str = " " 0000a0 2c 20 74 65 6d 70 20 3d 20 22 20 22 3b 0d 0a 3d, temp = " "; 0000b0 3a 20 20 20 20 20 20 20 20 74 72 79 20 7b 0d 0a try { 0000c0 20 20 20 20 20 20 20 20 20 20 20 20 52 61 6e 64 Rand 0000d0 6f 6d 41 63 63 65 73 73 46 69 6c 65 20 69 6e 20 omaccessfile in 0000e0 3d 20 6e 65 77 20 52 61 6e 64 6f 6d 41 63 63 65 = new RandomAcce 000550 0d 0a 20 20 20 20 7d 0d 0a 7d public class Ex6 { public static void main(string[] args) throws Exception { String fname; int line[] = new int[100]; int c; Systemoutprintln("\nPlease enter input file name:"); BufferedReader inputname; inputname = new BufferedReader(new InputStreamReader(Systemin)); fname = inputnamereadline(); RandomAccessFile fin = new RandomAccessFile(fname, "r"); c = finread(); while(c!= -1) { if(c!= 13) { else { 13 0D 0D 0A

c = finread(); while finclose(); c = finread(); while(c!= -1) { c = finread(); if(c!= 13) { else { 13 ( 0D) 0A public class Ex6_2 { public static void main(string[] args) throws Exception { String fname1, fname2; int line[] = new int[100]; int c, d; Systemoutprintln("\nPlease enter input file name:"); BufferedReader inputname; inputname = new BufferedReader(new InputStreamReader(Systemin)); fname1 = inputnamereadline(); Systemoutprintln("\nPlease enter input file name:"); fname2 = inputnamereadline(); RandomAccessFile fin1 = new RandomAccessFile(fname1, "r"); RandomAccessFile fin2 = new RandomAccessFile(fname2, "r"); c=0; d=0; while(c!= -1 && d!= -1) { c = fin1read(); while((c!= -1)&&(c!= 13)) { c = fin1read(); // while loop -1 13

if(c!= -1) { 13 0D 0D 0A else { // d = fin2read(); while((d!= -1)&&(d!= 13)) { d = fin2read(); // while loop -1 13 if(c!= -1) { 13 0D 0D 0A else { // file1 file2 fin1close(); fin2close();