10/8 Finder,, 1 1. Finder MAC OS X 2. ( ) MAC OS X Java ( ) 3. MAC OS X Java ( ) / 10

Size: px
Start display at page:

Download "10/8 Finder,, 1 1. Finder MAC OS X 2. ( ) MAC OS X Java ( ) 3. MAC OS X Java ( ) / 10"

Transcription

1 10/ URL : 10/8 1 / 10

2 10/8 Finder,, 1 1. Finder MAC OS X 2. ( ) MAC OS X Java ( ) 3. MAC OS X Java ( ) / 10

3 10/8 Finder 1 Figure : : Apple.com 2, 3 / 10

4 10/8 Finder ( ) 1, CS 2 CS : Finder, Finder ( ) 4 / 10

5 10/8 Finder, 1 :, CS 5 / 10

6 10/8 Finder cd. cd CS., CS touch test.txt, CS text.txt. text.txt / 10

7 10/8 : cd CS ls pwd mv filea fileb mv filea FolderB cp filea fileb cp filea FolderB mkdir FolderA CS filea fileb filea FolderB filea fileb filea FolderB FolderA, Google 7 / 10

8 10/8 Java Web page quiz1.java quiz2.java CS webct, CS, Java javac quiz1.java return 8 / 10

9 10/8 java quiz1 return Input positive integer, ( ) 2 : 3 3 : quiz2.java, / 10

10 10/8 URL : 10/8, 10/8 PM 11:59 10 / 10

11 10/8 10/ URL : 10/22 1 / 16

12 10/8 10/22 1 I,.. JAVA,, JAVA 2 / 16

13 10/8 10/22 1 II, TA.. Java JAVA,. 3 / 16

14 10/8 10/22 1 III. Android. 4 / 16

15 10/8 10/22 JAVA JAVA,,,, if, for, while ( ) Copy & Paste. 5 / 16

16 10/8 10/22 Hello World! public class Hello public static void main String[] args System.out.println "Hello World!" ; Hello.java & javac Hello.java java Hello 1 Hello 3. 1 Hello Hello.java 6 / 16

17 10/8 10/22 Hello World! public class Hello public static void main String[] args System.out.println "Hello World!" ; ( 1) { } 1 { } 2 { } 2 4 tab 1 3 Hello World! "Hello World!", \"Hello World!" 7 / 16

18 10/8 10/ = 7 5 * 6 = 30 7 / 8 = / 8.0 = public class keisan public static void main String[] args System.out.println "3 + 4 = "+ (3+4) ; System.out.println "5 * 6 = "+ (5*6) ; System.out.println "7 / 8 = "+ (7/8) ; System.out.println "7.0 / 8.0 = "+ (7.0/8.0) ; 1 &. 8 / 16

19 10/8 10/22 System.out.println(" "); System.out.print(" "); : println print? public class keisan public static void main String[] args System.out.print "3 + 4 = "+ (3+4) ; System.out.print "5 * 6 = "+ (5*6) ; System.out.print "7 / 8 = "+ (7/8) ; System.out.print "7.0 / 8.0 = "+ (7.0/8.0) ; = = 307 / 8 = 07.0 / 8.0 = / 16

20 10/8 10/22???.java public class??? public static void main String[] args ( ) System.out.println ( ), System.out.println(" "); System.out.print(" "); A B, + /! 10 / 16

21 10/8 10/22 :,, ( x 4 int x; x = 4; int x = 4; :, x 3 int x = 4; x = 3; 11 / 16

22 10/8 10/22 ( x 4.0 double x; x = 4.0; double x = 4.0; :, x 3.5 double x = 4.0; x = 3.5; ( x c char x; x = c ; char x = c ; 12 / 16

23 10/8 10/22 2 :, x, y. sample.java. int x = 10 x = x 1 // (1) x x = x*x // (2) x double y = 5.5 y = x*y // (3) y 13 / 16

24 10/8 10/22 ( ) ( import java.util.scanner // public class ( ) Scanner input = new Scanner System.in int N = input.nextint, N ( import java.util.scanner // public class ( ) Scanner input = new Scanner System.in ; double x = input.nextdouble ;, x 14 / 16

25 10/8 10/22 3 : keisan3.java. x y 1. x = y = x + y = x * y = x / y = 15 / 16

26 10/8 10/22 URL : 10/22, 10/22 PM 11:59 16 / 16

27 10/22 10/ URL : 10/29 1 / 21

28 10/22 10/29 10/22 10/29 10/22 2., or.,, 2 / 21

29 10/22 10/29 1 :, (double quotation). 3 / 21

30 10/22 10/29 2 :, System.out.println 4 / 21

31 10/22 10/29 JAVA 2 JAVA,,,, if, for, while ( ) Copy & Paste. 5 / 21

32 10/22 10/29 (int) 2. 1bit 0 1 nbit ( 1) s n 1, s, a 1,..., a n 1 {0, 1}, a i 2 i i=1 32bit, bit, / 21

33 10/22 10/29 (double), 64bit. s e e e e m m m m m s, e(11 ), m(52 ) x = ( 1) s 2 e 1023 ( i=1. x = 0.1 d i 2 i ) 7 / 21

34 10/22 10/29 : int x = 1; x = x + 1.0; x int 1.0 double ( ) I int x = 1; x = x + (int)1.0; // x = 2 double int = int x = 1; x = x + (int)1.75; // / 21

35 10/22 10/29 ( ) II x = 7/8; // x 0 x = (double)7/(double)8; // x x = 7.0/8; // x x = 7.0/8.0; // x : double, double., double y = 1.0; // y = 1; y = 2.0 * Math.sin(Math.PI/2.0); // y = 2*Math.sin(Math.PI/2); 9 / 21

36 10/22 10/29 if if : if ( ) { true ; } true, false 1 : p... int p;... if (p >= 50) { System.out.println("It will rain today."); } 10 / 21

37 10/22 10/29 if : if ( ) { true ; }else{ false ; } 2 : p... int p;... if (p >= 50) { System.out.println("Need an umbrella."); }else{ System.out.println("Not need an umbrella."); } 11 / 21

38 10/22 10/29 if : if ( A) { A true ; }else if ( B){ B true ; }else{ A B false ; } 3 : p... if (p >= 0 && p<=20) { System.out.println("Sunny!"); }else if(p > 20 && p <=50 ){ System.out.println("Cloudy."); }else{ System.out.println("Rainy."); } 12 / 21

39 10/22 10/29 if : Tabelle: if Java p == 50 p = 50 p 50 true, false p!= 50 p 50 p 50 true, false p >= 50 p 50 p 50 true, false p <= 50 p 50 p 50 true, false p > 50 p > 50 p 50 true, false p < 50 p < 50 p 50 true, false p >= 0 && p <= 20, 0 p p 20 p >= 40 p <= 20, p 40 p / 21

40 10/22 10/29 10/8 if(n % 3 == 0 && N % 5 == 0){ System.out.println("FizzBuzz"); }else if(n % 3 == 0){ System.out.println("Fizz"); }else if(n % 5 == 0){ System.out.println("Buzz"); }else{ System.out.println(N); } N, FizzBuzz : N % 3 N 3 14 / 21

41 10/22 10/29 docs/api/java/lang/math.html) I : double x = Math.random(); // 0 1 int y = (int) (9*Math.random()); // 0 8 double z = 2*Math.random()-1.0; // -1 1 double x = Math.abs(-3.0);, double x = Math.sqrt(2.0); double y = Math.cbrt(2.0); 15 / 21

42 10/22 10/29 docs/api/java/lang/math.html) II, log e double x = Math.pow(1.5, 6);// double y = Math.log(1.3); sin(x), cos(x), tan(x) double x = Math.sin(2.0); double y = Math.cos(Math.PI/2.0); double z = Math.tan(-Math.PI); arcsin(x), arccos(x), arctan(x) double x = Math.asin(0.5); double y = Math.acos(0.5); double z = Math.atan(-10); 16 / 21

43 10/22 10/29 docs/api/java/lang/math.html) III π, e double x = Math.PI; double y = Math.E;, double x = Math.ceil(1.5); double y = Math.floor(1.5); 17 / 21

44 10/22 10/29 1 : double d = Math.random();,. Omikuji.java. d < 0.1, Great blessing 0.1 d < 0.3, Small blessing 0.3 d < 0.5, Blessing 0.5 d < 0.7, Curse 0.7 d < 0.9, Small curse 0.9 d < 1.0, Great curse d 18 / 21

45 10/22 10/29 2 : π Java π. pi.java. (Machin ) π ( ) ( ) 1 1 = 4 arctan arctan, (Euler ) π ( ) ( ) 1 3 = 5 arctan + 2 arctan, (Stormer ) π ( ) ( ) ( ) = 6 arctan + 2 arctan + arctan double p1 = 4*Math.atan(1.0/5.0)-Math.atan(1.0/239.0); // Machin... System.out.println("Machin = "+ (p1*4));... System.out.println("PI = "+Math.PI); 19 / 21

46 10/22 10/29 3 : N(, 2500 ),. leap.java. (Wikipedia ): N 4, (N 4 ) N 100, (N ) N 400, (N ) N 400, Input a positive integer :101 Not leap Input a positive integer :204 Leap Input a positive integer :100 Not leap Input a positive integer :1200 Leap 20 / 21

47 10/22 10/29 URL : 10/29, 10/29 PM 11:59 21 / 21

48 10/29 11/ URL : 11/5 1 / 13

49 10/29 11/5 10/29.,,. Omikuji.java leap.java if. Omikuji.java if(d < 0.1){ System.out.println("Great blessing"); }else if(d < 0.3){ System.out.println("Small blessing");...( )... }else if(d < 1.0){ System.out.println("Great curse"); } System.out.println("d = "+d); } 2 / 13

50 10/29 11/5 JAVA 3 JAVA,,,, if, for, while ( ) Copy & Paste. 3 / 13

51 10/29 11/5 for ( ) π 4 = ( 1) n 2n + 1 n=0,, π/4 : p N = N n=0 ( 1) n 2n + 1 π 4 (N ), N = 0 N = 6 4 / 13

52 10/29 11/5 double p = 1.0; // N=0 System.out.println("p = "+p); p = p - 1.0/3.0; // N = 1 System.out.println("p = "+p); p = p + 1.0/5.0; // N = 2 System.out.println("p = "+p); p = p - 1.0/7.0; // N = 3 System.out.println("p = "+p); p = p + 1.0/9.0; // N = 4 System.out.println("p = "+p); p = p - 1.0/11.0; // N = 5 System.out.println("p = "+p); p = p + 1.0/13.0; // N = 6 System.out.println("p = "+p); p ( 1) n /(2n + 1) N = 10 5 / 13

53 10/29 11/5 for... double p = 1.0; // N = 0 int N = 10; // N=10 for(int n=1; n < N+1; n++){ if(n % 2 == 0){ p = p + 1.0/(2*n+1); }else{ p = p - 1.0/(2*n+1); } System.out.println("p = "+p); } 6 / 13

54 10/29 11/5 for for( ; ; ){ ( ); } 1 : 0 99 for(int i=0; i<100; i++){ System.out.println("i = "+i); } 1 i=0 i<100 i=0 i=i+1 i=1 2 i=1 i<100 i=1 i=i+1 i=2 3 4 i=100 i<100 7 / 13

55 10/29 11/5 for : for( ; ; ){ ( ); } 2 : 10 k=1 k int sum = 0; for(int k=1; k<=10; k++){ sum = sum + k; } 1 k=1 k<=10 sum = 1 k=k+1 k=2 2 k=2 k<=10 sum = 3 k=k+1 k=3 3 4 k=11 k<=10 8 / 13

56 10/29 11/5 for 3 : DrawGraph1.java public class DrawGraph1{ public static void main(string[] args){ for(int i=0; i<10; i++){ System.out.print(i +":"); for(int j=0; j<i; j++){ System.out.print("*"); } System.out.println(""); } } } for for j < i for, i i, j 9 / 13

57 10/29 11/5 1 : ( ) 1 N, N!. factorial.java. N! := N (N 1) : 2 N, N. divisor.java. Input a positive integer : Input a positive integer : / 13

58 10/29 11/5 3 : ( for I). Kuku.java. 3 1*1=1, 1*2=2, 1*3=3, 1*4=4, 1*5=5, 1*6=6, 1*7=7, 1*8=8, 1*9=9, 2*1=2, 2*2=4, 2*3=6, 2*4=8, 2*5=10, 2*6=12, 2*7=14, 2*8=16, 2*9=18, 3*1=3, 3*2=6, 3*3=9, 3*4=12, 3*5=15, 3*6=18, 3*7=21, 3*8=24, 3*9=27, 4*1=4, 4*2=8, 4*3=12, 4*4=16, 4*5=20, 4*6=24, 4*7=28, 4*8=32, 4*9=36, 5*1=5, 5*2=10, 5*3=15, 5*4=20, 5*5=25, 5*6=30, 5*7=35, 5*8=40, 5*9=45, 6*1=6, 6*2=12, 6*3=18, 6*4=24, 6*5=30, 6*6=36, 6*7=42, 6*8=48, 6*9=54, 7*1=7, 7*2=14, 7*3=21, 7*4=28, 7*5=35, 7*6=42, 7*7=49, 7*8=56, 7*9=63, 8*1=8, 8*2=16, 8*3=24, 8*4=32, 8*5=40, 8*6=48, 8*7=56, 8*8=64, 8*9=72, 9*1=9, 9*2=18, 9*3=27, 9*4=36, 9*5=45, 9*6=54, 9*7=63, 9*8=72, 9*9=81, 11 / 13

59 10/29 11/5 3 :??? for(int i=0;???; i++){ for(int j=0;???; j++){???; }???; }, System.out.println System.out.print 12 / 13

60 10/29 11/5 URL : 11/5, 11/5 PM 11:59 13 / 13

61 11/5 11/ URL : 11/12 1 / 11

62 11/5 11/12. public class divisor { public static void main (String[] args){ int n = 1; for(int a = 1; a<=n; n++){ if(n%a==0){ System.out.println(a); } } } } 2 / 11

63 11/5 11/12 Control c for 3 / 11

64 11/5 11/12 JAVA 4 JAVA,,,, if, for, while ( ) Copy & Paste. 4 / 11

65 11/5 11/12 while while : while( ){ ( ); } 1 : i=0,..., 99 int i = 0; while(i < 100){ System.out.println("i = "+i); i = i + 1; } 1 i = 0 while i = 0 i=1 2 i = 1 while i = 1 i=2 3 4 i = 100 while 5 / 11

66 11/5 11/12 2 : x = double x = 100.0; int c = 0; while(x <= 200){ x = x * 1.08; c = c + 1; } System.out.println("c = "+c); 1 x = while x = 108.0, c = 1 2 x = while x = , c = x = while while 5 c = 10 6 / 11

67 11/5 11/12 while : while( ){ ( ); } do while : do{ ( ); }while( );, while(true){... } break,. ctrl-c. 7 / 11

68 11/5 11/12 for, while for while. for while., for, while 8 / 11

69 11/5 11/12 1 : 0,, 0. inputintsum.java. import java.util.scanner;... while( ){ scanner input = new Scanner(System.in); System.out.print("Input an integer :"); N = input.nextint(); ( ); },. N int while. do-while? 9 / 11

70 11/5 11/12 1 Input a positive integer :10 Input a positive integer :20 Input a positive integer :1 Input a positive integer :0 sum = 31 Input a positive integer :13 Input a positive integer :-2 Input a positive integer :4 Input a positive integer :0 sum = / 11

71 11/5 11/12 2 : ( ) γ γ N (, N ): γ N := N k=1 1 k log(n). while, γ N γ N 1 ϵ N.,, ϵ = ϵ = 10 6 double eps = 1.0e-6;. eulersconst.java., lim N γ N = / 11

72 11/5 11/12 URL : 11/12, 11/12 PM 11:59 12 / 11

r1.dvi

r1.dvi 2006 1 2006.10.6 ( 2 ( ) 1 2 1.5 3 ( ) Ruby Java Java Java ( Web Web http://lecture.ecc.u-tokyo.ac.jp/~kuno/is06/ / ( / @@@ ( 3 ) @@@ : ( ) @@@ (Q&A) ( ) 1 http://www.sodan.ecc.u-tokyo.ac.jp/cgi-bin/qbbs/view.cgi

More information

明解Javaによるアルゴリズムとデータ構造

明解Javaによるアルゴリズムとデータ構造 21 algorithm List 1-1 a, b, c max Scanner Column 1-1 List 1-1 // import java.util.scanner; class Max3 { public static void main(string[] args) { Scanner stdin = new Scanner(System.in); Chap01/Max3.java

More information

3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World");

3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println(Hello World); (Basic Theory of Information Processing) Java (eclipse ) Hello World! eclipse Java 1 3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello

More information

K227 Java 2

K227 Java 2 1 K227 Java 2 3 4 5 6 Java 7 class Sample1 { public static void main (String args[]) { System.out.println( Java! ); } } 8 > javac Sample1.java 9 10 > java Sample1 Java 11 12 13 http://java.sun.com/j2se/1.5.0/ja/download.html

More information

明解Javaによるアルゴリズムとデータ構造

明解Javaによるアルゴリズムとデータ構造 74 searching 3 key Fig.3-1 75 2を探索 53を探索 3-1 5 2 1 4 3 7 4 を探索 Fig.3-1 76 3 linear searchsequential search 2 Fig.3-2 0 ❶ ❷ ❸ 配列の要素を先頭から順に走査していく 探索すべき値と等しい要素を発見 Fig.3-2 6 4 3 2 3-2Fig.3-3 77 5 Fig.3-3 0

More information

2

2 問題 次の設問に答えよ 設問. Java のソースコードをコンパイルするコマンドはどれか a) java b) javac c) javadoc d) javaw 設問. Java のバイトコード ( コンパイル結果 ) を実行するコマンドはどれか a) java b) javac c) javadoc d).jar 設問. Java のソースコードの拡張子はどれか a).c b).java c).class

More information

明解Java入門編

明解Java入門編 1 Fig.1-1 4 Fig.1-1 1-1 1 Table 1-1 Ease of Development 1-1 Table 1-1 Java Development Kit 1 Java List 1-1 List 1-1 Chap01/Hello.java // class Hello { Java System.out.println("Java"); System.out.println("");

More information

2

2 問題 1 次の設問 1~5 に答えよ 設問 1. Java のソースプログラムをコンパイルするコマンドはどれか a) java b) javac c) javadoc d) jdb 設問 2. Java のバイトコード ( コンパイル結果 ) を実行するコマンドはどれか a) java b) javac c) javadoc d) jdb 設問 3. Java のソースプログラムの拡張子はどれか a).c

More information

新・明解Javaで学ぶアルゴリズムとデータ構造

新・明解Javaで学ぶアルゴリズムとデータ構造 第 3 章 探索 Arrays.binarySearch 743 3-1 探索 探索 searching key 配列 探索 Fig.3-1 b c 75 a 6 4 3 2 1 9 8 2 b 64 23 53 65 75 21 3-1 53 c 5 2 1 4 3 7 4 Fig.3-1 a 763 3-2 線形探索 線形探索 linear search sequential search 2

More information

新・明解Javaで学ぶアルゴリズムとデータ構造

新・明解Javaで学ぶアルゴリズムとデータ構造 第 1 章 基本的 1 n 21 1-1 三値 最大値 algorithm List 1-1 a, b, c max // import java.util.scanner; class Max3 { public static void main(string[] args) { Scanner stdin = new Scanner(System.in); List 1-1 System.out.println("");

More information

Week 1 理解度確認クイズ解答 解説 問題 1 (4 2 点 =8 点 ) 以下の各問いに答えよ 問題 bit 版の Windows8.1 に Java をインストールする時 必要なパッケージはどれか 但し Java のコンパイルができる環境をインストールするものとする 1. jdk

Week 1 理解度確認クイズ解答 解説 問題 1 (4 2 点 =8 点 ) 以下の各問いに答えよ 問題 bit 版の Windows8.1 に Java をインストールする時 必要なパッケージはどれか 但し Java のコンパイルができる環境をインストールするものとする 1. jdk Week 1 理解度確認クイズ解答 解説 問題 1 (4 2 点 =8 点 ) 以下の各問いに答えよ 問題 1-1 32bit 版の Windows8.1 に Java をインストールする時 必要なパッケージはどれか 但し Java のコンパイルができる環境をインストールするものとする 1. jdk-8u65-windows-i586.exe 2. jre-8u65-windows-i586.exe

More information

8 if switch for while do while 2

8 if switch for while do while 2 (Basic Theory of Information Processing) ( ) if for while break continue 1 8 if switch for while do while 2 8.1 if (p.52) 8.1.1 if 1 if ( ) 2; 3 1 true 2 3 false 2 3 3 8.1.2 if-else (p.54) if ( ) 1; else

More information

: : : TSTank 2

: : : TSTank 2 Java (8) 2008-05-20 Lesson6 Lesson5 Java 1 Lesson 6: TSTank1, TSTank2, TSTank3 java 2 car1 car2 Car car1 = new Car(); Car car2 = new Car(); car1.setcolor(red); car2.setcolor(blue); car2.changeengine(jet);

More information

Java学習教材

Java学習教材 Java 2016/4/17 Java 1 Java1 : 280 : (2010/1/29) ISBN-10: 4798120987 ISBN-13: 978-4798120980 2010/1/29 1 Java 1 Java Java Java class FirstExample { public static void main(string[] args) { System.out.println("

More information

Java Java Java Java Java 4 p * *** ***** *** * Unix p a,b,c,d 100,200,250,500 a*b = a*b+c = a*b+c*d = (a+b)*(c+d) = 225

Java Java Java Java Java 4 p * *** ***** *** * Unix p a,b,c,d 100,200,250,500 a*b = a*b+c = a*b+c*d = (a+b)*(c+d) = 225 Java Java Java Java Java 4 p35 4-2 * *** ***** *** * Unix p36 4-3 a,b,c,d 100,200,250,500 a*b = 20000 a*b+c = 20250 a*b+c*d = 145000 (a+b)*(c+d) = 225000 a+b*c+d = 50600 b/a+d/c = 4 p38 4-4 (1) mul = 1

More information

Java updated

Java updated Java 2003.07.14 updated 3 1 Java 5 1.1 Java................................. 5 1.2 Java..................................... 5 1.3 Java................................ 6 1.3.1 Java.......................

More information

新・明解Java入門

新・明解Java入門 537,... 224,... 224,... 32, 35,... 188, 216, 312 -... 38 -... 38 --... 102 --... 103 -=... 111 -classpath... 379 '... 106, 474!... 57, 97!=... 56 "... 14, 476 %... 38 %=... 111 &... 240, 247 &&... 66,

More information

Microsoft Word - keisankigairon.ch doc

Microsoft Word - keisankigairon.ch doc 1000000100001010 1000001000001011 0100001100010010 1010001100001100 load %r1,10 load %r2,11 add %r3,%r1,%r2 store %r3,12 k = i + j ; = > (* 1 2 3 4 5 6 7 8 9 10) 3628800 DO 3 I=1,3 DO3I=1.3 DO3I 1.3

More information

解きながら学ぶJava入門編

解きながら学ぶJava入門編 44 // class Negative { System.out.print(""); int n = stdin.nextint(); if (n < 0) System.out.println(""); -10 Ÿ 35 Ÿ 0 n if statement if ( ) if i f ( ) if n < 0 < true false true false boolean literalboolean

More information

Java プログラミング Ⅰ 7 回目 switch 文と論理演算子 今日の講義講義で学ぶ内容 switch 文 論理演算子 条件演算子 条件判断文 3 switch 文 switch 文 式が case のラベルと一致する場所から直後の break; まで処理しますどれにも一致致しない場合 def

Java プログラミング Ⅰ 7 回目 switch 文と論理演算子 今日の講義講義で学ぶ内容 switch 文 論理演算子 条件演算子 条件判断文 3 switch 文 switch 文 式が case のラベルと一致する場所から直後の break; まで処理しますどれにも一致致しない場合 def Java プログラミング Ⅰ 7 回目 switch 文と論理演算子 今日の講義講義で学ぶ内容 switch 文 論理演算子 条件演算子 条件判断文 3 switch 文 switch 文 式が case のラベルと一致する場所から直後の まで処理しますどれにも一致致しない場合 default: から直後の まで処理します 式の結果 ラベル 定数 整数または文字 (byte, short, int,

More information

新・明解Java入門

新・明解Java入門 第 1 章 画面 文字 表示 Java Java Java Java Java JRE Java JDK 21 1-1 Java Java Java Java 誕生 Fig.1-1 Oak Java Sun Microsystems 2010 Oracle Java Oracle 4 Java http://www.java.com/ http://www.alice.org/ Fig.1-1Java

More information

ex01.dvi

ex01.dvi ,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) double

More information

Java講座

Java講座 ~ 第 1 回 ~ 情報科学部コンピュータ科学科 2 年竹中優 プログラムを書く上で Hello world 基礎事項 演算子 構文 2 コメントアウト (//, /* */, /** */) をしよう! インデントをしよう! 変数などにはわかりやすい名前をつけよう! 要するに 他人が見て理解しやすいコードを書こうということです 3 1. Eclipse を起動 2. ファイル 新規 javaプロジェクト

More information

Java (9) 1 Lesson Java System.out.println() 1 Java API 1 Java Java 1

Java (9) 1 Lesson Java System.out.println() 1 Java API 1 Java Java 1 Java (9) 1 Lesson 7 2008-05-20 Java System.out.println() 1 Java API 1 Java Java 1 GUI 2 Java 3 1.1 5 3 1.0 10.0, 1.0, 0.5 5.0, 3.0, 0.3 4.0, 1.0, 0.6 1 2 4 3, ( 2 3 2 1.2 Java (stream) 4 1 a 5 (End of

More information

コーディング基準.PDF

コーディング基準.PDF Java Java Java Java.java.class 1 private public package import / //////////////////////////////////////////////////////////////////////////////// // // // // ////////////////////////////////////////////////////////////////////////////////

More information

やさしいJavaプログラミング -Great Ideas for Java Programming サンプルPDF

やさしいJavaプログラミング -Great Ideas for Java Programming サンプルPDF pref : 2004/6/5 (11:8) pref : 2004/6/5 (11:8) pref : 2004/6/5 (11:8) 3 5 14 18 21 23 23 24 28 29 29 31 32 34 35 35 36 38 40 44 44 45 46 49 49 50 pref : 2004/6/5 (11:8) 50 51 52 54 55 56 57 58 59 60 61

More information

I java A

I java A I java 065762A 19.6.22 19.6.22 19.6.22 1 1 Level 1 3 1.1 Kouza....................................... 3 1.2 Kouza....................................... 4 1.3..........................................

More information

Javaによるアルゴリズムとデータ構造

Javaによるアルゴリズムとデータ構造 1 algorithm List 1-1 a, b, c List 1-1 // import java.util.scanner; class Max3 { public static void main(string[] args) { Scanner stdin = new Scanner(System.in); int a, b, c; int max; // Chap01/Max3.java

More information

●70974_100_AC009160_KAPヘ<3099>ーシス自動車約款(11.10).indb

●70974_100_AC009160_KAPヘ<3099>ーシス自動車約款(11.10).indb " # $ % & ' ( ) * +, -. / 0 1 2 3 4 5 6 7 8 9 : ; < = >? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y " # $ % & ' ( ) * + , -. / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B

More information

本サンプル問題の著作権は日本商工会議所に帰属します また 本サンプル問題の無断転載 無断営利利用を厳禁します 本サンプル問題の内容や解答等に関するお問 い合わせは 受け付けておりませんので ご了承ください 日商プログラミング検定 STANDARD(Java) サンプル問題 知識科目 第 1 問 (

本サンプル問題の著作権は日本商工会議所に帰属します また 本サンプル問題の無断転載 無断営利利用を厳禁します 本サンプル問題の内容や解答等に関するお問 い合わせは 受け付けておりませんので ご了承ください 日商プログラミング検定 STANDARD(Java) サンプル問題 知識科目 第 1 問 ( 本サンプル問題の著作権は日本商工会議所に帰属します また 本サンプル問題の無断転載 無断営利利用を厳禁します 本サンプル問題の内容や解答等に関するお問 い合わせは 受け付けておりませんので ご了承ください 日商プログラミング検定 STANDARD(Java) サンプル問題 知識科目 第 1 問 ( 知識 4 択 :20 問 ) 1.Java 言語ソースプログラムの拡張子は何か 1 java 2 class

More information

問題1 以下に示すプログラムは、次の処理をするプログラムである

問題1 以下に示すプログラムは、次の処理をするプログラムである 問題 1 次に示すプログラムは 配列 a の値を乱数で設定し 配列 a の値が 333 より大きく 667 以下の値 の合計値を求めるプログラムである 1 と 2 に適切なコードを記述してプログラムを完 成させよ class TotalNumber { public static void main(string[] args) { int[] a = new int[1000]; // 1 解答条件

More information

アルゴリズムとデータ構造1

アルゴリズムとデータ構造1 1 2005 7 22 22 (sakai.keiichi@kochi [email protected]) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2005/index.html tech.ac.jp/k1sakai/lecture/alg/2005/index.html f(0) = 1, f(x) =

More information

break 文 switch ブロック内の実行中の処理を強制的に終了し ブロックから抜けます switch(i) 強制終了 ソースコード例ソースファイル名 :Sample7_1.java // 入力値の判定 import java.io.*; class Sample7_1 public stati

break 文 switch ブロック内の実行中の処理を強制的に終了し ブロックから抜けます switch(i) 強制終了 ソースコード例ソースファイル名 :Sample7_1.java // 入力値の判定 import java.io.*; class Sample7_1 public stati Java プログラミング Ⅰ 7 回目 switch 文と論理演算子 今日の講義で学ぶ内容 switch 文 論理演算子 条件演算子 条件判断文 3 switch 文 switch 文 式が case のラベルと一致する場所から直後の まで処理しますどれにも一致しない場合 default: から直後の まで処理します 式は byte, short, int, char 型 ( 文字または整数 ) を演算結果としますラベルには整数リテラル

More information

Java演習(4) -- 変数と型 --

Java演習(4)   -- 変数と型 -- 50 20 20 5 (20, 20) O 50 100 150 200 250 300 350 x (reserved 50 100 y 50 20 20 5 (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics; (reserved public class Blocks1 extends

More information

Java 3 p.2 3 Java : boolean Graphics draw3drect fill3drect C int C OK while (1) int boolean switch case C Calendar java.util.calendar A

Java 3 p.2 3 Java : boolean Graphics draw3drect fill3drect C int C OK while (1) int boolean switch case C Calendar java.util.calendar A Java 3 p.1 3 Java Java if for while C 3.1 if Java if C if if ( ) 1 if ( ) 1 else 2 1 1 2 2 1, 2 { Q 3.1.1 1. int n = 2; if (n

More information

19 3!! (+) (>) (++) (+=) for while 3.1!! (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics;

19 3!! (+) (>) (++) (+=) for while 3.1!! (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics; 19 3!!...... (+) (>) (++) (+=) for while 3.1!! 3.1.1 50 20 20 5 (20, 20) 3.1.1 (1)(Blocks1.java) public class Blocks1 extends JApplet { public void paint(graphics g){ 5 g.drawrect( 20, 20, 50, 20); g.drawrect(

More information

Assignment_.java 課題 : 転置行列 / class Assignment_ public static void main(string[] args) int i,j; int[][] array = 1,,,,,,,,,,,,,1,1,; 行 列行列 i

Assignment_.java 課題 : 転置行列 / class Assignment_ public static void main(string[] args) int i,j; int[][] array = 1,,,,,,,,,,,,,1,1,; 行 列行列 i 1 1 0 1 Assignment_1.java 課題 1: チェッカー / class Assignment_1 public static void main(string[] args) int i,j; チェッカー用の 次元配列 int[][] checker=new int[][]; チェッカーパターンを書き込む for(i=0;i

More information

1.ppt

1.ppt /* * Program name: hello.c */ #include int main() { printf( hello, world\n ); return 0; /* * Program name: Hello.java */ import java.io.*; class Hello { public static void main(string[] arg)

More information

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV [email protected] [email protected] http://www.misojiro.t.u-tokyo.ac.jp/ tutimura/sem3/ 2002 12 11 p.1/33 10/16 1. 10/23 2. 10/30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20

More information

問 次の Fortran プログラムの説明及びプログラムを読んで、設問に答えよ。

問 次の Fortran プログラムの説明及びプログラムを読んで、設問に答えよ。 解答例 問題 1 変数 a が 3 以上でかつ 7 以下の場合 true と表示し そうでない場合は false と表示するプログラムである public class Prog061004_01 { int a; boolean b; a = Integer.parseInt(buf.readLine()); b = (a >= 3) && (a

More information

ex01.dvi

ex01.dvi ,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) { double

More information

JavaプログラミングⅠ

JavaプログラミングⅠ Java プログラミング Ⅰ 3 回目変数 今日の講義で学ぶ内容 変数とは 変数の使い方 キーボード入力の仕方 変 数 変 数 一時的に値を記憶させておく機能です 変数は 型 ( データ型ともいいます ) と識別子をもちます 2 型 変数に記憶できる値の種類です型は 値の種類に応じて次の 8 種類があり これを基本型といいます 基本型値の種類値の範囲または例 boolean 真偽値 true または

More information

JAVA 11.4 PrintWriter 11.5

JAVA 11.4 PrintWriter 11.5 JAVA 11.4 PrintWriter 11.5 PrintWriter Writer Int, float, char Object print() println() tostring() PrintWriter PrintWriter(OutputStream outputstream) PrintWriter(OutputStream outputstream, boolean flushonnewline)

More information

class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value =

class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value = Part2-1-3 Java (*) (*).class Java public static final 1 class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value

More information

プログラミング基礎I(再)

プログラミング基礎I(再) 山 元 進 1 度 は 講 義 を 受 けたことを 念 頭 に 置 いて 講 義 遠 慮 なく 質 問 せよ 質 問 で 授 業 を 止 めたくないならば TA の 人 を 呼 んで 質 問 すると 良 い 前 期 講 義 の 欠 席 者 は 特 に 注 意 せよ 4 限 座 学 +5 限 演 習 出 席 をとる( 前 期 同 様 のシステム) 中 間 試 験 を 行 う 期 末 試 験 の 範 囲

More information

ALG2012-C.ppt

ALG2012-C.ppt 2012717 ([email protected]) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2012/index.html 1 1. 2. 2 .. 3 public class WeightedNode { private E value; // private Map

More information

プログラミング入門1

プログラミング入門1 プログラミング入門 1 第 5 回 繰り返し (while ループ ) 授業開始前に ログオン後 不要なファイルを削除し て待機してください Java 1 第 5 回 2 参考書について 参考書は自分にあったものをぜひ手元において自習してください 授業の WEB 教材は勉強の入り口へみなさんを案内するのが目的でつくられている これで十分という訳ではない 第 1 回に紹介した本以外にも良書がたくさんある

More information

r02.dvi

r02.dvi 172 2017.7.16 1 1.1? X A B A X B ( )? IBMPL/I FACOM PL1 ( ) X ( ) 1.2 1 2-0 ( ) ( ) ( ) (12) ( ) (112) (131) 281 26 1 (syntax) (semantics) ( ) 2 2.1 BNF BNF(Backus Normal Form) Joun Backus (grammer) English

More information

22 200702894 1 1 3 2 4 2.1..................................... 4 2.1.1............................. 4 2.1.2............................. 4 2.2................................... 9 2.2.1...................................

More information

問 次の Fortran プログラムの説明及びプログラムを読んで、設問に答えよ。

問 次の Fortran プログラムの説明及びプログラムを読んで、設問に答えよ。 ソフトウェア基礎演習課題 文法理解度確認範囲 問題 1 データ型 ( 変数, データ型 ) 問題 2 制御構造 (switch 文 ) 問題 3 制御構造 (while 文 ) 問題 4 制御構造と配列 ( 総和 ) 問題 5 制御構造と配列 ( 総和, 平均 ) 問題 6 データ型と各種演算子 ( 文字列, 検索 ) 問題 7 クラスの定義 ( メソッドの定義, コンストラクタの定義, キャスト

More information

text_08.dvi

text_08.dvi C 8 12 6 6 8 Java (3) 1 8.1 8 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 1 8.2 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :

More information

class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value =

class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value = Part2-1-3 Java (*) (*).class Java public static final 1 class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value

More information

2 1 Web Java Android Java 1.2 6) Java Java 7) 6) Java Java (Swing, JavaFX) (JDBC) 7) OS 1.3 Java Java

2 1 Web Java Android Java 1.2 6) Java Java 7) 6) Java Java (Swing, JavaFX) (JDBC) 7) OS 1.3 Java Java 1 Java Java 1.1 Java 1) 2) 3) Java OS Java 1.3 4) Java Web Start Web / 5) Java C C++ Java JSP(Java Server Pages) 1) OS 2) 3) 4) Java Write Once, Run Anywhere 5) Java Web Java 2 1 Web Java Android Java

More information

JavaプログラミングⅠ

JavaプログラミングⅠ Java プログラミング Ⅰ 3 回目変数 今日の講義で学ぶ内容 変数とは 変数の使い方 キーボード入力の仕方 変 数 変 数 一時的に値を記憶させておく機能です 変数は 型 ( データ型ともいいます ) と識別子をもちます 2 型 変数に記憶できる値の種類です型は 値の種類に応じて次の 8 種類があり これを基本型といいます 基本型値の種類値の範囲または例 boolean 真偽値 true または

More information

2.2 Java C main Java main 2 C 6 C Java 3 C Java ( ) G101Hello.java G101Hello main G101Hello.java /* G101Hello */ class G101Hello { /* main */ public s

2.2 Java C main Java main 2 C 6 C Java 3 C Java ( ) G101Hello.java G101Hello main G101Hello.java /* G101Hello */ class G101Hello { /* main */ public s 2 2013 4 16 2.1............................... 2 1 2.2 Java......................... 2 2 2.3............. 2 2 2.4................................ 2 4 2.5............................ 2 5 2.6............................

More information

ALG2012-F.ppt

ALG2012-F.ppt 2012 7 26 ([email protected]) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2012/index.html 5 2 3 4 - 5 .. 6 - 7 public class KnapsackBB { // 0-1 private static double maxsofar; private

More information

JavaプログラミングⅠ

JavaプログラミングⅠ Java プログラミング Ⅰ 12 回目クラス 今日の講義で学ぶ内容 クラスとは クラスの宣言と利用 クラスの応用 クラス クラスとは 異なる複数の型の変数を内部にもつ型です 直観的に表現すると int 型や double 型は 1 1 つの値を管理できます int 型の変数 配列型は 2 5 8 6 3 7 同じ型の複数の変数を管理できます 配列型の変数 ( 配列変数 ) クラスは double

More information

10K pdf

10K pdf #1 #2 Java class Circle { double x; // x double y; // y double radius; // void set(double tx, double ty){ x = tx; y = ty; void set(double tx, double ty, double r) { x = tx; y = ty; radius = r; // Circle

More information

JavaプログラミングⅠ

JavaプログラミングⅠ Java プログラミング Ⅰ 4 回目演算子 今日の講義で学ぶ内容 演算子とオペランド 式 様々な演算子 代表的な演算子の使用例 演算子とオペランド 演算子 演算の種類です例えば + - * / 掛け算の記号は ではなく *( アスタリスク ) を使います割り算の記号は ではなく /( スラッシュ ) を使います オペランド 演算の対象です例えば 5( 値 ) num( 変数 ) 式 演算子とオペランドの組み合わせにより構成される数式です式は演算結果をもちます

More information

文字列操作と正規表現

文字列操作と正規表現 文字列操作と正規表現 オブジェクト指向プログラミング特論 2018 年度只木進一 : 工学系研究科 2 文字列と文字列クラス 0 個以上の長さの文字の列 Java では String クラス 操作 文字列を作る 連結する 文字列中に文字列を探す 文字列中の文字列を置き換える 部分文字列を得る 3 String クラス 文字列を保持するクラス 文字列は定数であることに注意 比較に注意 == : オブジェクトとしての同等性

More information

55 7 Java C Java TCP/IP TCP/IP TCP TCP_RO.java import java.net.*; import java.io.*; public class TCP_RO { public static void main(string[] a

55 7 Java C Java TCP/IP TCP/IP TCP TCP_RO.java import java.net.*; import java.io.*; public class TCP_RO { public static void main(string[] a 55 7 Java C Java TCP/IP TCP/IP 7.1 7.1.1 TCP TCP_RO.java import java.net.*; import java.io.*; public class TCP_RO { public static void main(string[] argv) { Socket readsocket = new Socket(argv[0], Integer.parseInt(argv[1]));

More information