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

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

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

新・明解Java入門

解きながら学ぶJava入門編

JavaプログラミングⅠ

JavaプログラミングⅠ

K227 Java 2

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

Java updated

情報技術 Java の特徴 Java は現在 事務処理計算用プログラミング言語として開発された COBOL に取って代わり C 言語や C++ と並んで 現在最も使われているプログラミング言語の一つである Java は Write Once, Run Anywhere( プログラムを一度作成したらど

Java演習(9) -- クラスとメソッド --

r3.dvi

アプレットの作成

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

解きながら学ぶC++入門編

8 if switch for while do while 2

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

Applet java.lang.object java.awt.component java.awt.container java.awt.panel java.applet.applet

コーディング基準.PDF

Java学習教材

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

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

(Eclipse\202\305\212w\202\324Java2\215\374.pdf)

226

Java講座

< F2D F B834E2E6A7464>

: : : TSTank 2

目的 泡立ち法を例に Comparableインターフェイスの実装 抽象クラスの利用 型パラメタの利用 比較 入替 の回数を計測

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

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

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

2 static final int DO NOTHING ON CLOSE static final int HIDE ON CLOSE static final int DISPOSE ON CLOSE static final int EXIT ON CLOSE void setvisible

I HTML HashMap (i) (ii) :.java import java.net.*; import java.io.*; import java.util.hashmap; public class SimpleStopWatch { public static voi

VB.NETコーディング標準

< F2D825282CC947B909482CC A815B83682E6A>

< F2D82518CC282CC D2E6A7464>

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

I java A

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

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

シミュレーションの簡単な例 GUI 無しのシミュレーションを作る GUI を作る パラメタを設定するデモンストレーションをする 2 オブジェクト指向プログラミング特論

Condition DAQ condition condition 2 3 XML key value

intra-mart Accel Platform — イベントナビゲータ 開発ガイド   初版   None

intra-mart Accel Platform — イベントナビゲータ 開発ガイド   初版  

r1.dvi

ALG ppt

For_Beginners_CAPL.indd

Local 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 +=

untitled

/ ( ) 8/7/ :21 p.2/64

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 B

SystemC言語概論

Chapter JDK KeyListener keypressed(keyevent e ) keyreleased(keyevent e ) keytyped(keyevent e ) MouseListener mouseclicked(mouseeven

Java 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.

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

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

KeyListener init addkeylistener addactionlistener addkeylistener addkeylistener( this ); this.addkeylistener( this ); KeyListener public void keytyped

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 { } boolean true false 2 boolean Gr

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

r02.dvi

untitled

Transcription:

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 JApplet { public void paint(graphics g){ g.drawrect( 20, 20, 50, 20); g.drawrect( 90, 20, 50, 20); g.drawrect(160, 20, 50, 20); g.drawrect(230, 20, 50, 20); g.drawrect(300, 20, 50, 20); 10 } }

50 10 10 10 (20, 20) (reserved

(variable) (type) 50 20 20 5 (reserved

Blocks2.java import javax.swing.japplet; import java.awt.graphics; public class Blocks2 extends JApplet { public void paint(graphics g){ int w = 50, h = 20, x = 20, y = 20, space = 20; g.drawrect(x, y, w, h); x = x + w + space; 10 g.drawrect(x, y, w, h); (reserved } } x = x + w + space; g.drawrect(x, y, w, h); x = x + w + space; g.drawrect(x, y, w, h); x = x + w + space; g.drawrect(x, y, w, h); 20

...... int() (e.g. -20, 10) float, double() (e.g. -1.23, 3.4) ; (e.g. int x;),,...; (e.g. int x, y, z;) () = ; (e.g. x = 3;, x = a + b;) (reserved

int() 1, 12, -50 float, double 1.23, -10.5 () char() a, x, Z boolean( ) true false (reserved

boolean true false byte 8bit short 16bit int 32bit ( 2 31 2 31 1) long 64bit ( 2 63 2 63 1) char 16bit Unicode float 32bit double 64bit (reserved

(declaration) ; int a;,,... ; double avg1, val x; (reserved

( ) camel case() = ; =... (assignment) (reserved

(reserved () 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 while (reserved

50 10 10 10 (20, 20) (reserved

gif a (10, 10) a (http://ushikai.com/index.htm) web (reserved

ImagePut.java (1)(ImagePut.java) import javax.swing.japplet; import javax.swing.imageicon; import java.awt.graphics; public class ImagePut extends JApplet { ImageIcon icon; (reserved public void init(){ icon = new ImageIcon(getImage(getCodeBase(), "den1s.gif")); } 10 } public void paint(graphics g) { icon.painticon(this, g, 10, 10); }

ImagePut.java 2 java.swing ImageIcon 6 ImageIcon icon ImagePut (reserved ()

ImagePut.java 9 getcodebase applet URL URL http://www.img.cs.titech.ac.jp/ rocky/imageput.html applet URL http://www.img.cs.titech.ac.jp/ rocky/ Image getimage(url url, String name) URL name ImageIcon(Image image) Image ImageIcon (reserved 12 painticon(component c, Graphics g, int x, int y) Component: applet (this) Graphics: (x, y):

ImagePut.java 8 init applet (reserved

gif (10, 10) (reserved

ImagePutBox.java (2)(ImagePutBox.java) import javax.swing.japplet; import javax.swing.imageicon; import java.awt.graphics; public class ImagePutBox extends JApplet { ImageIcon icon; int w, h; public void init(){ icon = new ImageIcon(getImage(getCodeBase(), "den1s.gif")); 10 w = icon.geticonwidth(); h = icon.geticonheight(); } (reserved } public void paint(graphics g) { icon.painticon(this, g, 10, 10); g.drawrect(10, 10, w, h); }

ImagePutBox.java 7 (w) (h) 11, 12 geticonwidth geticonheight icon (reserved

gif 5 (reserved