untitled
|
|
- かねろう すえたけ
- 5 years ago
- Views:
Transcription
1 Java 1
2 1 Java 1.1 Java 1.2 Java JavaScript Java VM Java 4.1 Java 4.2 if else 4.3 switch case 4.4 for 4.5 while 4.6 do-while 4.7 break, continue, return 4.8 try-catch-finally Version Version Version.3
3 1 Java Java 1995 Sun Microsystems 1 Java Java Java Java 1.1 Java Java OS 2 OS Java "WriteOnce,RunAnywhere. Web Web C/C++ C C++ C/C OS Web Windows2000&InternetExplorer Windows2000&NetscapeNavigatorr
4 MacOS9&InternetExplorer UNIX(X-Window)&NetscapeNavigator OS OS OS OS Java Java Java Java C Java C Class Sum{ #include<stdio.h> public static void main(string args[]){ void main(){ int n=0; int i,n=0; for( int i=1 ; i<=100 ; i++ ){ for( i=1 ; i<=100 ; i++ ){ n += i; n += i; } } System.out.println( "Answer:" + n ); printf( "Answer:%d n", n ); } } } 2 Java C C Java Java Java C 2
5 Java 2 Java Web Web Internet Explorer Netscape Navigator Java GUI 5 CUI 6 2 Java 1.2 Java JavaScript Java Web Web JavaScript Java JavaScript JavaScript Java 2 JavaScript Netscape Communications Web LiveScript Sun Microsystems JavaScript JavaScript Web Web HTML 7 JavaScript Web 3
6 2 Java Java c: user> c: user 8 Z > a: [Enter] z: [Enter] 2.1 Java source file 8 4
7 Java, C, FORTRAN EmEditor > C: user> notepad Sample.java [Enter] [ ][ ] [BackSpace] [Delete] Sample.java ".java" 9 Java Smaple.java [ Y ] Sample.java 1 class Sample{ 2 public static void main( String args[] ){ 3 System.out.println("This is a sample program."); 4 } 5 } 9 5
8 "This is a sample program."" " "Sample.java" 2.2 Java javac C: user> javac Sample.java class [ ].class dir Sample.class [ ][ ] 2.3 Java VM Java VM Virtual Machine Java OS Java VM OS Java VM C: user> java Sample ".class" ".class" C: user> java Sample This is a sample program. 6
9 "This is a sample program." Java 7
10 3 3.1 Sample.java 1 class Sample{ 2 public static void main( String args[] ){ 3 System.out.println("This is a sample program."); 4 } 5 } class Sample{ "Sample" Java 1 { public static void main( String args[] ){ Sample main C public, static, void System.out.println("This is a sample program."); main ; } 2 "{" "}" } 1 "{" "}" 8
11 1 Java 1 Java 10 Java class { : : ( ){ : } : : } Sample main,,,,,,,,,,,,, Java Java
12 3.2 Java CApp.java 1 class CApp{ 2 public static void main( String args[] ){ 3 System.out.println("This is a sample console application."); 4 } 5 } Internet Explorer Netscape Navigator Web Java Java Web HTML Aplt.java 1 import java.applet.applet; 2 import java.awt.graphics; 3 4 public class Aplt extends Applet{ 5 public void paint( Graphics g ){ 10
13 6 g.drawstring("this is a sample applet.",20,20); 7 } 8 } HTML Aplt.html 1 <APPLET CODE="Aplt.class" WIDTH="320" HEIGHT="60"> 2 </APPLET> HTML C: user> appletviewer Aplt.html Internet Explorer Netscape Navigator Web Aplt.html 3.4 Windows 11
14 WApp.java 1 import java.awt.*; 2 3 class WApp extends Frame{ 4 public WApp(){ 5 setsize(320,60); 6 } 7 8 public void paint( Graphics g ){ 9 g.drawstring("this is a sample window application",20,40); 10 } public static void main( String args[] ){ 13 WApp wa = new WApp(); 14 wa.show(); 15 } 16 } [CTRL][C] Java 12
15 4 Java 4.1 Java Java 2 Calc.java 1 class Calc{ 2 public static void main( String args[] ){ 3 // 4 int i,j,s,d,p,q,r; 5 // 6 i=7; 7 j=5; 8 // 9 s = i + j; 10 d = i - j; 11 p = i * j; 12 q = i / j; 13 r = i % j; 14 // 15 System.out.println( i + " + " + j + " = " + s); 16 System.out.println( i + " - " + j + " = " + d); 17 System.out.println( i + " * " + j + " = " + p); 18 System.out.println( i + " / " + j + " = " + q + "... " + r ); 19 } 20 } C: user>javac Calc.java C: user>java Calc = = 2 7 * 5 = 35 7 / 5 =
16 y=f(x) x y 4 i,j,s,d,p,q,r int Java 4 i,j,s,d,p,q,r int Java byte 123 byte short int -21 X X l long -922 X X f float 1.4 X X d double 4.9 X X boolean true,false boolean true,false 12 'a' char l L: f 7 5 q 1 ; ; 1 9~ String 14
17 s = i + j; d = i - j; p = i * j; q = i / j; r = i % j; { } ;,,, etc. Calc i,j,s,d,p,q,r 1 A Z,a z "_" "$" abstract boolean break byte case catch char class const continue default do double else extends final finally float for goto if implements import instanceof int interface long native new package private protected public return short static super switch synchronized this throw throws transient try void volatile white =, +, -, *, / 6,7 9~13 Java 15
18 = a = 22; a 22 + a = ; a 30 - a = 22 8 ; a 14 * a = 22 * 8 ; a 176 / a = 22 / 8 ; a 2 % a = 22 % 8 ; a 6 += a += 22 ; a=a+22 -= a -= 22 ; a=a-22 *= a *= 22 ; a=a*22 /= a /= 22 ; a=a/22 ++ a++ ; a 1 ++a ; 1 a -- a-- ; a 1 --a ; 1 a * / a = 8; b = a++ ; a = 8; b = ++a ; a b a 1 a 9 b 8 a 1 b a b 9 3,5,8,14 "//" Java C /* */ if else switch case 16
19 for while do while break continue return 4.2 if else if ( ) { // } if ( ) { 1 // 1 } else { 2 // 2 } if ( 1 ) { 1 // 1 1 } else if ( 2 ){ 2 // 1 2 // 2 } else { 3 // 1 2 // 3 } if, else { } 1 boolean true,false true false 13 17
20 == a==4 a 4 true!= a!=4 a 4 true > a>24 a 24 true < a<24 a 24 true >= a>=24 a 24 true <= a<=24 a 24 true && a==4 && b==24 a==4 b==24 true a==4 b==24 a==4 b==24 true if else TestIf.java 1 class TestIf{ 2 public static void main( String args[] ){ 3 int i, j; 4 i = j = 0; 5 try { 6 i = Integer.parseInt( args[0] ); 7 } catch( Exception e ) { 8 System.err.println( " " ); 9 System.exit(1); 10 } 11 j = i % 2; 12 if ( j == 0 ) { 13 System.out.println( " " ); 14 } else { 15 System.out.println( " " ); 16 } 17 } 18 } 18
21 C: user>javac TestIf.java C: user>java TestIf try catch(-finally) 4.3 switch case byte, short, int, char switch( ) { case 1: 1 // 1 1 break; case 2: 2 // 2 2 break; () case n: n // n n break; default: x // // x } case break case break TestSwitch.java 1 class TestSwitch{ 2 public static void main( String args[] ){ 3 int i = 0; 4 try { 19
22 5 i = Integer.parseInt( args[0] ); 6 } catch(exception e ) { 7 System.out.println( " " ); 8 System.exit(1); 9 } 10 switch ( i ) { 11 case 1: 12 System.out.println( " 1 " ); 13 break; 14 case 2: 15 System.out.println( " 2 " ); 16 break; 17 case 3: 18 System.out.println( " 3 " ); 19 break; 20 default: 21 System.out.println( "1 3 " ); 22 } 23 } 24 } C: user>javac TestSwitch.java C: user>java TestSwitch 2 2 C: user>java TestSwitch for for for for ( 1 ; 2 ; 3 ){ // // for } 20
23 1 2 true 3 2 true 2 false 2 boolean TestFor.java 1 class TestFor{ 2 public static void main( String args[] ){ 3 int n, sum; 4 n = sum = 0; 5 try { 6 n = Integer.parseInt( args[0] ); 7 } catch(exception e ) { 8 System.out.println( " " ); 9 System.exit(1); 10 } 11 for ( int i=1 ; i<=n ; i++ ) { 12 sum += i; 13 } 14 System.out.println( "1 " +n+ " " + sum +" "); 15 } 16 } C: user>javac TestFor.java C: user>java TestFor for int i=1 C FORTRAN Java for i for 21
24 4.5 while while ( ) { // // while } for while while TestWhile.java 1 class TestWhile{ 2 public static void main( String args[] ){ 3 int n, sum; 4 n = sum = 0; 5 try { 6 n = Integer.parseInt( args[0] ); 7 } catch( Exception e ) { 8 System.out.println( " " ); 9 System.exit(1); 10 } 11 int i = 1; 12 while ( i<=n ) { 13 sum += i; 14 i++; 15 } 16 System.out.println( "1 " + n + " " + sum +" "); 17 } 18 } C: user>javac TestWhile.java C: user>java TestWhile
25 4.6 do-while while 1 do-while ; do { // } while ( ) ; // TestDo.java 1 class TestDo{ 2 public static void main( String args[] ){ 3 int n, sum; 4 n = sum = 0; 5 try { 6 n = Integer.parseInt( args[0] ); 7 } catch( Exception e ) { 8 System.out.println( " " ); 9 System.exit(1); 10 } 11 int i = 1; 12 do { 13 sum += i; 14 i++; 15 } while ( i<=n ) ; 16 System.out.println( "1 " + n + " " + sum +" "); 17 } 18 } C: user>javac TestDo.java C: user>java TestDo while do-while 0 23
26 while 0 do-while 0 1 C: user>java TestWhile C: user>java TestDo break, continue, return break if-else,switch-case,for,while,do-while...{ 1 break; 2 } 3 // 2 3 TestBreak.java 1 class TestBreak{ 2 public static void main( String args[] ){ 3 int n, sum; 4 n = sum = 0; 5 try { 6 n = Integer.parseInt( args[0] ); 7 } catch( Exception e ) { 8 System.out.println( " " ); 9 System.exit(1); 10 } 11 for ( int i=1 ; i<=n ; i++ ) { 12 if ( i>50 ) { // 50 break 24
27 13 n = 50; 14 break; 15 } 16 sum += i; 17 } 18 System.out.println( "1 "+ n +" "+ sum +" "); 19 } 20 } continue for,while,do-while...{ 1 continue; // } 3 : TestContinue.java 1 class TestContinue{ 2 public static void main( String args[] ){ 3 int n=0; 4 try { 5 n = Integer.parseInt( args[0] ); 6 } catch( Exception e ) { 7 System.out.println( " " ); 8 System.exit(1); 9 } 10 for ( int i=1 ; i<=n ; i++ ) { 11 if ( i%2 == 0 ) continue; // continue 12 System.out.println( i + " " ); 13 } 14 } 15 } 25
28 return 1 return C main void return ( ) { return ; // void } TestReturn.java 1 class TestReturn{ 2 public static void main( String args[] ){ 3 int n = 0; 4 try { 5 n = Integer.parseInt( args[0] ); 6 } catch( Exception e ) { 7 System.out.println( " " ); 8 System.exit(1); 9 } 10 System.out.println("1 "+n+" "+calc(n)+" "); 11 } 12 static int calc( int n ){ 13 int sum = 0; 14 for( int i=0 ; i<=n ; i++ ){ 15 sum += i; 16 } 17 return sum; 18 } 19 } 4.8 try-catch-finally Java try catch - finally 26
29 try { 1 // } catch( ) { 2 // } finally { 3 // 1 } TestTry.java 1 class TestTry{ 2 public static void main( String args[] ){ 3 int n, sum; 4 n = sum = 0; 5 try { 6 n = Integer.parseInt( args[0] ); 7 } catch( ArrayIndexOutOfBoundsException e ) { 8 System.out.println( " 1 " ); 9 System.exit(1); 10 } catch( NumberFormatException e ) { 11 System.out.println( "" ); 12 System.exit(1); 13 } catch( Exception e ) { 14 System.out.println( " " ); 15 System.exit(1); 16 } 17 for ( int i=1 ; i<=n ; i++ ) { 18 sum += i; 19 } 20 System.out.println( "1 " + n + " " + sum +" "); 21 } 22 } 27
30 C: user>javac TestTry.java C: user>java TestTry 1 C: user>java TestTry abc C: user>java TestTry ArrayIndexOutOfBoundsException NumberFormatException 3 Exception
31 Java LeapYear.java 1 class LeapYear{ 2 // 3 // (1)4 4 // (2)100 5 // (3)400 6 public static void main( String args[] ){ 7 // 8 int i=0,x,y,z; 9 try { 10 // 11 i = Integer.parseInt( args[0] ); 12 } catch( ArrayIndexOutOfBoundsException e ) { 13 // 1 14 System.out.println( " 1 " ); 15 System.exit(1); 16 } catch( NumberFormatException e ) { 17 // 2 18 System.out.println( "" ); 19 System.exit(1); 20 } 21 x = i % 4; // 4 22 y = i % 100; // z = i % 400; // // 25 if ( x==0 && y!=0 z==0 ) { 29
32 26 // 27 System.out.println( i + "" ); 28 } else { 29 // 30 System.out.println( i + " " ); 31 } 32 } 33 } C: user>javac LeapYear.java C: user>java LeapYear C: user>java LeapYear
33 5 Web main() Version.1 WhatTime.java 1 import java.applet.*; 2 import java.awt.*; 3 import java.util.*; 4 5 public class WhatTime extends Applet{ 6 public void paint( Graphics g ){ 31
34 7 String s; 8 Date d = new Date(); 9 s = d.tostring(); 10 g.drawstring( s, 10, 30 ); 11 } 12 } import java.applet.*; import java.awt.*; import java.util.*; Java import java.util java.applet java.awt java.applet Applet java.awt Graphics java.util Date public class WhatTime extends Applet{ "WhatTime" "extends Applet" Applet java.applet.applet Applet public void paint( Graphics g ){ paint() String s; Date d = new Date(); Date Date Date 32
35 Date s = d.tostring(); Date tostring() tostring()date Date d 15 g.drawstring( s, 10, 30 ); Graphics drawstring(, x, y ) } paint() } WhatTime 3 Java Applet Date Graphics WhatTime Java2 SDK Java2 API Sun Microsystems Web 16 Java 17 Q A Java2 SDK Standard Edition "javac" "WhatTime.java" 33
36 C: user>javac WhatTime.java Web Web Web HTML Hyper Text Markup Language HTML HTML HTML "WhatTime.html" HTML WhatTime.html 1 <APPLET CODE="WhatTime.class" WIDTH="320" HEIGHT="40"> 2 </APPLET> Web Web HTML <APPLET CODE="WhatTime.class" WIDTH="320" HEIGHT="40"> HTML "<" ">" Web APPLET APPLET CODE WIDTH HEIGHT </APPLET> APPLET WhatTime.html Web JDK appletviewer 18 34
37 C: user>appletviewer WhatTime.html appletviewer APPLET appletviewer 5.2 Version.2 Web WhatTime2.java 1 import java.applet.*; 2 import java.awt.*; 3 import java.util.*; 4 5 public class WhatTime2 extends Applet{ 6 public void init(){ 7 setbackground( Color.blue ); 8 Font f = new Font( "Serif", Font.BOLD, 14 ); 9 setfont( f ); 10 } public void paint( Graphics g ){ 13 String s; 14 Date d = new Date(); 15 s = d.tostring(); 16 g.setcolor( Color.cyan ); 17 g.drawstring( s, 10, 30 ); 18 } 19 } 35
38 public void init(){ init() setbackground( Color.blue ); "Color.blue"Color Color.white Color.lightGray Color.gray Color.darkGray Color.black Color.red Color.pink Color.orange Color.yellow Color.green Color.magenta Color.cyan Color.blue Color mycolor = new Color( int r, int g, int b ); r, g, b mycolor Color.blue Font f = new Font( "Serif", Font.BOLD, 14 ); Font Serif 36
39 setfont( f ); g.setcolor( Color.cyan ); HTML HTML WhatTime2.html 1 <APPLET CODE="WhatTime2.class" WIDTH="320" HEIGHT="40"> 2 </APPLET> InternetExplorer NetscapeNavigator 37
40 InternetExplorer NetscapeNavigator CTRL SHIFT 5.3 Version
41 WhatTime3.java 1 import java.applet.*; 2 import java.awt.*; 3 import java.util.*; 4 5 public class WhatTime3 extends Applet implements Runnable{ 6 Thread trd; 7 8 public void init(){ 9 setbackground( Color.white ); 10 Font f = new Font( "Dialog", Font.BOLD, 12 ); 11 setfont( f ); 12 } public void paint( Graphics g ){ 15 String s; 16 Date d = new Date(); 17 s = d.tostring(); 18 g.setcolor( Color.black ); 19 g.drawstring( s, 10, 30 ); 20 } public void run(){ 23 while( trd!= null ){ 24 try { 25 Thread.sleep( 1000 ); 26 } catch ( Exception e ) { 27 System.out.println( e ); 28 } 29 repaint(); 30 } 31 } public void start(){ 34 trd = new Thread( this ); 35 trd.start(); 36 } public void stop(){ 39
42 39 trd = null; 40 } 41 } public class WhatTime3 extends Applet implements Runnable{ "implements Runnable" "Runnable" Java "extends" 1 19 Java "Runnable" "MouseListener" "MouseMotionListener" "Runnable""void run()" Thread trd; Thread public void run(){ Runnable run while( trd!= null ){ trd null while trd 6 Thread null trd while try { 25 Thread.sleep() try-catch try{ } 20 catch{ }26 40
43 Thread.sleep( 1000 ); } catch ( Exception e ) { 24 try catch try{ } 1 21 catch Exception e Exception Exception System.out.println( e ); e repaint(); paint() public void start(){ init() trd = new Thread( this ); 6 Thread trd trd 6 trd.start(); run() public void stop(){ trd = null; run() while trd null while 41
44 repaint() HTML HTML WhatTime3.html 1 <APPLET CODE="WhatTime3.class" WIDTH="320" HEIGHT="40"> 2 </APPLET> 42
45 A C: user> jabac Sample.java 'jabac' "javac" jabac javac Sample.java C: user> javac Sanple.java : Sanple.java 1 C: user> javac Sample.jaba javac: Sample.jaba : javac <options> <source files> -g -g:none -g:{lines,vars,source} -O -nowarn -verbose -deprecation API -classpath <path> -sourcepath <path> -bootclasspath <path> -extdirs <dirs> -d <directory> -encoding <encoding> -target <release> VM 43
46 "Sample.java" javac Sample.java C: user> javac Sample.java Sample.java:3: : prjntln (java.lang.string) : java.io.printstream System.out.prjntln("This is a sample program."); ^ 1 Sample.java 3 prjntln println API 22 C: user> javac Sample2.java : Sample2.java API : -deprecation Java API Java Java "-deprecation" C: user>javac -deprecation Sample2.java Sample2.java:16: : java.awt.component resize(int,int) resize( 320, 60 ); ^
47 API 16 "resize(320,60)" API API API API Java2 SDK 23 Java2 API "resize( int, int )" resize public void resize(int width, int height) JDK 1.1 setsize(int,int) "resize(320,60)" "setsize(320,60)" Java2 SDK B C: user> jaba Sample 'jaba' "java" java Sample C: user> java Sumple Exception in thread "main" java.lang.noclassdeffounderror: Sumple C: user> java Sample.class Exception in thread "main" java.lang.noclassdeffounderror: Sample/class C: user> java Sample.java Exception in thread "main" java.lang.noclassdeffounderror: Sample/java 23 45
48 "Sample.class"java ".class" java Sample C: user> java Sample Exception in thread "main" java.lang.nosuchmethoderror: main 2 "public static void main( String args[] )" "String args[]""public static void main( )" "public static""void main( String args[] )" 46
49
50
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入門
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やさしい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 information10/ / /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
tutimura@mist.i.u-tokyo.ac.jp kaneko@ipl.t.u-tokyo.ac.jp 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アプレットの作成
- 1 - import java.applet.applet; import java.awt.graphics; public class HelloWorld extends Applet { public void init() { resize(150,60) ; public void paint ( Graphics g ) { g.drawstring("hello, world!",
More information解きながら学ぶ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 informationK227 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 informationJava プログラミング Ⅰ 3 回目変 数 今日の講義講義で学ぶ内容 変数とは 変数の使い方 キーボード入力の仕方 変 数 変 数 一時的に値を記憶させておく機能 変数は 型 ( データ型 ) と識別子をもちます 2 型 ( データ型 ) 変数に記憶する値の種類変数の型は 記憶できる値の種類と範囲
Java プログラミング Ⅰ 3 回目変 数 今日の講義講義で学ぶ内容 変数とは 変数の使い方 キーボード入力の仕方 変 数 変 数 一時的に値を記憶させておく機能 変数は 型 ( データ型 ) と識別子をもちます 2 型 ( データ型 ) 変数に記憶する値の種類変数の型は 記憶できる値の種類と範囲を決定します 次の型が利用でき これらの型は特に基本型とよばれます 基本型 値の種類 値の範囲 boolean
More informationJava演習(2) -- 簡単なプログラム --
Java public class Hello Hello (class) (field)... (method)... Java main Hello World(Hello.java) public class Hello { public static void main(string[ ] args) { public() (package) Hello World(Hello.java)
More informationr3.dvi
00 3 2000.6.10 0 Java ( 7 1 7 1 GSSM 1? 1 1.1 4 4a 4b / / 0 255 HTML X 0 255 16 (0,32,255 #0020FF Java xclock -bg #0020FF xclock ^C (Control C xclock 4c 1 import java.applet.applet; import java.awt.*;
More informationChapter 20. [ ] ; [ ] = new [ ] ; Color colors [ ] = new Color[ 20 ]; // 20 Button operations [ ] = new Button[ 10 ]; // 10 colors[ 3 ] = new Color( 1
Chapter 20. [ ] ; [ ] = new [ ] ; Color colors [ ] = new Color[ 20 ]; // 20 Button operations [ ] = new Button[ 10 ]; // 10 colors[ 3 ] = new Color( 10, 30, 40 ); gc.setcolor( colors[ 3 ] ); operations[
More informationJavaプログラミングⅠ
Java プログラミング Ⅰ 3 回目変数 今日の講義で学ぶ内容 変数とは 変数の使い方 キーボード入力の仕方 変 数 変 数 一時的に値を記憶させておく機能です 変数は 型 ( データ型ともいいます ) と識別子をもちます 2 型 変数に記憶できる値の種類です型は 値の種類に応じて次の 8 種類があり これを基本型といいます 基本型値の種類値の範囲または例 boolean 真偽値 true または
More information2 p.2 2 Java Hello0.class JVM Hello0 java > java Hello0.class Hello World! javac Java JVM java JVM : Java > javac 2> Q Foo.java Java : Q B
2 p.1 2 Java Java JDK Sun Microsystems JDK javac Java java JVM appletviewer IDESun Microsystems NetBeans, IBM 1 Eclipse 2 IDE GUI JDK Java 2.1 Hello World! 2.1.1 Java 2.1.1 Hello World Emacs Hello0.java
More informationLocal variable x y i paint public class Sample extends Applet { public void paint( Graphics gc ) { int x, y;... int i=10 ; while ( i < 100 ) {... i +=
Safari AppletViewer Web HTML Netscape Web Web 13-1 Applet Web Applet init Web paint Web start Web HTML stop destroy update init Web paint start Web update Event Driven paint Signature Overwriting Overriding
More information< F2D82518CC282CC D2E6A7464>
2 個のさいころ 1. はじめに [Java アプレット ] [Java アプリケーション ] 2 個のさいころを同時に投げたときの目の出方を考えてみましょう この 2 個のさいころをそれぞれ さいころ Ⅰ さいころ Ⅱ とすると その目の出方は順に 1 1 2 1 3 1 4 1 5 1 6 1 1 2 2 2 3 2 4 2 5 2 6 2 1 3 2 3 3 3 4 3 5 3 6 3 1 4
More informationJavaプログラミングⅠ
Java プログラミング Ⅰ 3 回目変数 今日の講義で学ぶ内容 変数とは 変数の使い方 キーボード入力の仕方 変 数 変 数 一時的に値を記憶させておく機能です 変数は 型 ( データ型ともいいます ) と識別子をもちます 2 型 変数に記憶できる値の種類です型は 値の種類に応じて次の 8 種類があり これを基本型といいます 基本型値の種類値の範囲または例 boolean 真偽値 true または
More informationJava 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< F2D834F838C A815B A CC>
グレゴリー ライプニッツの公式 [Java アプレット ] [Java アプリケーション ] 1. はじめに 次のグレゴリー ライプニッツの公式を用いて π の近似値を求めてみましょう [ グレゴリー ライプニッツの公式 ] π 4 =1-1 3 + 1 5-1 7 + 1 9-1 + 11 シミュレーションソフト グレゴリー ライプニッツの公式による π の近似 を使って π の近似値が求まる様子を観察してみてください
More informationJava (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< F2D B838A835882CC8CF68EAE2E6A7464>
ウォーリスの公式 [Java アプレット ] [Java アプリケーション ] 1. はじめに 次のウォーリスの公式を用いて π の近似値を求めてみましょう [ ウォーリスの公式 ] π=2{ 2 2 4 4 6 6 1 3 3 5 5 7 シミュレーションソフト ウォーリスの公式による π の近似 を使って π の近似値が求まる様子を観察してみてください 2.Java アプレット (1) Javaプログラムリスト
More informationr2.dvi
2002 2 2003.1.29 1 2.1-2.3 (1) (2) 2.4-2.6 (1)OO (2)OO / 2.7-2.10 (1)UML (2) Java 3.1-3.3 (1) (2)GoF (3)WebSphere (4) 3.4-3.5 3.6-3.9 Java (?) 2/12( ) 20:00 2 (2 ) 3 Java (?)1 java.awt.frame Frame 1 import
More informationSafari AppletViewer Web HTML Netscape Web Web 15-1 Applet Web Applet init Web paint Web start Web HTML stop destroy update init Web paint start Web up
Safari AppletViewer Web HTML Netscape Web Web 15-1 Applet Web Applet init Web paint Web start Web HTML stop destroy update init Web paint start Web update Event Driven paint Signature Overwriting Overriding
More informationMicrosoft PowerPoint - prog10.ppt
プログラミング言語 3 第 10 回 (2007 年 12 月 03 日 ) 1 今日の配布物 片面の用紙 1 枚 今日の課題が書かれています 本日の出欠を兼ねています 2/40 今日やること http://www.tnlab.ice.uec.ac.jp/~s-okubo/class/java06/ にアクセスすると 教材があります 2007 年 12 月 03 日分と書いてある部分が 本日の教材です
More information< F2D E E6A7464>
ピタゴラス数 [Java アプレット ] [Java アプリケーション ] 1. はじめに 2 2 2 三平方の定理 a +b =c を満たす3つの自然数の組 ( a, b, c) をピタゴラス数と言います ピタゴラス数の最も簡単な例として (3,4,5) がありますね このピタゴラス数を求めるには ピタゴラスの方法とプラトンの方法の2つの方法があります 2 2 ピタゴラス数 (a,b,c) に対して
More informationI. (i) Java? (A). 2Apples (B). Vitamin-C (C). Peach21 (D). Pine_Apple (ii) Java? (A). Java (B). Java (C). Java (D). JavaScript Java JavaScript Java (i
12 7 27 10:30 12:00 I. I VI II. III. IV. ( a d) V. VI. 80 100 60 : this==null, T == N A ActionListener A addactionlistener C class D actionperformed E ActionEvent G getsource I implements J JApplet K KeyListener
More informationMicrosoft PowerPoint prog1_doc2x.pptx
アプレット public class extends Applet { public void paint(graphics g) { // アプレット描画 g.drawstring( Hello World, 10, 20 ); page 1 アプレット : 色 public class extends Applet { Color col; // カラークラス int red, grn, blu;
More information< F2D89BA8EE882C E6A7464>
下手な鉄砲も数撃ちゃ当たる!! [Java アプレット ] [Java アプリケーション ] 1. はじめに 鉄砲を10 回撃つと1 回当たる腕前の人が鉄砲を撃ちます 下枠の [ 自動 10 回 ] または [ 自動 50 回 ] または [ 自動 100 回 ] をクリックすると それぞれ10 回 50 回 100 回 実験を繰り返します ただし 1 回の実験につき20 発の鉄砲を発射します シミュレーションソフト
More information< F2D82518E9F8AD CC834F CC8CFC82AB82C68D4C>
2 次関数のグラフの向きと広がり [Java アプレット ] [Java アプリケーション ] 1. はじめに 2 2 y=ax のグラフについて x の係数 aが正のときと負のときでは グラフにどのような違いがあるでしょうか 2 2 y=ax のグラフについて x の係数 aが正のとき 係数 aの値が大きくなるにつれて グラフの広がりはどうなるでしょうか 2 2 y=ax のグラフについて x の係数
More information2 p.2 2 Java Hello0.class JVM Hello0 java > java Hello0.class Hello World! javac Java JVM java JVM : Java > javac 2> Q Foo.java Java : Q B
2 p.1 2 Java Java JDK Sun Microsystems Oracle JDK javac Java java JVM appletviewer IDESun Microsystems NetBeans, IBM 1 Eclipse 2 IDE GUI JDK Java 2.1 Hello World! 2.1.1 Java 2.1.1 Hello World Emacs Hello0.java
More informationtry catch Exception Java try catch try { } catch ( Exception e ) { } e 16-1 try catch 0 try { int x = 0; int y = 10 / x; } catch ( Exception e ) { Sys
try catch Exception Java try catch catch ( Exception e ) { e 16-1 try catch 0 int x = 0; int y = 10 / x; catch ( Exception e ) { System.err.println( " " ); Copyright by Tatsuo Minohara 2004 Rev. C on Dec.
More informationMicrosoft PowerPoint - prog10.ppt
プログラミング言語 3 第 10 回 (2007 年 12 月 03 日 ) 1 今日の配布物 片面の用紙 1 枚 今日の課題が書かれています 本日の出欠を兼ねています 2/40 1 今日やること http://www.tnlab.ice.uec.ac.jp/~s-okubo/class/java06/ にアクセスすると 教材があります 2007 年 12 月 03 日分と書いてある部分が 本日の教材です
More information< F2D82518E9F8AD CC95BD8D7388DA93AE2E6A7464>
2 次関数のグラフの平行移動 [Java アプレット ] [Java アプリケーション ] 1. はじめに 2 2 y=ax のグラフとy=a(x-b) +c のグラフは 位置は違うけれど 形も広がりも全く同じです 2 2 y=a(x-b) +c のグラフは y=ax のグラフをx 軸方向に ( 右方向に ) +b y 軸方向に ( 上方向に ) +c だけ平行移動したものです 2 シミュレーションソフト
More information< F2D825282CC947B909482CC A815B83682E6A>
3 の倍数のトランプカード 1. はじめに [Java アプレット ] [Java アプリケーション ] ここにトランプが 1 組あります ジョーカー 2 枚を除いて 52 枚を使います 3 の倍数は スペード クローバ ダイヤ ハートに それぞれ 3 と 6 と 9 と 12 の 4 枚ずつあるので 4 4=16 枚あります この 52 枚のトランプから 1 枚引いたとき そのカードが 3 の倍数である確率を考えます
More informationApplet java.lang.object java.awt.component java.awt.container java.awt.panel java.applet.applet
13 Java 13.9 Applet 13.10 AppletContext 13.11 Applet java.lang.object java.awt.component java.awt.container java.awt.panel java.applet.applet Applet (1/2) Component GUI etc Container Applet (2/2) Panel
More informationI HTML HashMap (i) (ii) :.java import java.net.*; import java.io.*; import java.util.hashmap; public class SimpleStopWatch { public static voi
II Java 10 2 12 10:30 12:00 I. I III II. III. IV. ( a d) V. : this==null, T == N A ActionListener C class D actionperformed G getsource I implements K KeyListener J JApplet L addmouselistener M MouseListener
More information< F2D F B834E2E6A7464>
ランダムウォーク [Java アプレット ] [Java アプレリケーョン ] 1. はじめに 酔っぱらいは前後左右見境なくふらつきます 酔っぱらいは目的地にたどり着こうと歩き回っているうちに何度も同じところに戻って来てしまったりするものです 今 酔っぱらいが数直線上の原点にいるとします 原点を出発して30 回ふらつくとき 30 回目に酔っぱらいがいる位置は 出発点である原点からどれくらい離れてしまっているのでしょうか
More information< F2D82B682E182F182AF82F12E6A7464>
3 人のじゃんけん [Java アプレット ] [Java アプリケーション ] 1. はじめに A 君 B 君 C 君の 3 人でじゃんけんを 1 回するときの勝ち負けを考えてみましょう あいこの場合は A 君 B 君 C 君の順に グー グー グー チョキ チョキ チョキ パー パー パー グー チョキ パー グー パー チョキ チョキ グー パー チョキ パー グー パー グー チョキ パー
More information6 p.1 6 Java GUI GUI paintcomponent GUI mouseclicked, keypressed, actionperformed mouseclicked paintcomponent thread, 1 GUI 6.0.2, mutlithread C
6 p.1 6 Java GUI GUI paintcomponent GUI mouseclicked, keypressed, actionperformed mouseclicked paintcomponent 6.0.1 thread, 1 GUI 6.0.2, mutlithread CPU 1 CPU CPU +----+ +----+ +----+ Java 1 CPU 6 p.2
More information< F2D A839382CC906A2E6A7464>
ビュホンの針 1. はじめに [Java アプレット ] [Java アプリケーション ] ビュホン ( Buffon 1707-1788) は 針を投げて円周率 πを求めることを考えました 平面上に 幅 2aの間隔で 平行線を無数に引いておきます この平面上に長さ2bの針を落とすと この針が平行線と交わる確立 pは p=(2b) (aπ) 1 となります ただし b
More informationThread
14 2013 7 16 14.1....................................... 14 1 14.2 Thread................................... 14 1 14.3............................. 14 5 14.4....................................... 14 10
More information< F2D92DE82E8914B82CC977088D32E6A7464>
釣り銭の用意の実験 [Java アプレット ] [Java アプリケーション ] 1. はじめに クラス会などの幹事を務めることはありませんか 幹事になったつもりで考えてみてください 仮に クラス会への参加者人数は 35 人で 会費は 3500 円であるとします また 参加者は 1000 円札 4 枚でお釣りを必要とする人と 1000 円札 3 枚と 500 円玉 1 個でお釣りの要らない人の 2
More information< F2D A838B838D96402E6A7464>
モンテカルロ法 [Java アプレット ] [Java アプリケーション ] 1. はじめに 一辺の長さが 2 の正方形とそれに内接する半径 1 の円が紙に書かれています この紙の上からたくさんのゴマをばらまきます 正方形の中に入ったゴマの数と そのうちで円の中に入ったゴマの数も数えます さあ このゴマの数からどうやって円周率 π を求めるのでしょうか 一辺の長さ2の正方形の面積は4で
More informationKeyListener init addkeylistener addactionlistener addkeylistener addkeylistener( this ); this.addkeylistener( this ); KeyListener public void keytyped
KeyListener keypressed(keyevent e) keyreleased(keyevent e) keytyped(keyevent e) MouseListener mouseclicked(mouseevent e) mousepressed(mouseevent e) mousereleased(mouseevent e) mouseentered(mouseevent e)
More information< F2D8EA CE909482CC92EA82852E6A7464>
自然対数の底 e [Java アプレット ] [Java アプリケーション ] 1. はじめに 対数は 17 世紀にネイピアやビュルギといった数学者たちが生み出した関数である 円周率 πと自然対数の底 eとは密接な関係があり どちらも無理数で超越数 ( 整数係数の代数方程式の解にならない実数 ) である 1737 年 オイラーは eが無理数であることを示した 1873 年 フランスの数学者エルミートは
More informationMicrosoft PowerPoint prog1_doc2.pptx
2011 年 12 月 6 日 ( 火 ) プログラミング Ⅰ Java Applet プログラミング 文教大学情報学部経営情報学科堀田敬介 アプレット Applet public class クラス名 extends Applet { public void paint(graphics g) { // アプレット描画 g.drawstring( Hello World, 10, 20); 10
More informationJAVA入門
JAVA 入 門 後 期 3 JAVAのGUI (JavaのGUI 基 本 構 造 いろいろなアプレット) 1.GUI 構 造 GUI 構 造 JAVAでGUIを 構 築 するクラスとして 下 記 のがあります 1アプレットパッケージ 2AWT 3Swing 特 に2 3はコンポーネント パッケージを 利 用 1アプレット 概 要 特 徴 GUI 構 造 1. 最 初 から GUI 環 境 が 用
More informationJava 2 p.2 2 Java Hello0.class JVM Hello0 java > java Hello0.class Hello World! javac Java JVM java JVM : Java > javac 2> Q Foo.java Java : Q 2.
Java 2 p.1 2 Java Java JDK Sun Microsystems Oracle JDK javac Java java JVM appletviewer IDE Sun Microsystems NetBeans, IBM 1 Eclipse 2 IDE GUI JDK Java 2.1 Hello World! 2.1.1 Java 2.1.1 Hello World Emacs
More informationJava 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< F2D B825082CC96E291E82E6A7464>
3x+1 の問題 [Java アプレット ] [Java アプリケーション ] 1. はじめに どんな自然数から始めても良いので その数が偶数ならば2で割り 奇数ならば3 倍して1を加えることを繰り返します そうすると どんな自然数から始めても必ず1になるというのはほんとうなのでしょうか 例えば 11から始めると 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 となります
More informationChapter JDK KeyListener keypressed(keyevent e ) keyreleased(keyevent e ) keytyped(keyevent e ) MouseListener mouseclicked(mouseeven
Chapter 11. 11.1. JDK1.1 11.2. KeyListener keypressed(keyevent e ) keyreleased(keyevent e ) keytyped(keyevent e ) MouseListener mouseclicked(mouseevent e ) mousepressed(mouseevent e ) mousereleased(mouseevent
More informationr3.dvi
10 3 2010.9.21 1 1) 1 ( 1) 1: 1) 1.0.1 : Java 1 import java.awt.*; import javax.swing.*; public class Sample21 extends JPanel { public void paintcomponent(graphics g) { g.setcolor(new Color(255, 180, 99));
More informationvol.30.}...`.X...b.h
Manabu Nakamura mondo@its.hiroshima-cu.ac.jp q w e e e for (int i = 0; i < N; i++) { calculators[i] = new Calculator(); calculators[i].run(); 70 JAVA PRESS Vol.30 import java.math.biginteger; public class
More information-1 new ( ) ; Rectangle Java2 AWT window = new Frame( "Sample" ); rectangle = new Rectangle( 100, 50 ); // // = new ( ) ; Frame window = new Frame( "Sa
Template Instance Java new ; Frame Color AWT new Frame( "Sample" ); // Sample new Color( 244, 33, 111 ); // RGB 244, 33, 111 new Constructor ; Color frontcolor; // Color Graphics g; // Graphics Frame window;
More information2 p.2 2 Java Hello0.class JVM Hello0 java > java Hello0.class Hello World! javac Java JVM java JVM : Java > javac 2> Q Foo.java Java : Q B
2 p.1 2 Java Java JDK Sun Microsystems Oracle JDK javac Java java JVM appletviewer IDESun Microsystems NetBeans, IBM 1 Eclipse 2 IDE GUI JDK Java 2.1 Hello World! 2.1.1 Java 2.1.1 Hello World Emacs Hello0.java
More information2 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 information2
次の課題 1~7 の を埋めてプログラムを完成させよ 1. 整数型の配列に格納されたデータの総和を計算し, その結果を出力するプログラムである このプログラムの処理手順を次に示す 1 配列の格納するデータの個数 n (n>0) を入力する 2n の大きさで配列を確保する 3 配列に n 個分のデータを格納する 4 配列の総和を求める 5 総和を出力する import java.io.*; public
More informationColor frontcolor; // Color Graphics gc; // Graphics Frame window; // Frame Java 8-1 new ( ) ; Rectangle Java2 AWT window = new Frame( "Sample" ); rect
Chapter 8. 8.1. Template instance Java new ( ); Frame Color AWT new Frame( "Sample" ); // Sample new Color( 244, 33, 111 ); // RGB 244, 33, 111 new Constructor ; Copyright by Tatsuo Minohara 1999-2000
More informationJava学習教材
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< F2D BCA82CC978E89BA82CC8EC08CB12E6A7464>
パチンコ玉の落下の実験 [Java アプレット ] [Java アプリケーション ] 1. はじめに 1 個のパチンコ玉が釘に当たって左右に分かれながら落下するとき パチンコ玉はどこに落下するのでしょうか ただし パチンコ玉が釘に当たって左右に分かれるとき その分かれ方は左右半々であるとします パチンコ玉が落下し易い場所はあるのでしょうか それとも どこの場所も同じなのでしょうか シミュレーションソフト
More informationr1.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スライド 1
Web プログラミング 2 7. JSP と Servlet による Web プログラミング概要 ( 復習 )Web アプリケーションの実現方式 : 授業で扱う範囲 SSI (Server Side Include) C-Shellなど JSP (Java Server Pages) PHP など Web ブラウザ Internet Done Web サーバ Done JavaApplet JavaScript
More informationJava プログラミング Ⅰ 3 回目変数 変数 変 数 一時的に値を記憶させておく機能型 ( データ型 ) と識別子をもつ 2 型 ( データ型 ) 変数の種類型に応じて記憶できる値の種類や範囲が決まる 型 値の種類 値の範囲 boolean 真偽値 true / false char 2バイト文
Java プログラミング Ⅰ 3 回目変数 変数 変 数 一時的に値を記憶させておく機能型 ( データ型 ) と識別子をもつ 2 型 ( データ型 ) 変数の種類型に応じて記憶できる値の種類や範囲が決まる 型 値の種類 値の範囲 boolean 真偽値 true / false char 2バイト文字 0x0000 ~ 0xffff byte 1バイト整数 - 2 8 ~ 2 8-1 short 2バイト整数
More informationr6.dvi
I 2005 6 2005.11.18 1 1.1 2 Hello, World public class r5ex2 extends JApplet { Font fn = new Font("Helvetica", Font.BOLD, 24); g2.setfont(fn); for(int i = 0; i < 10; ++i) { g2.setpaint(new Color(100+i*5,
More informationII Java :30 12:00 I. I IV II. III. IV. ( a d) V. : this==null, T == N A ActionListener C class D actionperformed G getsource I implements K
II Java 09 2 13 10:30 12:00 I. I IV II. III. IV. ( a d) V. : this==null, T == N A ActionListener C class D actionperformed G getsource I implements K KeyListener J JApplet L addmouselistener M MouseListener
More informationProgramming-C-9.key
プログラミングC 第9回 例外 スレッド 白石路雄 2 finally try{ ( 例外が発生するかもしれない処理 ) catch(exception のクラス名 e){ ( 例外が発生した時の処理 ) finally{ ( 例外の発生の有無に関わらず 必ず行う処理 ) 3 Integer.parseInt() NumberFormatException
More informationJava プログラミング Ⅰ 7 回目 switch 文と論理演算子 今日の講義講義で学ぶ内容 switch 文 論理演算子 条件演算子 条件判断文 3 switch 文 switch 文 式が case のラベルと一致する場所から直後の break; まで処理しますどれにも一致致しない場合 def
Java プログラミング Ⅰ 7 回目 switch 文と論理演算子 今日の講義講義で学ぶ内容 switch 文 論理演算子 条件演算子 条件判断文 3 switch 文 switch 文 式が case のラベルと一致する場所から直後の まで処理しますどれにも一致致しない場合 default: から直後の まで処理します 式の結果 ラベル 定数 整数または文字 (byte, short, int,
More informationtext_10.dvi
C 10 13 6 18 10 Java(5) {, 1 10.1 10 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 1 10.2 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :
More informationColor.cyan, Color.yellow, Color.pink, Color.orange, Color.white, Color.black, Color.gray, Color.darkGray, Color.lightGray ; Button barray [ ] = new Bu
Chapter 18. [ ] ; [ ] = new [ ] ; Color colors [ ] = new Color[ 20 ]; // 20 Button operations [ ] = new Button[ 10 ]; // 10 colors[ 3 ] = new Color( 10, 30, 40 ); g.setcolor( colors[ 3 ] ); operations[
More information8 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 information3 p.1 3 Java Java Java try catch C Java if for while C 3.1 boolean Java if C if ( ) 1 if ( ) 1 else , 2 { } boolean true false 2 boolean Gr
3 p.1 3 Java Java Java try catch C Java if for while C 3.1 boolean Java if C if ( ) 1 if ( ) 1 else 2 1 1 2 2 1, 2 { boolean true false 2 boolean Graphics draw3drect fill3drect C int C OK while (1)...
More information2 p.2 2 Java > javac Hello0.java Hello0.class JVM Hello0 java > java Hello0.class Hello World! javac Java JVM java JVM : Java > javac 2> Q Foo.j
2 p.1 2 Java Java JDK Sun Microsystems Oracle JDK javac Java java JVM appletviewer IDESun Microsystems Oracle NetBeans, IBM 1 Eclipse 2, JetBrains IntelliJ IDEA IDE GUI JDK Java 2.1 Hello World! 2.1.1
More information問題1 以下に示すプログラムは、次の処理をするプログラムである
問題 1 次に示すプログラムは 配列 a の値を乱数で設定し 配列 a の値が 333 より大きく 667 以下の値 の合計値を求めるプログラムである 1 と 2 に適切なコードを記述してプログラムを完 成させよ class TotalNumber { public static void main(string[] args) { int[] a = new int[1000]; // 1 解答条件
More information:30 12:00 I. I VII II. III. IV. ( a d) V. VI : this==null, T == N A ActionListener A addactionlistener C class D actionperforme
2014 8 01 10:30 12:00 I. I VII II. III. IV. ( a d) V. VI. 80 100 60 : this==null, T == N A ActionListener A addactionlistener C class D actionperformed E ActionEvent G getsource I implements J JApplet
More informationAWT setcolor, drawstring Java AWT Abstract Window Toolkit Graphics AWT import import java.awt.* ; // AWT Graphics import java.awt.graphics; // AWT Gra
AWT setcolor, drawstring Java AWT Abstract Window Toolkit Graphics AWT import // AWT Graphics import java.awt.graphics; // AWT Graphics paint g x y ( x, y ) drawline( x, y, x, y ) ; g.drawline( 20, 30,
More informationJava 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:30 12:00 I. I VII II. III. IV. ( a d) V. VI : this==null, T == N A ActionListener A addactionlistener C class D actionperformed
10 7 30 10:30 12:00 I. I VII II. III. IV. ( a d) V. VI. 80 100 60 : this==null, T == N A ActionListener A addactionlistener C class D actionperformed E ActionEvent G getsource I implements J JApplet K
More informationr4.dvi
00 4 2000.6.24 0 GUI GUI GUI GUI 1 1.1 3 2 1 import java.applet.applet; import java.awt.*; public class r3ex2 extends Applet { Figure[] figs = new Figure[]{ new Circle(Color.blue, 100.0, 100.0, 30.0, 1.1,
More informationr8.dvi
I 2005 8 2005.12.9 GUI GUI ( ) GUI try... catch 1 1.1 2 1 2 paint() run() 1 Y 1 2 sin/cos 2 2 Color.getHSBColor() ( Circle setpaint() getpaint() ) import java.awt.*; import javax.swing.*; public class
More information(Eclipse\202\305\212w\202\324Java2\215\374.pdf)
C H A P T E R 11 11-1 1 Sample9_4 package sample.sample11; public class Sample9_4 { 2 public static void main(string[] args) { int[] points = new int[30]; initializearray(points); double averagepoint =
More information:30 12:00 I. I VII II. III. IV. ( a d) V. VI : this==null, T == N A ActionListener A addactionlistener C class D actionperformed
11 7 29 10:30 12:00 I. I VII II. III. IV. ( a d) V. VI. 80 100 60 : this==null, T == N A ActionListener A addactionlistener C class D actionperformed E ActionEvent G getsource I implements J JApplet K
More informationアプレットⅤ
アプレット Ⅴ JV5 今回の課題項目 アプレット ( シングルスレッド ) アプレット ( マルチスレッド ) アプレット ( スレッド処理 生成 起動 実行 停止 ) アプレット ( ダブルバッファリング ) ウィンドウ ( ウェイト ) 今回の重点項目 アプレット ( マルチスレッド ) アプレット ( ダブルバッファリング ) ウィンドウ ( ウェイト ) -1- アプレット マルチスレッド
More informationI. (i) Foo public (A). javac Foo.java java Foo.class (C). javac Foo java Foo (ii)? (B). javac Foo.java java Foo (D). javac Foo java Foo.class (A). Jav
2018 06 08 11:00 12:00 I. I III II. III. IV. ( a d) V. VI. 80 40 40 100 60 : A ActionListener aa addactionlistener AE ActionEvent K KeyListener ak addkeylistener KE KeyEvent M MouseListener am addmouselistener
More information: : : 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( ) p.1 x y y = ( x ) 1 γ γ = filtergamma.java import java.applet.*; public class filtergamma extends Applet{ Image img; Image new_img; publi
e001d 00 1 1 ( ) Figure 1: 1 shikaku.java import java.applet.*; public class shikaku extends Applet{ public void paint( Graphics g) { g.drawrect(,,0,0 ); // x(,) width = 0,height=0 g.drawrect(,,0,0 );
More informationJava プログラミング Ⅰ 7 回目 switch 文と論理演算子 条件判断文 3 switch 文 switch 文式が case の値と一致した場合 そこから直後の break; までを処理し どれにも一致しない場合 default; から直後の break; までを処理する 但し 式や値 1
Java プログラミング Ⅰ 7 回目 switch 文と論理演算子 条件判断文 3 switch 文 switch 文式が case の値と一致した場合 そこから直後の までを処理し どれにも一致しない場合 default; から直後の までを処理する 但し 式や値 1 値 2は整数または文字である switch( 式 ) case 値 1: // コロン : です セミコロン ; と間違えないように!!
More information情報技術 Java の特徴 Java は現在 事務処理計算用プログラミング言語として開発された COBOL に取って代わり C 言語や C++ と並んで 現在最も使われているプログラミング言語の一つである Java は Write Once, Run Anywhere( プログラムを一度作成したらど
情報技術 Java の特徴 Java は現在 事務処理計算用プログラミング言語として開発された COBOL に取って代わり C 言語や C++ と並んで 現在最も使われているプログラミング言語の一つである Java は Write Once, Run Anywhere( プログラムを一度作成したらどこでも動く ) という構想で設計されており 以下のような特徴を持つ 一度作成したら どんなプラットフォーム上でも動作する
More informationtext_13.dvi
C 13 2000 7 9 13 Java(8) { Swing(2)(, ) 1 13.1 13 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 1 13.2 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :
More information問題1 以下に示すプログラムは、次の処理をするプログラムである
問題 1 次のプログラムの出力結果を a~d の中から選べ public class Problem1 { int i=2; int j=3; System.out.println("i"+j); a) 23,b) 5,c) i3,d) ij 問題 2 次のプログラムの出力結果を a~d の中から選べ public class Problem2 { int a=6; if((a>=2)&&(a
More information:30 12:00 I. I VII II. III. IV. ( a d) V. VI : this==null, T == N A ActionListener A addactionlistener C class D actionperforme
2015 7 31 10:30 12:00 I. I VII II. III. IV. ( a d) V. VI. 80 100 60 : this==null, T == N A ActionListener A addactionlistener C class D actionperformed E ActionEvent G getsource I implements J JApplet
More information55 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 informationAWT setcolor, drawstring Java AWT Abstract Window Toolkit Graphics AWT import import java.awt.* ; // AWT Graphics import java.awt.graphics; // AWT Gra
AWT setcolor, drawstring Java AWT Abstract Window Toolkit Graphics AWT import // AWT Graphics import java.awt.graphics; // AWT Graphics paint g x y ( x, y ) drawline( x, y, x, y ) ; g.drawline( 20, 30,
More information教材ドットコムオリジナル教材 0から始めるiアフ リ リファレンス i アプリ簡易リファレンス ver i アプリ Java 独自のメソッド (1)iアプリの命令を使えるようにする import com.nttdocomo.ui.*; (2) 乱数を使う import java.u
i アプリ簡易リファレンス ver0.1.5.1 1.i アプリ Java 独自のメソッド (1)iアプリの命令を使えるようにする import com.nttdocomo.ui.*; (2) 乱数を使う import java.util.random; int ; Random =new Random(); =Math.abs(.nextInt()% ); 0~ まで乱数を発生させます (3) 機種ごとの縦横幅を調べる
More information<4D F736F F D20566F F6E658C6791D FE382C582CC4A D834F E F8F4390B394C52E646F63>
imai@eng.kagawa-u.ac.jp (Tel: 087-864-2244(FAX )) Vodafone( J-Phone) (J-SA51 090-2829-9999) JavaTM ( Vappli ) SUN ( SUN ) Java2SE(J2SDK1.3.1 Java Standard Edition) Java2MEforCLDC(WTK1.04 Wireless Tool
More information明解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コーディング基準.PDF
Java Java Java Java.java.class 1 private public package import / //////////////////////////////////////////////////////////////////////////////// // // // // ////////////////////////////////////////////////////////////////////////////////
More informationIE6 2 BMI chapter1 Java 6 chapter2 Java 7 chapter3 for if 8 chapter4 : BMI 9 chapter5 Java GUI 10 chapter6 11 chapter7 BMI 12 chap
1-1 1-2 IE6 2 BMI 3-1 3-2 4 5 chapter1 Java 6 chapter2 Java 7 chapter3 for if 8 chapter4 : BMI 9 chapter5 Java GUI 10 chapter6 11 chapter7 BMI 12 chapter8 : 13-1 13-2 14 15 PersonTest.java KazuateGame.java
More informationWeb 1 p.2 1 Servlet Servlet Web Web Web Apache Web Servlet JSP Web Apache Tomcat Jetty Apache Tomcat, Jetty Java JDK, Eclipse
Web 1 p.1 1 Servlet 1.1 Web Web WWW HTML CGI Common Gateway Interface Web HTML Web Web CGI CGI CGI Perl, PHP C Java Applet JavaScript Web CGI HTML 1.2 Servlet Java Servlet Servlet CGI Web CGI 1 Java Java
More informationclass 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<4D F736F F F696E74202D AC C8899E D834F E >
Java 簡単な応用プログラム ( その 2) Java は すでにある部品群を上手く使ってプログラムを組み立てます 前回と同様に Frame を使って ウインドウを表示するプログラムを作りましょう. Frameは ウインドウを作るための部品で フレーム ( 枠 ) とタイトルおよび, 決められた仕組みが入っています. java.awt パッケージは, ウインドウ関連の部品が多くあります. javax.swing
More informationJavaハンドブック
Java ハンドブック (C) Copyright 2002-2004 ( 株 ) 永和システムマネジメント オブジェクト倶楽部天野勝 m-amano@esm.co.jp 初版 2002 年 11 月 1 日第 2 版 2002 年 11 月 21 日第 3 版 2004 年 11 月 19 日 オリジナル :http://www.objectclub.jp/technicaldoc/java/javahandbook.doc
More information