javaexample-02.pdf

Size: px
Start display at page:

Download "javaexample-02.pdf"

Transcription

1 n e w. s t a t i c s t a t i c 3 1

2 3 2 p u b l i c p r i v a t e p r o t e c t e d j a v a. l a n g. O b j e c t O b j e c t Rect R e c t x 1 y 1 x 2 y 2 R e c t t o S t r i n g ( ) j a v a. l a n g. O b j e c t R e c t t o S t r i n g ( ) t o S t r i n g ( ) R e c t S t r i n g R e c t 2-1 R e c t. j ava package com.davidflanagan.examples.classes; * * Rect public class Rect { // public int x1, y1, x2, y2; * *

3 3 3 public Rect(int x1, int y1, int x2, int y2) { this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; * public Rect(int width, int height) { this(0,0,width,height); public Rect() { this(0,0,0,0); public void move(int deltax, int deltay) { x1 += deltax; x2 += deltax; y1 += deltay; y2 += deltay; public boolean isinside(int x, int y) { return ((x >= x1) && (x <= x2) && (y >= y1) && (y <= y2)); * union * public Rect union(rect r) { return new Rect((this.x1 < r.x1)? this.x1 : r.x1, (this.y1 < r.y1)? this.y1 : r.y1, (this.x2 > r.x2)? this.x2 : r.x2, (this.y2 > r.y2)? this.y2 : r.y2);

4 R e c t. j ava * intersection * public Rect intersection(rect r) { Rect result = new Rect((this.x1 > r.x1)? this.x1 : r.x1, (this.y1 > r.y1)? this.y1 : r.y1, (this.x2 < r.x2)? this.x2 : r.x2, (this.y2 < r.y2)? this.y2 : r.y2); if (result.x1 > result.x2) { result.x1 = result.x2 = 0; if (result.y1 > result.y2) { result.y1 = result.y2 = 0; return result; * Object * Rect + * System.out.println() public String tostring() { return "[" + x1 + "," + y1 + "; " + x2 + "," + y2 + "]"; Rect R e c t T e s t R e c t R e c t n e w R e c t () R e c t R e c t + R e c t t o S t r i n g ()

5 R e c t Te s t. j ava package com.davidflanagan.examples.classes; Rect public class RectTest { public static void main(string[] args) { Rect r1 = new Rect( 1, 1, 4, 4); // Rect Rect r2 = new Rect( 2, 3, 5, 6); Rect u = r1.union(r2); // Rect Rect i = r2.intersection(r1); if (u.isinside(r2.x1, r2.y1)) // Rect Rect System.out.println("(" + r2.x1 + "," + r2.y1 + ") is inside the union"); // Rect.toString() System.out.println(r1 + " union " + r2 + " = " +u); System.out.println(r1 + " intersect " + r2 + " = " + i); Rect R e c t D r a w a b l e R e c t R e c t d r a w () j a v a. a w t. G r a p h i c s G r a p h i c s D r a w a b l e R e c t R e c t e x t e n d s R e c t D r a w a b l e R e c t 2-3 D rawabl e R e c t. j ava package com.davidflanagan.examples.classes; * Rect * Rect * java.awt.graphics

6 D rawab l e R e c t. j ava public class DrawableRect extends Rect { DrawableRect Rect() public DrawableRect(int x1, int y1, int x2, int y2) { super(x1,y1,x2,y2); DrawableRect public void draw(java.awt.graphics g) { g.drawrect(x1, y1, (x2 - x1), (y2 - y1)); C o l o r e d R e c t D r a w a b l e R e c t R e c t D r a w a b l e R e c t R e c t O b j e c t C o l o r e d R e c t j a v a. a w t. C o l o r C o l o r e d R e c t D r a w a b l e R e c t d r a w () C o l o r e d R e c t d r a w () D r a w a b l e R e c t 2-4 C o l o re d R e c t. j ava package com.davidflanagan.examples.classes; import java.awt.*; * DrawableRect public class ColoredRect extends DrawableRect { // // x1 y1 x2 y2 super-superclass Rect protected Color border, fill;

7 3 7 * super() * public ColoredRect(int x1, int y1, int x2, int y2, Color border, Color fill) { super(x1, y1, x2, y2); this.border = border; this.fill = fill; * draw() public void draw(graphics g) { g.setcolor(fill); g.fillrect(x1, y1, (x2 - x1), (y2 - y1)); g.setcolor(border); g.drawrect(x1, y1, (x2 - x1), (y2 - y1)); C o m p l e x N u m b e r d o u b l e p r i v a t e r e a l () i m a g i n a r y () C o m p l e x N u m b e r C o m p l e x N u m b e r

8 3 8 C o m p l e x N u m b e r a d d () m u l t i p l y () a d d () C o m p l e x N u m b e r C o m p l e x N u m b e r C o m p l e x N u m b e r ComplexNumber sum = a.add(b); ComplexNumber sum = ComplexNumber.add(a, b); 2-5 C o m p l ex N u m b e r. j ava package com.davidflanagan.examples.classes; public class ComplexNumber { // ComplexNumber double x y // // real() imaginary() private double x, y; x y public ComplexNumber(double real, double imaginary) { this.x = real; this.y = imaginary; * * setreal() * ComplexNumber public double real() { return x; public double imaginary() { return y;

9 3 9 public double magnitude() { return Math.sqrt(x*x + y*y); * ComplexNumber * Object * System.out.println() public String tostring() { return "{" + x + "," + y + ""; * * this * * ComplexNumber c = ComplexNumber.add(a, b) public static ComplexNumber add(complexnumber a, ComplexNumber b) { return new ComplexNumber(a.x + b.x, a.y + b.y); * * * ComplexNumber c = a.add(b); public ComplexNumber add(complexnumber a) { return new ComplexNumber(this.x + a.x, this.y + a.y); public static ComplexNumber multiply(complexnumber a, ComplexNumber b) { return new ComplexNumber(a.x*b.x - a.y*b.y, a.x*b.y + a.y* b.x); public ComplexNumber multiply(complexnumber a) { return new ComplexNumber(x*a.x - y*a.y, x*a.y + y*a.x);

10 4 0 R a n d o m i z e r R a n d o m i z e r s e e d F a c t o r i a l. f a c t o r i a l () f a c t o r i a l () R a n d o m i z e r r a n d o m () R a n d o m i z e r s e e d R a n d o m i z e r s t a t i c f i n a l s t a t i c f i n a l 2-6 R a n d o m i z e r. j ava package com.davidflanagan.examples.classes; * * public class Randomizer { // static final static final int m = ; static final int a = 9301; static final int c = 49297; // Randomizer long seed = 1;

11 4 1 * Randomizer * pseudo-randomness public Randomizer(long seed) { this.seed = seed; * 0 1 * Math.random() java.util.random public float randomfloat() { seed = (seed * a + c) % m; return (float)seed / (float)m; * 0 * randomfloat() public int randomint(int max) { return Math.round(max * randomfloat()); * 10 * Randomizer public static class Test { public static void main(string[] args) { Randomizer r = new Randomizer(new java.util.date().gettime()); for(int i = 0; i < 10; i++) System.out.println(r.randomInt(100));

12 4 2 R a n d o m i z e r T e s t R a n d o m i z e r. T e s t m a i n () R a n d o m i z e r R a n d o m i z e r. T e s t % java Randomizer.Test R a n d o m i z e r. T e s t $ % java Randomizer$Test $ \ % java Randomizer\$Test % java 'Randomizer$Test' a d d D a t u m () A v e r a g e r R a n d o m i z e r A v e r a g e r A v e r a g e r A v e r a g e r R a n d o m i ze r. j av a p a c k a g e % j a v a c o m. d a v i d f l a n a g a n. e x a m p l e s. c l a s s e s. R a n d o m i z e r $ T e s t

13 4 3 m a i n ( ) T e s t A v e r a g e r 2-7 Ave rage r. j ava package com.davidflanagan.examples.classes; * public class Averager { // private int n = 0; private double sum = 0.0, sumofsquares = 0.0; * public void adddatum(double x) { n++; sum += x; sumofsquares += x * x; adddatum() public double getaverage() { return sum/n; adddatum() public double getstandarddeviation() { return Math.sqrt(((sumOfSquares - sum*sum/n)/n)); adddatum() public double getnum() { return n; adddatum() public double getsum() { return sum; adddatum()

14 Ave rage r. j ava public double getsumofsquares() { return sumofsquares; Averager public void reset() { n = 0; sum = 0.0; sumofsquares = 0.0; * * public static class Test { public static void main(string args[]) { Averager a = new Averager(); for(int i = 1; i <= 100; i++) a.adddatum(i); System.out.println("Average: " + a.getaverage()); System.out.println("Standard Deviation: " + a.getstandarddeviation()); System.out.println("N: " + a.getnum()); System.out.println("Sum: " + a.getsum()); System.out.println("Sum of squares: " + a.getsumofsquares()); L i n k e d L i s t L i n k a b l e L i n k e d L i s t L i n k a b l e i m p l e m e n t s L i n k a b l e L i n k a b l e L i n k e d L i s t L i n k a b l e

15 4 5 j a v a. u t i l. L i n k e d L i s t L i n k e d L i s t L i n k e d L i s t h e a d L i n k a b l e L i n k a b l e L i n k e d L i s t L i n k a b l e L i n k e d L i s t T e s t L i n k e d L i s t T e s t L i n k a b l e I n t e g e r L i n k a b l e I n t e g e r L i n k a b l e 2-8 L i n ke d L i s t. j ava package com.davidflanagan.examples.classes; * Linkable * * public class LinkedList { public interface Linkable { public Linkable getnext(); // public void setnext(linkable node); // // public LinkedList() { Linkable head; node

16 L i n ke d L i s t. j ava public synchronized Linkable gethead() { return head; public synchronized void insertathead(linkable node) { node.setnext(head); head = node; public synchronized void insertattail(linkable node) { if (head == null) head = node; else { Linkable p, q; for(p = head; (q = p.getnext())!= null; p = q); p.setnext(node); public synchronized Linkable removefromhead() { Linkable node = head; if (node!= null) { head = node.getnext(); node.setnext(null); return node; public synchronized Linkable removefromtail() { if (head == null ) return null; Linkable p = head, q = null, next = head.getnext(); if (next == null) { head = null; return p;

17 4 7 while((next = p.getnext())!= null) { q = p; p = next; q.setnext(null); return p; * * equals() == public synchronized void remove(linkable node) { if (head == null) return; if (node.equals(head)) { head = head.getnext(); return; Linkable p = head, q = null; while((q = p.getnext())!= null) { if (node.equals(q)) { p.setnext(q.getnext()); return; p = q; * main() LinkedList public static class Test { Linkable static class LinkableInteger implements Linkable { int i; // Linkable next; // public LinkableInteger(int i) { this.i = i; public Linkable getnext() { return next; // // Linkable

18 L i n ke d L i s t. j ava public void setnext(linkable node) { next = node; // Linkable public String tostring() { return i + ""; // public boolean equals(object o) { // if (this == o) return true; if (!(o instanceof LinkableInteger)) return false; if (((LinkableInteger)o).i == this.i) return true; return false; * * public static void main(string[] args) { LinkedList ll = new LinkedList(); ll.insertathead(new LinkableInteger(1)); ll.insertathead(new LinkableInteger(2)); ll.insertathead(new LinkableInteger(3)); ll.insertathead(new LinkableInteger(4)); ll.insertattail(new LinkableInteger(5)); ll.insertattail(new LinkableInteger(6)); System.out.println(ll.removeFromHead()); System.out.println(ll.removeFromTail()); ll.remove(new LinkableInteger(2)); // // // // // // for(linkable l = ll.gethead(); l!= null; l = l.getnext()) System.out.println(1);

19 4 9 S o r t e r S o r t e r s o r t () s o r t () s o r t () j a v a. u t i l. L o c a l e j a v a. t e x t. C o l l a t o r j a v a. t e x t. C o l l a t i o n K e y S o r t e r S o r t e r C o m p a r e r C o m p a r a b l e C o m p a r e r s o r t () C o m p a r e r c o m p a r e () C o m p a r e r C o m p a r a b l e c o m p a r e T o () j a v a. u t i l. A r r a y s s o r t () j a v a. u t i l. C o l l e c t i o n s s o r t () j a v a. u t i l. L i s t A r r a y s C o l l e c t i o n s j a v a. u t i l. C o m p a r a t o r j a v a. l a n g. C o m p a r a b l e C o m p a r e r C o m p a r a b l e T e s t

20 S o rt e r. j ava package com.davidflanagan.examples.classes; // import java.text.collator; import java.text.collationkey; import java.util.locale; * String * public class Sorter { * compare() * Comparer * compare() public static interface Comparer { * * if (a > b) return > 0; * if (a == b) return 0; * if (a < b) return < 0; public int compare(object a, Object b); * * Comparable * compareto() public static interface Comparable { * * if (this > other) return > 0; * if (this == other) return 0;

21 5 1 * if (this < other) return <0; public int compareto(object other); * Comparer * ASCII sortascii private static Comparer ascii_comparer = new Comparer() { public int compare(object a, Object b) { return ((String)a).compareTo((String)b); ; * Comparer Comparable * sort() private static Comparer comparable_comparer = new Comparer() { public int compare(object a, Object b) { return ((Comparable)a).compareTo(b); ; ASCII public static void sortascii(string[] a) { // ascii_comparer sort(a, null, 0, a.length-1, true, ascii_comparer); * up ASCII public static void sortascii(string[] a, int from, int to, boolean up) { // ascii_comparer sort(a, null, from, to, up, ascii_comparer);

22 S o rt e r. j ava ASCII public static void sortasciiignorecase(string[] a) { sortasciiignorecase(a, 0, a.length-1, true); * ASCII * up true public static void sortasciiignorecase(string[] a, int from, int to, boolean up) { if ((a == null) (a.length < 2)) return; // String b[] = new String[a.length]; for(int i = 0; i < a.length; i++) b[i] = a[i].tolowercase(); // // ascii_comparer sort(b, a, from, to, up, ascii_comparer); * locale collation order * public static void sort(string[] a) { sort(a, 0, a.length-1, true, false, null); * * up true * ignorecase true public static void sort(string[] a, int from, int to, boolean up, boolean ignorecase) { sort(a, from, to, up, ignorecase, null);

23 5 3 * * up true * ignorecase true public static void sort(string[] a, int from, int to, boolean up, boolean ignorecase, Locale locale) { // if ((a == null) (a.length < 2)) return; // java.text.collator // Collator c; if (locale == null) c = Collator.getInstance(); else c = Collator.getInstance(locale); // // JDK American English // if (ignorecase) c.setstrength(collator.secondary); // Collator CollationKey // CollationKey String CollationKey[] b = new CollationKey[a.length]; for(int i = 0; i < a.length; i++) b[i] = c.getcollationkey(a[i]); // Comparer CollationKey Comparer comp = new Comparer() { public int compare(object a, Object b) { return ((CollationKey)a).compareTo((CollationKey)b); ; // CollationKey // sort(b, a, from, to, up, comp);

24 S o rt e r. j ava Comparable public static void sort(comparable[] a) { sort(a, null, 0, a.length-1, true); * Comparable * up true public static void sort(comparable[] a, int from, int to, boolean up) { sort(a, null, from, to, up, comparable_comparer); * Comparable * up true * a b public static void sort(comparable[] a, Object[] b, int from, int to, boolean up) { sort(a, b, from, to, up, comparable_comparer); * Comparer c * public static void sort(object[] a, Comparer c) { sort(a, null, 0, a.length-1, true, c); * Comparer c * up true

25 5 5 public static void sort(object[] a, int from, int to, boolean up, Comparer c) { sort(a, null, from, to, up, c); * sort() routine * from to a * up true false * Comparer c * a b public static void sort(object[] a, Object[] b, int from, int to, boolean up, Comparer c) { // sort if ((a == null) (a.length < 2)) return; // // // // // // Comparer compare() int i = from, j = to; Object center = a[(from + to) / 2]; do { if (up) { // while((i < to) && (c.compare(center, a[i]) > 0)) i++; while((j > from) && (c.compare(center, a[j]) < 0)) j--; else { // while(( i < to) && (c.compare(center, a[i]) < 0)) i++; while((j > from) && (c.compare(center, a[j]) > 0)) j--; if (i < j) { Object tmp = a[i]; a[i] = a[j]; a[j] = tmp; // if (b!= null) { tmp = b[i]; b[i] = b[j]; b[j] = tmp; //

26 S o rt e r. j ava if (i <= j) { i++; j--; while(i <= j); if (from < j) sort(a, b, from, j, up, c); // if ( i < to) sort(a, b, i, to, up, c); * * Sorter ComplexNumber public static class Test { * ComplexNumber Comparable * compareto() * magnitude * static class SortableComplexNumber extends ComplexNumber implements Sorter.Comparable { public SortableComplexNumber(double x, double y) { super(x, y); public int compareto(object other) { return sign(this.magnitude() - ((ComplexNumber)other).magnitude()); public static void main(string[] args) { // SortableComplexNumber SortableComplexNumber[] a = new SortableComplexNumber[5]; for(int i = 0; i < a.length; i++) a[i] = new SortableComplexNumber(Math.random() *10, Math.random()*10); // SortableComplexNumber compareto() System.out.println("Sorted by magnitude:"); Sorter.sort(a);

27 5 7 for(int i = 0; i < a.length; i++) System.out.println(a[i]); // Comparer // System.out.println("Sorted by sum of their real and imaginary parts:"); Sorter.sort(a, new Sorter.Comparer() { public int compare(object a, Object b) { ComplexNumber i = (ComplexNumber)a, j = (ComplexNumber)b; return sign((i.real() + i.imaginary()) - (j.real() + j.imaginary())); ); for(int i = 0; i < a.length; i++) System.out.println(a[i]); // Comparer // System.out.println("Sorted descending by real part, then imaginary:"); Sorter.sort(a, 0, a.length-1, false, new Sorter.Comparer() { public int compare(object a, Object b) { ComplexNumber i = (ComplexNumber) a, j = (ComplexNumber) b; double result = i.real() - j.real(); if (result == 0) result = i.imaginary() - j.imaginary(); return sign(result); ); for(int i = 0; i < a.length; i++) System.out.println(a[i]); sort public static int sign(double x) { if (x > 0) return 1; else if (x < 0) return -1; else return 0;

28 5 8 R e c t C i r c l e m o v e () i s I n s i d e () b o u n d i n g B o x () C i r c l e R e c t t o S t r i n g () S o r t. C o m p a r e r S o r t. C o m p a r a b l e S e a r c h s e a r c h () s e a r c h ()

新・解きながら学ぶJava

新・解きながら学ぶJava 481! 41, 74!= 40, 270 " 4 % 23, 25 %% 121 %c 425 %d 121 %o 121 %x 121 & 199 && 48 ' 81, 425 ( ) 14, 17 ( ) 128 ( ) 183 * 23 */ 3, 390 ++ 79 ++ 80 += 93 + 22 + 23 + 279 + 14 + 124 + 7, 148, 16 -- 79 --

More information

KillTest 质量更高 服务更好 学习资料 半年免费更新服务

KillTest 质量更高 服务更好 学习资料   半年免费更新服务 KillTest 质量更高 服务更好 学习资料 http://www.killtest.cn 半年免费更新服务 Exam : 310-055Big5 Title : Sun Certified Programmer for the Java 2 Platform.SE 5.0 Version : Demo 1 / 22 1. 11. public static void parse(string str)

More information

Microsoft Word - 01.DOC

Microsoft Word - 01.DOC 第 1 章 JavaScript 简 介 JavaScript 是 NetScape 公 司 为 Navigator 浏 览 器 开 发 的, 是 写 在 HTML 文 件 中 的 一 种 脚 本 语 言, 能 实 现 网 页 内 容 的 交 互 显 示 当 用 户 在 客 户 端 显 示 该 网 页 时, 浏 览 器 就 会 执 行 JavaScript 程 序, 用 户 通 过 交 互 式 的

More information

KillTest 质量更高 服务更好 学习资料 半年免费更新服务

KillTest 质量更高 服务更好 学习资料   半年免费更新服务 KillTest 质量更高 服务更好 学习资料 http://www.killtest.cn 半年免费更新服务 Exam : 310-065Big5 Title : Sun Certified Programmer for the Java 2 Platform, SE 6.0 Version : Demo 1 / 14 1. 35. String #name = "Jane Doe"; 36. int

More information

Java java.lang.math Java Java.util.Random : ArithmeticException int zero = 0; try { int i= 72 / zero ; }catch (ArithmeticException e ) { // } 0,

Java java.lang.math Java Java.util.Random : ArithmeticException int zero = 0; try { int i= 72 / zero ; }catch (ArithmeticException e ) { // } 0, http://debut.cis.nctu.edu.tw/~chi Java java.lang.math Java Java.util.Random : ArithmeticException int zero = 0; try { int i= 72 / zero ; }catch (ArithmeticException e ) { // } 0, : POSITIVE_INFINITY NEGATIVE_INFINITY

More information

2009年3月全国计算机等级考试二级Java语言程序设计笔试试题

2009年3月全国计算机等级考试二级Java语言程序设计笔试试题 2009 年 3 月 全 国 计 算 机 等 级 考 试 笔 试 试 卷 二 级 Java 语 言 程 序 设 计 ( 考 试 时 间 90 分 钟, 满 分 100 分 ) 一 选 择 题 ( 每 题 2 分, 共 70 分 ) 下 列 各 题 A) B) C) D) 四 个 选 项 中, 只 有 一 个 选 项 是 正 确 的 请 将 正 确 选 项 填 涂 在 答 题 卡 相 应 位 置 上,

More information

(TestFailure) JUnit Framework AssertionFailedError JUnit Composite TestSuite Test TestSuite run() run() JUnit

(TestFailure) JUnit Framework AssertionFailedError JUnit Composite TestSuite Test TestSuite run() run() JUnit Tomcat Web JUnit Cactus JUnit Java Cactus JUnit 26.1 JUnit Java JUnit JUnit Java JSP Servlet JUnit Java Erich Gamma Kent Beck xunit JUnit boolean JUnit Java JUnit Java JUnit Java 26.1.1 JUnit JUnit How

More information

使 用 Java 语 言 模 拟 保 险 箱 容 量 门 板 厚 度 箱 体 厚 度 属 性 锁 具 类 型 开 保 险 箱 关 保 险 箱 动 作 存 取 款

使 用 Java 语 言 模 拟 保 险 箱 容 量 门 板 厚 度 箱 体 厚 度 属 性 锁 具 类 型 开 保 险 箱 关 保 险 箱 动 作 存 取 款 JAVA 程 序 设 计 ( 肆 ) 徐 东 / 数 学 系 使 用 Java 语 言 模 拟 保 险 箱 容 量 门 板 厚 度 箱 体 厚 度 属 性 锁 具 类 型 开 保 险 箱 关 保 险 箱 动 作 存 取 款 使 用 Java class 代 表 保 险 箱 public class SaveBox 类 名 类 类 体 实 现 封 装 性 使 用 class SaveBox 代 表 保

More information

untitled

untitled 1 Outline 數 料 數 數 列 亂數 練 數 數 數 來 數 數 來 數 料 利 料 來 數 A-Z a-z _ () 不 數 0-9 數 不 數 SCHOOL School school 數 讀 school_name schoolname 易 不 C# my name 7_eleven B&Q new C# (1) public protected private params override

More information

Mac Java import com.apple.mrj.*;... public class MyFirstApp extends JFrame implements ActionListener, MRJAboutHandler, MRJQuitHandler {... public MyFirstApp() {... MRJApplicationUtils.registerAboutHandler(this);

More information

Microsoft Word - 第3章.doc

Microsoft Word - 第3章.doc Java C++ Pascal C# C# if if if for while do while foreach while do while C# 3.1.1 ; 3-1 ischeck Test() While ischeck while static bool ischeck = true; public static void Test() while (ischeck) ; ischeck

More information

詞 彙 表 編 號 詞 彙 描 述 1 預 約 人 資 料 中 文 姓 名 英 文 姓 名 身 份 證 字 號 預 約 人 電 話 性 別 2 付 款 資 料 信 用 卡 別 信 用 卡 號 信 用 卡 有 效 日 期 3 住 房 條 件 入 住 日 期 退 房 日 期 人 數 房 間 數 量 入

詞 彙 表 編 號 詞 彙 描 述 1 預 約 人 資 料 中 文 姓 名 英 文 姓 名 身 份 證 字 號 預 約 人 電 話 性 別 2 付 款 資 料 信 用 卡 別 信 用 卡 號 信 用 卡 有 效 日 期 3 住 房 條 件 入 住 日 期 退 房 日 期 人 數 房 間 數 量 入 100 年 特 種 考 試 地 方 政 府 公 務 人 員 考 試 試 題 等 別 : 三 等 考 試 類 科 : 資 訊 處 理 科 目 : 系 統 分 析 與 設 計 一 請 參 考 下 列 旅 館 管 理 系 統 的 使 用 案 例 圖 (Use Case Diagram) 撰 寫 預 約 房 間 的 使 用 案 例 規 格 書 (Use Case Specification), 繪 出 入

More information

内 容 简 介 本 书 是 一 本 关 于 语 言 程 序 设 计 的 教 材, 涵 盖 了 语 言 的 基 本 语 法 和 编 程 技 术, 其 中 包 含 了 作 者 对 语 言 多 年 开 发 经 验 的 总 结, 目 的 是 让 初 学 的 读 者 感 受 到 语 言 的 魅 力, 并 掌

内 容 简 介 本 书 是 一 本 关 于 语 言 程 序 设 计 的 教 材, 涵 盖 了 语 言 的 基 本 语 法 和 编 程 技 术, 其 中 包 含 了 作 者 对 语 言 多 年 开 发 经 验 的 总 结, 目 的 是 让 初 学 的 读 者 感 受 到 语 言 的 魅 力, 并 掌 语 言 程 序 设 计 郑 莉 胡 家 威 编 著 清 华 大 学 逸 夫 图 书 馆 北 京 内 容 简 介 本 书 是 一 本 关 于 语 言 程 序 设 计 的 教 材, 涵 盖 了 语 言 的 基 本 语 法 和 编 程 技 术, 其 中 包 含 了 作 者 对 语 言 多 年 开 发 经 验 的 总 结, 目 的 是 让 初 学 的 读 者 感 受 到 语 言 的 魅 力, 并 掌 握 语

More information

エスポラージュ株式会社 住所 : 東京都江東区大島 東急ドエルアルス大島 HP: ******************* * 关于 Java 测试试题 ******

エスポラージュ株式会社 住所 : 東京都江東区大島 東急ドエルアルス大島 HP:  ******************* * 关于 Java 测试试题 ****** ******************* * 关于 Java 测试试题 ******************* 問 1 运行下面的程序, 选出一个正确的运行结果 public class Sample { public static void main(string[] args) { int[] test = { 1, 2, 3, 4, 5 ; for(int i = 1 ; i System.out.print(test[i]);

More information

Chapter 9: Objects and Classes

Chapter 9: Objects and Classes Fortran Algol Pascal Modula-2 BCPL C Simula SmallTalk C++ Ada Java C# C Fortran 5.1 message A B 5.2 1 class Vehicle subclass Car object mycar public class Vehicle extends Object{ public int WheelNum

More information

JavaIO.PDF

JavaIO.PDF O u t p u t S t ream j a v a. i o. O u t p u t S t r e a m w r i t e () f l u s h () c l o s e () public abstract void write(int b) throws IOException public void write(byte[] data) throws IOException

More information

untitled

untitled 1 Outline 料 類 說 Tang, Shih-Hsuan 2006/07/26 ~ 2006/09/02 六 PM 7:00 ~ 9:30 聯 ives.net@gmail.com www.csie.ntu.edu.tw/~r93057/aspnet134 度 C# 力 度 C# Web SQL 料 DataGrid DataList 參 ASP.NET 1.0 C# 例 ASP.NET 立

More information

软件工程文档编制

软件工程文档编制 实训抽象类 一 实训目标 掌握抽象类的定义 使用 掌握运行时多态 二 知识点 抽象类的语法格式如下 : public abstract class ClassName abstract void 方法名称 ( 参数 ); // 非抽象方法的实现代码 在使用抽象类时需要注意如下几点 : 1 抽象类不能被实例化, 实例化的工作应该交由它的子类来完成 2 抽象方法必须由子类来进行重写 3 只要包含一个抽象方法的抽象类,

More information

Java Access 5-1 Server Client Client Server Server Client 5-2 DataInputStream Class java.io.datainptstream (extends) FilterInputStream InputStream Obj

Java Access 5-1 Server Client Client Server Server Client 5-2 DataInputStream Class java.io.datainptstream (extends) FilterInputStream InputStream Obj Message Transition 5-1 5-2 DataInputStream Class 5-3 DataOutputStream Class 5-4 PrintStream Class 5-5 (Message Transition) (Exercises) Java Access 5-1 Server Client Client Server Server Client 5-2 DataInputStream

More information

OOP with Java 通知 Project 4: 4 月 19 日晚 9 点

OOP with Java 通知 Project 4: 4 月 19 日晚 9 点 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 4: 4 月 19 日晚 9 点 复习 类的复用 组合 (composition): has-a 关系 class MyType { public int i; public double d; public char c; public void set(double x) { d

More information

chp6.ppt

chp6.ppt Java 软 件 设 计 基 础 6. 异 常 处 理 编 程 时 会 遇 到 如 下 三 种 错 误 : 语 法 错 误 (syntax error) 没 有 遵 循 语 言 的 规 则, 出 现 语 法 格 式 上 的 错 误, 可 被 编 译 器 发 现 并 易 于 纠 正 ; 逻 辑 错 误 (logic error) 即 我 们 常 说 的 bug, 意 指 编 写 的 代 码 在 执 行

More information

1 4 1.1 4 1.2..4 2..4 2.1..4 3.4 3.1 Java.5 3.1.1..5 3.1.2 5 3.1.3 6 4.6 4.1 6 4.2.6 5 7 5.1..8 5.1.1 8 5.1.2..8 5.1.3..8 5.1.4..9 5.2..9 6.10 6.1.10

1 4 1.1 4 1.2..4 2..4 2.1..4 3.4 3.1 Java.5 3.1.1..5 3.1.2 5 3.1.3 6 4.6 4.1 6 4.2.6 5 7 5.1..8 5.1.1 8 5.1.2..8 5.1.3..8 5.1.4..9 5.2..9 6.10 6.1.10 Java V1.0.1 2007 4 10 1 4 1.1 4 1.2..4 2..4 2.1..4 3.4 3.1 Java.5 3.1.1..5 3.1.2 5 3.1.3 6 4.6 4.1 6 4.2.6 5 7 5.1..8 5.1.1 8 5.1.2..8 5.1.3..8 5.1.4..9 5.2..9 6.10 6.1.10 6.2.10 6.3..10 6.4 11 7.12 7.1

More information

Microsoft Word - ch04三校.doc

Microsoft Word - ch04三校.doc 4-1 4-1-1 (Object) (State) (Behavior) ( ) ( ) ( method) ( properties) ( functions) 4-2 4-1-2 (Message) ( ) ( ) ( ) A B A ( ) ( ) ( YourCar) ( changegear) ( lowergear) 4-1-3 (Class) (Blueprint) 4-3 changegear

More information

Chapter 9: Objects and Classes

Chapter 9: Objects and Classes Java application Java main applet Web applet Runnable Thread CPU Thread 1 Thread 2 Thread 3 CUP Thread 1 Thread 2 Thread 3 ,,. (new) Thread (runnable) start( ) CPU (running) run ( ) blocked CPU sleep(

More information

《大话设计模式》第一章

《大话设计模式》第一章 第 1 章 代 码 无 错 就 是 优? 简 单 工 厂 模 式 1.1 面 试 受 挫 小 菜 今 年 计 算 机 专 业 大 四 了, 学 了 不 少 软 件 开 发 方 面 的 东 西, 也 学 着 编 了 些 小 程 序, 踌 躇 满 志, 一 心 要 找 一 个 好 单 位 当 投 递 了 无 数 份 简 历 后, 终 于 收 到 了 一 个 单 位 的 面 试 通 知, 小 菜 欣 喜

More information

3.1 num = 3 ch = 'C' 2

3.1 num = 3 ch = 'C' 2 Java 1 3.1 num = 3 ch = 'C' 2 final 3.1 final : final final double PI=3.1415926; 3 3.2 4 int 3.2 (long int) (int) (short int) (byte) short sum; // sum 5 3.2 Java int long num=32967359818l; C:\java\app3_2.java:6:

More information

EJB-Programming-4-cn.doc

EJB-Programming-4-cn.doc EJB (4) : (Entity Bean Value Object ) JBuilder EJB 2.x CMP EJB Relationships JBuilder EJB Test Client EJB EJB Seminar CMP Entity Beans Session Bean J2EE Session Façade Design Pattern Session Bean Session

More information

untitled

untitled 1 Outline 類别 欄 (1) 類 類 狀 更 易 類 理 若 類 利 來 利 using 來 namespace 類 ; (2) namespace IBM class Notebook namespace Compaq class Notebook 類别 類 來 類 列 欄 (field) (property) (method) (event) 類 例 立 來 車 類 類 立 車 欄 料

More information

java2d-4.PDF

java2d-4.PDF 75 7 6 G r a d i e n t P a i n t B a s i c S t r o k e s e t P a i n t ( ) s e t S t o r k e ( ) import java.awt.*; import java.awt.geom.*; public class PaintingAndStroking extends ApplicationFrame { public

More information

CHAPTER VC#

CHAPTER VC# 1. 2. 3. 4. CHAPTER 2-1 2-2 2-3 2-4 VC# 2-5 2-6 2-7 2-8 Visual C# 2008 2-1 Visual C# 0~100 (-32768~+32767) 2 4 VC# (Overflow) 2-1 2-2 2-1 2-1.1 2-1 1 10 10!(1 10) 2-3 Visual C# 2008 10! 32767 short( )

More information

FY.DOC

FY.DOC 高 职 高 专 21 世 纪 规 划 教 材 C++ 程 序 设 计 邓 振 杰 主 编 贾 振 华 孟 庆 敏 副 主 编 人 民 邮 电 出 版 社 内 容 提 要 本 书 系 统 地 介 绍 C++ 语 言 的 基 本 概 念 基 本 语 法 和 编 程 方 法, 深 入 浅 出 地 讲 述 C++ 语 言 面 向 对 象 的 重 要 特 征 : 类 和 对 象 抽 象 封 装 继 承 等 主

More information

OOP with Java 通知 Project 4: 5 月 2 日晚 9 点

OOP with Java 通知 Project 4: 5 月 2 日晚 9 点 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 4: 5 月 2 日晚 9 点 复习 类的复用 组合 (composition): has-a 关系 class MyType { public int i; public double d; public char c; public void set(double x) { d =

More information

OOP with Java 通知 Project 4: 4 月 18 日晚 9 点 关于抄袭 没有分数

OOP with Java 通知 Project 4: 4 月 18 日晚 9 点 关于抄袭 没有分数 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 4: 4 月 18 日晚 9 点 关于抄袭 没有分数 复习 类的复用 组合 (composition): has-a 关系 class MyType { public int i; public double d; public char c; public void set(double

More information

9, : Java 19., [4 ]. 3 Apla2Java Apla PAR,Apla2Java Apla Java.,Apla,,, 1. 1 Apla Apla A[J ] Get elem (set A) A J A B Intersection(set A,set B) A B A B

9, : Java 19., [4 ]. 3 Apla2Java Apla PAR,Apla2Java Apla Java.,Apla,,, 1. 1 Apla Apla A[J ] Get elem (set A) A J A B Intersection(set A,set B) A B A B 25 9 2008 9 M ICROEL ECTRON ICS & COMPU TER Vol. 25 No. 9 September 2008 J ava 1,2, 1,2, 1,2 (1, 330022 ; 2, 330022) :,. Apla - Java,,.. : PAR ;Apla - Java ; ;CMP ; : TP311 : A : 1000-7180 (2008) 09-0018

More information

CHAPTER 1

CHAPTER 1 CHAPTER 1 1-1 System Development Life Cycle; SDLC SDLC Waterfall Model Shelly 1995 1. Preliminary Investigation 2. System Analysis 3. System Design 4. System Development 5. System Implementation and Evaluation

More information

OOP with Java 通知 Project 3: 3 月 29 日晚 9 点 4 月 1 日上课

OOP with Java 通知 Project 3: 3 月 29 日晚 9 点 4 月 1 日上课 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 3: 3 月 29 日晚 9 点 4 月 1 日上课 复习 Java 包 创建包 : package 语句, 包结构与目录结构一致 使用包 : import restaurant/ - people/ - Cook.class - Waiter.class - tools/ - Fork.class

More information

untitled

untitled 4.1AOP AOP Aspect-oriented programming AOP 來說 AOP 令 理 Cross-cutting concerns Aspect Weave 理 Spring AOP 來 AOP 念 4.1.1 理 AOP AOP 見 例 來 例 錄 Logging 錄 便 來 例 行 留 錄 import java.util.logging.*; public class HelloSpeaker

More information

雲端 Cloud Computing 技術指南 運算 應用 平台與架構 10/04/15 11:55:46 INFO 10/04/15 11:55:53 INFO 10/04/15 11:55:56 INFO 10/04/15 11:56:05 INFO 10/04/15 11:56:07 INFO

雲端 Cloud Computing 技術指南 運算 應用 平台與架構 10/04/15 11:55:46 INFO 10/04/15 11:55:53 INFO 10/04/15 11:55:56 INFO 10/04/15 11:56:05 INFO 10/04/15 11:56:07 INFO CHAPTER 使用 Hadoop 打造自己的雲 8 8.3 測試 Hadoop 雲端系統 4 Nodes Hadoop Map Reduce Hadoop WordCount 4 Nodes Hadoop Map/Reduce $HADOOP_HOME /home/ hadoop/hadoop-0.20.2 wordcount echo $ mkdir wordcount $ cd wordcount

More information

KillTest 质量更高 服务更好 学习资料 半年免费更新服务

KillTest 质量更高 服务更好 学习资料   半年免费更新服务 KillTest 质量更高 服务更好 学习资料 http://www.killtest.cn 半年免费更新服务 Exam : 70-536Chinese(C++) Title : TS:MS.NET Framework 2.0-Application Develop Foundation Version : DEMO 1 / 10 1. Exception A. Data B. Message C.

More information

Microsoft Word - mei.doc

Microsoft Word - mei.doc 看上去很美 王朔 编者的话 时隔七年 王朔又拿出了他的新作 一个过去写过很多东西 又曾声言放弃写作的 人 此番重新拿起笔 令我们感兴趣的倒也不是他的食言自肥 而是他是否确有一些新 意要表达 这才构成一部文学作品产生的必要成因 关于王朔 我们听到较多的是他的 调侃和所谓玩世不恭的写作态度 作为出版过他的全部作品的编者 我们知道那类作品 只是他全部作品的一小部分 在某一时刻被刻意演染夸张开来的一种风格

More information

1 Framework.NET Framework Microsoft Windows.NET Framework.NET Framework NOTE.NET NET Framework.NET Framework 2.0 ( 3 ).NET Framework 2.0.NET F

1 Framework.NET Framework Microsoft Windows.NET Framework.NET Framework NOTE.NET NET Framework.NET Framework 2.0 ( 3 ).NET Framework 2.0.NET F 1 Framework.NET Framework Microsoft Windows.NET Framework.NET Framework NOTE.NET 2.0 2.0.NET Framework.NET Framework 2.0 ( 3).NET Framework 2.0.NET Framework ( System ) o o o o o o Boxing UnBoxing() o

More information

<4D6963726F736F667420576F7264202D20C8EDC9E82DCFC2CEE7CCE22D3039C9CF>

<4D6963726F736F667420576F7264202D20C8EDC9E82DCFC2CEE7CCE22D3039C9CF> 全 国 计 算 机 技 术 与 软 件 专 业 技 术 资 格 ( 水 平 考 试 2009 年 上 半 年 软 件 设 计 师 下 午 试 卷 ( 考 试 时 间 14:00~16:30 共 150 分 钟 请 按 下 述 要 求 正 确 填 写 答 题 纸 1. 在 答 题 纸 的 指 定 位 置 填 写 你 所 在 的 省 自 治 区 直 辖 市 计 划 单 列 市 的 名 称 2. 在 答

More information

第5章修改稿

第5章修改稿 (Programming Language), ok,, if then else,(), ()() 5.0 5.0.0, (Variable Declaration) var x : T x, T, x,,,, var x : T P = x, x' : T P P, () var x:t P,,, yz, var x : int x:=2. y := x+z = x, x' : int x' =2

More information

新版 明解C++入門編

新版 明解C++入門編 511!... 43, 85!=... 42 "... 118 " "... 337 " "... 8, 290 #... 71 #... 413 #define... 128, 236, 413 #endif... 412 #ifndef... 412 #if... 412 #include... 6, 337 #undef... 413 %... 23, 27 %=... 97 &... 243,

More information

untitled

untitled 1 行 行 行 行.NET 行 行 類 來 行 行 Thread 類 行 System.Threading 來 類 Thread 類 (1) public Thread(ThreadStart start ); Name 行 IsAlive 行 行狀 Start 行 行 Suspend 行 Resume 行 行 Thread 類 (2) Sleep 行 CurrentThread 行 ThreadStart

More information

全国计算机技术与软件专业技术资格(水平)考试

全国计算机技术与软件专业技术资格(水平)考试 全 国 计 算 机 技 术 与 软 件 专 业 技 术 资 格 ( 水 平 ) 考 试 2008 年 上 半 年 程 序 员 下 午 试 卷 ( 考 试 时 间 14:00~16:30 共 150 分 钟 ) 试 题 一 ( 共 15 分 ) 阅 读 以 下 说 明 和 流 程 图, 填 补 流 程 图 中 的 空 缺 (1)~(9), 将 解 答 填 入 答 题 纸 的 对 应 栏 内 [ 说 明

More information

Swing-02.pdf

Swing-02.pdf 2 J B u t t o n J T e x t F i e l d J L i s t B u t t o n T e x t F i e l d L i s t J F r a m e 21 2 2 Swing C a n v a s C o m p o n e n t J B u t t o n AWT // ToolbarFrame1.java // java.awt.button //

More information

CC213

CC213 : (Ken-Yi Lee), E-mail: feis.tw@gmail.com 49 [P.51] C/C++ [P.52] [P.53] [P.55] (int) [P.57] (float/double) [P.58] printf scanf [P.59] [P.61] ( / ) [P.62] (char) [P.65] : +-*/% [P.67] : = [P.68] : ,

More information

Microsoft Word - 第6章.doc

Microsoft Word - 第6章.doc 100 第 6 章 继 承 第 6 章 继 承 继 承 是 面 向 对 象 编 程 的 重 要 特 征 之 一 顾 名 思 义, 继 承 就 是 在 现 有 类 的 基 础 上 构 建 新 类 以 满 足 新 的 要 求 在 继 承 过 程 中, 新 的 类 继 承 原 来 的 方 法 和 实 例 变 量, 并 且 能 添 加 自 己 的 方 法 和 实 例 变 量 在 本 章 中 主 要 讲 解

More information

Microsoft PowerPoint - course2.ppt

Microsoft PowerPoint - course2.ppt Java 程 式 設 計 基 礎 班 (2) 莊 坤 達 台 大 電 信 所 網 路 資 料 庫 研 究 室 Email: doug@arbor.ee.ntu.edu.tw Class 2 1 回 顧 Eclipse 使 用 入 門 Class 2 2 Lesson 2 Java 程 式 語 言 介 紹 Class 2 3 Java 基 本 知 識 介 紹 大 小 寫 有 差 (Case Sensitive)

More information

untitled

untitled 1 MSDN Library MSDN Library 量 例 參 列 [ 說 ] [] [ 索 ] [] 來 MSDN Library 了 類 類 利 F1 http://msdn.microsoft.com/library/ http://msdn.microsoft.com/library/cht/ Object object 參 類 都 object 參 object Boxing 參 boxing

More information

KillTest 质量更高 服务更好 学习资料 半年免费更新服务

KillTest 质量更高 服务更好 学习资料   半年免费更新服务 KillTest 质量更高 服务更好 学习资料 http://www.killtest.cn 半年免费更新服务 Exam : 1Z0-854 Title : Java Standard Edition 5 Programmer Certified Professional Upgrade Exam Version : Demo 1 / 12 1.Given: 20. public class CreditCard

More information

第3章.doc

第3章.doc 3 3 3 3.1 3 IT Trend C++ Java SAP Advantech ERPCRM C++ C++ Synopsys C++ NEC C C++PHP C++Java C++Java VIA C++ 3COM C++ SPSS C++ Sybase C++LinuxUNIX Motorola C++ IBM C++Java Oracle Java HP C++ C++ Yahoo

More information

EJB-Programming-3.PDF

EJB-Programming-3.PDF :, JBuilder EJB 2.x CMP EJB Relationships JBuilder EJB Test Client EJB EJB Seminar CMP Entity Beans Value Object Design Pattern J2EE Design Patterns Value Object Value Object Factory J2EE EJB Test Client

More information

<4D6963726F736F667420506F776572506F696E74202D20332D322E432B2BC3E6CFF2B6D4CFF3B3CCD0F2C9E8BCC6A1AAD6D8D4D8A1A2BCCCB3D0A1A2B6E0CCACBACDBEDBBACF2E707074>

<4D6963726F736F667420506F776572506F696E74202D20332D322E432B2BC3E6CFF2B6D4CFF3B3CCD0F2C9E8BCC6A1AAD6D8D4D8A1A2BCCCB3D0A1A2B6E0CCACBACDBEDBBACF2E707074> 程 序 设 计 实 习 INFO130048 3-2.C++ 面 向 对 象 程 序 设 计 重 载 继 承 多 态 和 聚 合 复 旦 大 学 计 算 机 科 学 与 工 程 系 彭 鑫 pengxin@fudan.edu.cn 内 容 摘 要 方 法 重 载 类 的 继 承 对 象 引 用 和 拷 贝 构 造 函 数 虚 函 数 和 多 态 性 类 的 聚 集 复 旦 大 学 计 算 机 科 学

More information

Microsoft Word - 新1-12.doc

Microsoft Word - 新1-12.doc 实训 5 面向对象编程练习 实训 5 面向对象编程练习 5.1 实训目的 通过编程和上机实验理解 Java 语言是如何体现面向对象编程基本思想 以及如何创建类 和对象 了解成员变量和成员方法的特性 5.2 实训要求 编写一个体现面向对象思想的程序 编写一个创建对象和使用对象的方法的程序 5.3 实训内容 5.3.1 创建对象并使用对象 1 定义一个 Person 类 可以在应用程序中使用该类 成员属性

More information

OOP with Java 通知 Project 4: 5 月 2 日晚 9 点

OOP with Java 通知 Project 4: 5 月 2 日晚 9 点 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 4: 5 月 2 日晚 9 点 复习 Java 包 创建包 : package 语句, 包结构与目录结构一致 使用包 : import restaurant/ - people/ - Cook.class - Waiter.class - tools/ - Fork.class - Table.class

More information

北 风 网 讲 师 原 创 作 品 ---- 仅 供 学 员 内 部 交 流 使 用 前 言 吾 尝 终 日 而 思 矣, 不 如 须 臾 之 所 学 也 ; 吾 尝 跂 而 望 矣, 不 如 登 高 之 博 见 也 登 高 而 招, 臂 非 加 长 也, 而 见

北 风 网 讲 师 原 创 作 品 ---- 仅 供  学 员 内 部 交 流 使 用 前 言 吾 尝 终 日 而 思 矣, 不 如 须 臾 之 所 学 也 ; 吾 尝 跂 而 望 矣, 不 如 登 高 之 博 见 也 登 高 而 招, 臂 非 加 长 也, 而 见 北 风 网 讲 师 原 创 作 品 ---- 仅 供 www.ibeifeng.com 学 员 内 部 交 流 使 用 前 言 吾 尝 终 日 而 思 矣, 不 如 须 臾 之 所 学 也 ; 吾 尝 跂 而 望 矣, 不 如 登 高 之 博 见 也 登 高 而 招, 臂 非 加 长 也, 而 见 者 远 ; 顺 风 而 呼, 声 非 加 疾 也, 而 闻 者 彰 假 舆 马 者, 非 利 足 也,

More information

JAVA String常用APi

JAVA String常用APi JAVA String 常 用API 2015 年 5 月13 日 星 期 三 ------------------------------------------ String 类 的 特 点 : 字 符 串 对 象 一 旦 被 初 始 化 就 不 会 被 改 变 abc 存 储 在 字 符 串 常 量 池 中 Java 的 核 心 类 包 是 java.lang eclipse:ctrl+ 方

More information

untitled

untitled 1 Outline ArrayList 類 列類 串類 類 類 例 理 MSDN Library MSDN Library 量 例 參 列 [ 說 ] [] [ 索 ] [] 來 MSDN Library 了 類 類 利 F1 http://msdn.microsoft.com/library/ http://msdn.microsoft.com/library/cht/ Object object

More information

untitled

untitled 3 C++ 3.1 3.2 3.3 3.4 new delete 3.5 this 3.6 3.7 3.1 3.1 class struct union struct union C class C++ C++ 3.1 3.1 #include struct STRING { typedef char *CHARPTR; // CHARPTR s; // int strlen(

More information

2 Java 语 言 程 序 设 计 教 程 1.2.1 简 单 性 Java 语 言 的 语 法 与 C 语 言 和 C++ 语 言 很 接 近, 使 得 大 多 数 程 序 员 很 容 易 学 习 和 使 用 Java 另 一 方 面,Java 丢 弃 了 C++ 中 很 少 使 用 的 很 难

2 Java 语 言 程 序 设 计 教 程 1.2.1 简 单 性 Java 语 言 的 语 法 与 C 语 言 和 C++ 语 言 很 接 近, 使 得 大 多 数 程 序 员 很 容 易 学 习 和 使 用 Java 另 一 方 面,Java 丢 弃 了 C++ 中 很 少 使 用 的 很 难 第 1 章 Java 概 述 Java 的 诞 生 Java 的 特 点 Java 开 发 环 境 安 装 与 配 置 创 建 并 运 行 一 个 简 单 的 Java 程 序 Java 语 言 是 当 今 计 算 机 软 件 行 业 中 最 热 门 的 网 络 编 程 语 言, 以 Java 为 核 心 的 芯 片 技 术 编 译 技 术 数 据 库 连 接 技 术, 以 及 基 于 企 业 级

More information

Adobe® Flash® 的 Adobe® ActionScript® 3.0 程式設計

Adobe® Flash® 的 Adobe® ActionScript® 3.0 程式設計 337 18 Adobe Flash CS4 Professional MovieClip ActionScript Flash ActionScript Flash Flash Flash MovieClip MovieClip ActionScript ( ) MovieClip Flash Sprite ActionScript MovieClip ActionScript 3.0 Shape

More information

C 1

C 1 C homepage: xpzhangme 2018 5 30 C 1 C min(x, y) double C // min c # include # include double min ( double x, double y); int main ( int argc, char * argv []) { double x, y; if( argc!=

More information

OOP with Java 通知 Project 3 提交时间 3 月 29 日晚 9 点 Piazza Project 2 投票

OOP with Java 通知 Project 3 提交时间 3 月 29 日晚 9 点 Piazza Project 2 投票 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 3 提交时间 3 月 29 日晚 9 点 Piazza Project 2 投票 复习 创建对象 构造函数 函数重载 : 函数 = 函数名 + 参数列表 public class MyType { int i; double d; char c; void set(double x)

More information

附录J:Eclipse教程

附录J:Eclipse教程 附 录 J:Eclipse 教 程 By Y.Daniel Liang 该 帮 助 文 档 包 括 以 下 内 容 : Eclipse 入 门 选 择 透 视 图 创 建 项 目 创 建 Java 程 序 编 译 和 运 行 Java 程 序 从 命 令 行 运 行 Java Application 在 Eclipse 中 调 试 提 示 : 在 学 习 完 第 一 章 后 使 用 本 教 程 第

More information

第一章 章标题-F2 上空24,下空24

第一章 章标题-F2 上空24,下空24 2 C# C# C#.NET ASP.NET C# C# C# 2.1 C# C#.NET.NET C#.NET C# CLR C#.NET 2.1.1 C# C# C++ Visual Basic C# C++ C++ C# C#.NET C# C C++ C#. C# C# C# C# 2.1.2 C# C# 2-01.cs C# 2-01.cs class Hello{ public static

More information

基于CDIO一体化理念的课程教学大纲设计

基于CDIO一体化理念的课程教学大纲设计 Java 语 言 程 序 设 计 课 程 教 学 大 纲 Java 语 言 程 序 设 计 课 程 教 学 大 纲 一 课 程 基 本 信 息 1. 课 程 代 码 :52001CC022 2. 课 程 名 称 :Java 语 言 程 序 设 计 3. 课 程 英 文 名 称 :Java Programming 4. 课 程 类 别 : 理 论 课 ( 含 实 验 上 机 或 实 践 ) 5. 授

More information

Microsoft PowerPoint - ch02

Microsoft PowerPoint - ch02 第 一 篇 基 礎 圖 文 動 畫 (Basic Graphics / Animation) 2 1 簡 介 2 2 Frame Class 2 3 執 行 緒 繪 圖 流 程 2 4 Font Class 2 5 Color Class 2 6 中 文 處 理 2 7 習 題 (Exercises) 第 二 章 文 字 繪 製 (Words) 2 1 簡 介 本 書 探 討 的 是 動 畫 遊 戲,

More information

新版 明解C言語入門編

新版 明解C言語入門編 328, 4, 110, 189, 103, 11... 318. 274 6 ; 10 ; 5? 48 & & 228! 61!= 42 ^= 66 _ 82 /= 66 /* 3 / 19 ~ 164 OR 53 OR 164 = 66 ( ) 115 ( ) 31 ^ OR 164 [] 89, 241 [] 324 + + 4, 19, 241 + + 22 ++ 67 ++ 73 += 66

More information

<4D6963726F736F667420506F776572506F696E74202D20B5DA3035D5C220C3E6CFF2B6D4CFF3B8DFBCB6B3CCD0F2C9E8BCC6>

<4D6963726F736F667420506F776572506F696E74202D20B5DA3035D5C220C3E6CFF2B6D4CFF3B8DFBCB6B3CCD0F2C9E8BCC6> Java 程 序 设 计 教 学 课 件 河 南 农 业 大 学 信 管 学 院 计 算 机 系 河 南 农 业 大 学 信 管 学 院 计 算 机 系 高 级 语 言 程 序 设 计 课 程 组 第 5 章 面 向 对 象 高 级 程 序 设 计 主 要 内 容 5.1 继 承 5.2 多 态 性 5.3 抽 象 类 和 抽 象 方 法 5.4 接 口 5.5 内 部 类 和 匿 名 类 5.1

More information

JBuilder Weblogic

JBuilder Weblogic JUnit ( bliu76@yeah.net) < >6 JUnit Java Erich Gamma Kent Beck JUnit JUnit 1 JUnit 1.1 JUnit JUnit java XUnit JUnit 1.2 JUnit JUnit Erich Gamma Kent Beck Erich Gamma Kent Beck XP Extreme Programming CRC

More information

OOP with Java 通知 Project 4: 推迟至 4 月 25 日晚 9 点

OOP with Java 通知 Project 4: 推迟至 4 月 25 日晚 9 点 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 4: 推迟至 4 月 25 日晚 9 点 复习 Protected 可以被子类 / 同一包中的类访问, 不能被其他类访问 弱化的 private 同时赋予 package access class MyType { public int i; public double d; public

More information

untitled

untitled 1 1.1 1.2 1.3 1.4 1.5 ++ 1.6 ++ 2 BNF 3 4 5 6 7 8 1.2 9 1.2 IF ELSE 10 1.2 11 1.2 12 1.3 Ada, Modula-2 Simula Smalltalk-80 C++, Objected Pascal(Delphi), Java, C#, VB.NET C++: C OOPL Java: C++ OOPL C# C++

More information

Visual Basic D 3D

Visual Basic D 3D Visual Basic 2008 2D 3D 6-1 6-1 - 6-2 - 06 6-2 STEP 1 5-2 (1) STEP 2 5-3 (2) - 6-3 - Visual Basic 2008 2D 3D STEP 3 User1 6-4 (3) STEP 4 User1 6-5 (4) - 6-4 - 06 STEP 5 6-6 (5) 6-3 6-3-1 (LoginForm) PictureBox1

More information

1 Project New Project 1 2 Windows 1 3 N C test Windows uv2 KEIL uvision2 1 2 New Project Ateml AT89C AT89C51 3 KEIL Demo C C File

1 Project New Project 1 2 Windows 1 3 N C test Windows uv2 KEIL uvision2 1 2 New Project Ateml AT89C AT89C51 3 KEIL Demo C C File 51 C 51 51 C C C C C C * 2003-3-30 pnzwzw@163.com C C C C KEIL uvision2 MCS51 PLM C VC++ 51 KEIL51 KEIL51 KEIL51 KEIL 2K DEMO C KEIL KEIL51 P 1 1 1 1-1 - 1 Project New Project 1 2 Windows 1 3 N C test

More information

Microsoft PowerPoint - 14Threads.ppt

Microsoft PowerPoint - 14Threads.ppt Threads Outline Introduction to Threads How to create Thread extend Thread implement Runnable interface Synchronization What is thread? 定義 : 程式的執行軌跡 Single Thread Multi-Thread 依序執行 int x, y; int z; x =

More information

Strings

Strings Polymorphism and Virtual Functions Cheng-Chin Chiang Virtual Function Basics 多 型 (Polymorphism) 賦 予 一 個 函 數 多 種 意 涵, 存 在 於 同 一 類 別 之 內 祖 先 類 別 與 後 代 類 別 間 物 件 導 向 程 式 設 計 基 本 原 理 虛 擬 函 數 (Virtual Function)

More information

38 47995529 威 福 髮 藝 店 桃 園 市 蘆 竹 區 中 山 里 福 祿 一 街 48 號 地 下 一 樓 50,000 獨 資 李 依 純 105/04/06 府 經 登 字 第 1059003070 號 39 47995534 宏 品 餐 飲 桃 園 市 桃 園 區 信 光 里 民

38 47995529 威 福 髮 藝 店 桃 園 市 蘆 竹 區 中 山 里 福 祿 一 街 48 號 地 下 一 樓 50,000 獨 資 李 依 純 105/04/06 府 經 登 字 第 1059003070 號 39 47995534 宏 品 餐 飲 桃 園 市 桃 園 區 信 光 里 民 1 08414159 惠 鴻 眼 鏡 行 桃 園 市 中 壢 區 福 德 里 中 華 路 一 段 186 號 1 樓 30,000 獨 資 宋 耀 鴻 105/04/27 府 經 登 字 第 1059003866 號 2 17891110 承 元 冷 氣 空 調 工 程 行 桃 園 市 桃 園 區 中 德 里 國 際 路 1 段 98 巷 50 號 2 樓 之 4 200,000 獨 資 詹 安 平

More information

1: public class MyOutputStream implements AutoCloseable { 3: public void close() throws IOException { 4: throw new IOException(); 5: } 6:

1: public class MyOutputStream implements AutoCloseable { 3: public void close() throws IOException { 4: throw new IOException(); 5: } 6: Chapter 15. Suppressed Exception CH14 Finally Block Java SE 7 try-with-resources JVM cleanup try-with-resources JVM cleanup cleanup Java SE 7 Throwable getsuppressed Throwable[] getsuppressed() Suppressed

More information

Learning Java

Learning Java Java Introduction to Java Programming (Third Edition) Prentice-Hall,Inc. Y.Daniel Liang 2001 Java 2002.2 Java2 2001.10 Java2 Philip Heller & Simon Roberts 1999.4 Java2 2001.3 Java2 21 2002.4 Java UML 2002.10

More information

untitled

untitled How to using M-Power Report API M-Power Report API 力 了 M-Power Report -- Java (Library) M-Power Report API 行 Java M-Power Report M-Power Report API ( 30 ) PDF/HTML/CSV/XLS JPEG/PNG/SVG 料 料 OutputStream

More information

單步除錯 (1/10) 打開 Android Studio, 點選 Start a new Android Studio project 建立專案 Application name 輸入 BMI 點下 Next 2 P a g e

單步除錯 (1/10) 打開 Android Studio, 點選 Start a new Android Studio project 建立專案 Application name 輸入 BMI 點下 Next 2 P a g e Android Studio Debugging 本篇教學除了最基本的中斷點教學之外, 還有條件式中斷的教學 條件式中斷是進階的除錯技巧, 在某些特定情況中, 我們有一個函數可能會被呼叫數次, 但是我們只希望在某種條件成立時才進行中斷, 進而觀察變數的狀態 而條件式中斷這項技巧正是符合這項需求 本教學分兩部分 單步除錯 (Page2~11, 共 10) 條件式中斷點 (Page12~17, 共 6)

More information

1.JasperReport ireport JasperReport ireport JDK JDK JDK JDK ant ant...6

1.JasperReport ireport JasperReport ireport JDK JDK JDK JDK ant ant...6 www.brainysoft.net 1.JasperReport ireport...4 1.1 JasperReport...4 1.2 ireport...4 2....4 2.1 JDK...4 2.1.1 JDK...4 2.1.2 JDK...5 2.1.3 JDK...5 2.2 ant...6 2.2.1 ant...6 2.2.2 ant...6 2.3 JasperReport...7

More information

C/C++程序设计 - 字符串与格式化输入/输出

C/C++程序设计 - 字符串与格式化输入/输出 C/C++ / Table of contents 1. 2. 3. 4. 1 i # include # include // density of human body : 1. 04 e3 kg / m ^3 # define DENSITY 1. 04 e3 int main ( void ) { float weight, volume ; int

More information

用手機直接傳值不透過網頁連接, 來當作搖控器控制家電 ( 電視遙控器 ) 按下按鍵發送同時會回傳值來確定是否有送出 問題 :1. 應該是使用了太多 thread 導致在傳值上有問題 2. 一次按很多次按鈕沒辦法即時反應

用手機直接傳值不透過網頁連接, 來當作搖控器控制家電 ( 電視遙控器 ) 按下按鍵發送同時會回傳值來確定是否有送出 問題 :1. 應該是使用了太多 thread 導致在傳值上有問題 2. 一次按很多次按鈕沒辦法即時反應 專題進度 老師 : 趙啟時老師 學生 : 陳建廷 2013/10/13 用手機直接傳值不透過網頁連接, 來當作搖控器控制家電 ( 電視遙控器 ) 按下按鍵發送同時會回傳值來確定是否有送出 問題 :1. 應該是使用了太多 thread 導致在傳值上有問題 2. 一次按很多次按鈕沒辦法即時反應 程式碼 : package com.example.phone; import java.util.arraylist;

More information

OOP with Java 通知 Project 4: 4 月 19 日晚 9 点

OOP with Java 通知 Project 4: 4 月 19 日晚 9 点 OOP with Java Yuanbin Wu cs@ecnu OOP with Java 通知 Project 4: 4 月 19 日晚 9 点 复习 Protected 可以被子类 / 同一包中的类访问, 不能被其他类访问 弱化的 private 同时赋予 package access class MyType { public int i; public double d; public char

More information

Chapter12 Derived Classes

Chapter12   Derived Classes 继 承 -- 派 生 类 复 习 1. 有 下 面 类 的 说 明, 有 错 误 的 语 句 是 : class X { A) const int a; B) X(); C) X(int val) {a=2 D) ~X(); 答 案 :C 不 正 确, 应 改 成 X(int val) : a(2) { 2. 下 列 静 态 数 据 成 员 的 特 性 中, 错 误 的 是 A) 说 明 静 态 数

More information

51 C 51 isp 10 C PCB C C C C KEIL

51 C 51 isp 10   C   PCB C C C C KEIL http://wwwispdowncom 51 C " + + " 51 AT89S51 In-System-Programming ISP 10 io 244 CPLD ATMEL PIC CPLD/FPGA ARM9 ISP http://wwwispdowncom/showoneproductasp?productid=15 51 C C C C C ispdown http://wwwispdowncom

More information

Microsoft Word - Learn Objective-C.doc

Microsoft Word - Learn Objective-C.doc Learn Objective C http://cocoadevcentral.com/d/learn_objectivec/ Objective C Objective C Mac C Objective CC C Scott Stevenson [object method]; [object methodwithinput:input]; output = [object methodwithoutput];

More information

Java第一天 2007年4月23日

Java第一天      2007年4月23日 Java 第 一 天 2007 年 4 月 23 日 1 Java 之 父 Golsling 1995 年 5 月 23 日 Java 诞 生 1998 年 12 月 1.2 版 本 Java2 J2SE J2EE J2ME 2004 年 12 月 1.5 版 本 (5.0) Java JavaSE JavaEE JavaME 2 Java SE --- Java 标 准 平 台 Java EE ---

More information

前言 C# C# C# C C# C# C# C# C# microservices C# More Effective C# More Effective C# C# C# C# Effective C# 50 C# C# 7 Effective vii

前言 C# C# C# C C# C# C# C# C# microservices C# More Effective C# More Effective C# C# C# C# Effective C# 50 C# C# 7 Effective vii 前言 C# C# C# C C# C# C# C# C# microservices C# More Effective C# More Effective C# C# C# C# Effective C# 50 C# C# 7 Effective vii C# 7 More Effective C# C# C# C# C# C# Common Language Runtime CLR just-in-time

More information

Java 1 Java String Date

Java 1 Java String Date JAVA SCJP Java 1 Java String Date 1Java 01 Java Java 1995 Java Java 21 Java Java 5 1-1 Java Java 1990 12 Patrick Naughton C++ C (Application Programming Interface API Library) Patrick Naughton NeXT Stealth

More information

09 (File Processes) (mkdir) 9-3 (createnewfile) 9-4 (write) 9-5 (read) 9-6 (deletefile) 9-7 (deletedir) (Exercises)

09 (File Processes) (mkdir) 9-3 (createnewfile) 9-4 (write) 9-5 (read) 9-6 (deletefile) 9-7 (deletedir) (Exercises) 09 (File Processes) 9-1 9-2 (mkdir) 9-3 (createnewfile) 9-4 (write) 9-5 (read) 9-6 (deletefile) 9-7 (deletedir) (Exercises) Java Servlet 9-1 Servlet (File Processes) Client Servlet Servlet Java Java (Stream)

More information

chap07.key

chap07.key #include void two(); void three(); int main() printf("i'm in main.\n"); two(); return 0; void two() printf("i'm in two.\n"); three(); void three() printf("i'm in three.\n"); void, int 标识符逗号分隔,

More information

untitled

untitled 1 7 7.1 7.2 7.3 7.4 7.5 2 7.1 VFT virtual 7.1 3 1 1. 2. public protected public 3. VFT 4. this const volatile 4 2 5. ( ) ( ) 7.1 6. no-static virtual 7.2 7. inline 7.3 5 3 8. this this 9. ( ) ( ) delete

More information

[剑指offer] 面试题43:n个骰子的点数(Java),[剑指offer] 面试题42: 翻转单词顺序 VS左旋转字符串(Java),[剑指offer] 面试题41:和为s的两个数字VS和为s的连续序列

[剑指offer] 面试题43:n个骰子的点数(Java),[剑指offer] 面试题42: 翻转单词顺序 VS左旋转字符串(Java),[剑指offer] 面试题41:和为s的两个数字VS和为s的连续序列 [ 剑 指 offer] 面 试 题 43:n 个 骰 子 的 点 数 (Java) 题 目 : 把 n 个 骰 子 扔 在 地 上, 所 有 骰 子 朝 上 一 面 的 点 数 之 和 为 S 输 入 n, 打 印 出 S 的 所 有 可 能 的 值 出 现 的 概 率 分 析 : 一 般 来 说 骰 子 只 有 6 面, 点 数 为 1~6, n 个 骰 故 子 的 最 小 和 为 n, 最 大

More information

(6) 要 求 付 款 管 理 员 从 预 订 表 中 查 询 距 预 订 的 会 议 时 间 两 周 内 的 预 定, 根 据 客 户 记 录 给 满 足 条 件 的 客 户 发 送 支 付 余 款 要 求 (7) 支 付 余 款 管 理 员 收 到 客 户 余 款 支 付 的 通 知 后, 检

(6) 要 求 付 款 管 理 员 从 预 订 表 中 查 询 距 预 订 的 会 议 时 间 两 周 内 的 预 定, 根 据 客 户 记 录 给 满 足 条 件 的 客 户 发 送 支 付 余 款 要 求 (7) 支 付 余 款 管 理 员 收 到 客 户 余 款 支 付 的 通 知 后, 检 2016 年 上 半 年 软 件 设 计 师 考 试 真 题 ( 下 午 题 ) 下 午 试 题 试 题 一 ( 共 15 分 ) 阅 读 下 列 说 明 和 图, 回 答 问 题 1 至 问 题 4, 将 解 答 填 入 答 题 纸 的 对 应 栏 内 说 明 某 会 议 中 心 提 供 举 办 会 议 的 场 地 设 施 和 各 种 设 备, 供 公 司 与 各 类 组 织 机 构 租 用 场

More information

(京)新登字063号

(京)新登字063号 教 育 部 职 业 教 育 与 成 人 教 育 司 推 荐 教 材 Java 程 序 设 计 教 程 ( 第 二 版 ) 沈 大 林 主 编 沈 昕 肖 柠 朴 曾 昊 等 编 著 内 容 简 介 Java 是 由 美 国 SUN 公 司 开 发 的 一 种 功 能 强 大 的, 具 有 简 单 面 向 对 象 分 布 式 可 移 植 等 性 能 的 多 线 程 动 态 计 算 机 编 程 语 言

More information

,,,,,,,,,,,,, :,, ;,,,,, ( ),,,, : ( ) ; ( ) ; ( ) ( ) ; ( ) ( A ) ; ( ) ( ),,,,,,, 80

,,,,,,,,,,,,, :,, ;,,,,, ( ),,,, : ( ) ; ( ) ; ( ) ( ) ; ( ) ( A ) ; ( ) ( ),,,,,,, 80 1996 2 ( ), :,, = = : A BX A B X, A B A B,, : a A B A B ; b A B :, : a, b, A BX= A B X X,,, :,,,,,,, 79 ,,,,,,,,,,,,, :,, ;,,,,, ( ),,,, : ( ) ; ( ) ; ( ) ( ) ; ( ) ( A ) ; ( ) ( ),,,,,,, 80 ,,,, (,, )

More information