ZW1.PDF

Size: px
Start display at page:

Download "ZW1.PDF"

Transcription

1 C. A. R. Hoare, The Emperor s Old Clothes Java C++ Objective C Eiffel Smalltalk Mesa Lisp Java Java Java C++ Java 10 Item 1 Item 2 String.equals() == 1

2 1 Item 3 Java C++ Java Item 4 Java Item 5 Java Item 6 Java this Item 7 Item 8 Java Item 9 C++ Java Java Item 10 Java short-circuit 2 Java 3 3 Java Item 5 Item 1 Item 5

3 Java Item 1: 01: class Super 03: static String greeting() 04: { 05: return "Goodnight"; 06: } 07: 08: String name() 09: { 10: return "Richard"; 11: } 12: } 01: class Sub extends Super 03: static String greeting() 04: { 05: return "Hello"; 06: } 07: 08: String name() 09: { 10: return "Dick"; 11: } 12: } 01: class Test 03: public static void main(string[] args) 04: { 05: Super s = new Sub(); 06: System.out.println(s.greeting() + ", " + s.name()); 07: } 08: } Test Goodnight, Dick Super greeting name Sub Super greeting name Test main 3

4 1 Test 5 Sub s Super Sub s Super Sub ( 6 ) s.greeting() s.name() Super Sub name() name() Sub Super name() Sub name() Super name() s Sub s.name() Dick greeting() Super Sub greeting() Sub greeting() Super greeting() s Super Sub greeting() Super greeting() s.greeting() Goodnight Super/Sub s Sub Sub greeting() Super s Super greeting() s Sub Super name() Java Sub/Super 4

5 Item 2: String.equals( ) == final 1 C++ = = string String.equals(...) = = 01: public class StringExample 03: public static void main (String args[]) 04: { 05: String s0 = "Programming"; 06: String s1 = new String ("Programming"); 07: String s2 = "Program" + "ming"; 08: 09: System.out.println("s0.equals(s1): " + (s0.equals(s1))); 10: System.out.println("s0.equals(s2): " + (s0.equals(s2))); 11: System.out.println("s0 == s1: " + (s0 == s1)); 12: System.out.println("s0 == s2: " + (s0 == s2)); 13: } 14: } 3 String Programming Programming String equals(...) = = s0.equals(s1): true s0.equals(s2): true s0 == s1: false s0 == s2: true 1 5

6 1 String.equals() equals(...) true s0 s1 s2 true == String s0 s1 String s0 s2 s0 s2 Java String Literals Programming Program 1 ming s2 Java Programming Program + ming Java constant pool Java.class JVM.class s0 s2 JVM constant pool resolution 3 JVM 5.4 constant pool entry CONSTANT_String 2 Unicode String intern() Unicode String String String CONSTANT_String Unicode String Java String String JVM 6 Programming String s0 s1 false s0==s1 s0.equals(s1) s0==s1 s0.equals(s1) 1 Java 0 escape sequence 2.class 6

7 Item 2: String.equals( ) ==.class JVM intern() String String intern() intern() 3 01: import java.io.*; 02: 03: public class StringExample2 04: { 05: public static void main (String args[]) 06: { 07: String sfilename = "test.txt"; 08: String s0 = readstringfromfile(sfilename); 09: String s1 = readstringfromfile(sfilename); 10: 11: System.out.println("s0 == s1: " + (s0 == s1)); 12: System.out.println("s0.equals(s1): " + (s0.equals(s1))); 13: 14: s0.intern(); 15: s1.intern(); 16: 17: System.out.println("s0 == s1: " + (s0 == s1)); 18: System.out.println("s0 == s1.intern(): " + 19: (s0 == s1.intern())); 20: } 21: 22: private static String readstringfromfile (String sfilename) 23: { 24: // read string from file 25: } 26: } s0 s1 readstringfromfile(...) 9 String

8 1 s0 == s1: false s0.equals(s1): true s0 == s1: false s0 == s1.intern(): true 14 String s0 15 s1.intern() s s0 s1 String s0==s1 false s1.intern() s0 s0==s1.intern() true s1 s0 null garbage collector s0 String s0 s1.intern() equality comparison String.equals(...) == intern() n m String n.equals(m) n.intern() == m.intern() String.intern() Java Java primitive type Java strongly type building blocks 8 Java Java Java JVM boolean C C++ Java boolean boolean 0 false 0 true 8

9 Item 3: Java C value = get_value(); if (value) do_something; Java boolean value = getvalue(); if (value!= null) dosomething; Java boolean loss of precision Java arithmetic operation accidental truncation Truncation : public class Truncation 03: static void printfloat (float f) 04: { 05: System.out.println ("f = " + f); 06: } 07: 08: public static void main (String[] args) 09: { 10: printfloat (12 / 5); // data lost! 11: printfloat ((float) 12 / 5); 12: printfloat (12 / 5.0f); 13: } 14: } 12 5 integer 10 integer printfloat float float promote float

10 1 int byte int long float long double -46 public class LostPrecision { public static void main (String[] args) { int orig = ; float approx = orig; int rounded = (int) approx; // lost precision System.out.println (orig - rounded); } } Java narrowing 1.1 float double short int long overflow long short cast 10

11 Item 3: Java byte short char int TypeConversion byte : public class TypeConversion 03: static void convertarg (byte b) { } 04: 05: public static void main (String[] args) 06: { 07: byte b1 = 127; 08: // byte b2 = 128; // won't compile 09: 10: // convertarg (127); // won't compile 11: convertarg ((byte)127); 12: 13: byte c1 = b1; 14: // byte c2 = -b1; // won't compile 15: int i = ++b1; // overflow 16: System.out.println ("i = " + i); 17: } 18: } 3 Math.pow() double int int float short double 11

12 1 14 byte short char int 14 TypeConversion.java:14: possible loss of precision found : int required: byte b1 int int byte 15 byte int 16 i = 128 i = Bug Bug Bug 01: public class IntAdder 03: private int x; 04: private int y; 05: private int z; 06: 07: public void IntAdder() 08: { 09: x = 39; 10: y = 54; 11: z = x + y; 12: } 13: 14: public void printresults() 15: { 16: System.out.println("The value of 'z' is '" + z + "'"); 17: } 18: 19: public static void main (String[] args) 20: { 21: IntAdder ia = new IntAdder(); 22: ia.printresults(); 23: } 24: }

13 Item 4: IntAdder 3 private x y z printresults main 21 ia IntAdder 7 x y z 22 printresults z IntAdder The value of 'z' is '93' Bug The value of 'zé is '0' 21 IntAdder ia 7 IntAdder x y z 7 void IntAdder IntAdder void 7 IntAdder ia Java IntAdder public IntAdder() { } 21 ia x y z 0 22 printresults The value of 'z' is '0'. Bug IntAdder Java

14 1 Java Java Java RTF DocumentManager Document Document HTML HTML Document HTMLDocument Document Document DocumentManager HTMLDocument HTMLDocument HTML HTMLDocument Java HTMLDocument Doucment spellcheck() Document Document spellcheck() HTMLDocument Document Document Document Document spellcheck() Document Java

15 Item 5: super DocumentManager HTMLDocument HTMLDocument HTMLDocument spellcheck() Document spellcheck() super 01: class DocumentManager 03: public Document newdocument() 04: { 05: return (new HTMLDocument()); 06: } 07: } 08: 09: class Document 10: { 11: public boolean spellcheck() 12: { 13: return (true); 14: } 15: } 16: 17: class HTMLDocument extends Document 18: { 19: public boolean spellcheck() 20: { 21: System.out.println("Trouble checking these darn hyperlinks!"); 22: return (false); 23: } 24: } 25: 26: public class OverridingInstanceApp 27: { 28: public static void main (String args[]) 29: { 30: DocumentManager dm = new DocumentManager(); 15

16 1 31: Document d = dm.newdocument(); 32: boolean spellchecksuccessful = d.spellcheck(); 33: if (spellchecksuccessful) 34: System.out.println("No spelling errors where found."); 35: else 36: System.out.println("Document has spelling errors."); 37: } 38: } 32 Document spellcheck() HTMLDocument Trouble checking these darn hyperlinks! Document has spelling errors. Item spellcheck() public static boolean spellcheck(document d) 32 boolean spellchecksuccessful = d.spellcheck(d); No spelling errors where found. JavaSoft Java 2D Graphics2D JDK Graphics AWT paint(...) update(...) JDK Graphics2D Graphics2D Graphics draw3drect() Graphics2D draw3drect() Bug Graphics draw3drect() draw3drect() Graphics2D 16

17 Item 6: getclass().getname() Java 01: public class Wealthy 03: public String answer = "Yes!"; 04: public void wantmoney() 05: { 06: System.out.println("Would you like $1,000,000? > "+ answer); 07: } 08: public static void main(string[] args) 09: { 10: Wealthy w = new Wealthy(); 11: w.wantmoney(); 12: } 13: } Would you like $1,000,000? > Yes! Wealthy answer wantmoney main main Wealthy w w wantmoney answer 17

18 1 01: public class Poor 03: public String answer = "Yes!"; 04: public void wantmoney() 05: { 06: String answer = "No!"; // hides instance variable answer 07: System.out.println("Would you like $1,000,000? > " + answer); 08: } 09: public static void main(string[] args) 10: { 11: Poor p = new Poor(); 12: p.wantmoney(); 13: } 14: } Would you like $1,000,000? > No! No answer answer answer answer Java Java 18 Java 6

19 Item 6: try catch for 01: public class Types 03: int x; // instance variable 04: static int y; // class variable 05: public Types(String s) // s is a constructor parameter 06: { 07: // constructor code f. 08: } 09: public createurl(string urlstring) //urlstring is a method parameter 10: { 11: String name = "example"; // name is a local variable 12: try 13: { 14: URL url = new URL(urlString); 15: } 16: catch(exception e) // e is a exception-handler parameter 17: { 18: // handle exception 19: } 20: } 21: } 3 x x x y Types catch name 11 createurl createurl 19

20 1 01: class Hidden 03: public static void main(string[] args) 04: { 05: int args = 0; // illegal results in a compiler error 06: String s = "string"; 07: int s = 10; // illegal results in a compiler error 08: } 09: } 5 args 7 s catch 01: public class Bike 03: String type; 04: public Bike(String type) 05: { 06: System.out.println("type =" + type); 07: } 08: } 20

21 Item 6: type type System.out.println type type type 01: public class Bike 03: String type = "generic"; 04: } 01: public class MountainBike extends Bike 03: String type = "All terrain"; 04: } Bike type MoutainByte type 01: public interface Stretchable 03: int y 04: } 01: public class Line 03: int x; 04: } 01: public class MultiLine extends Line implements Stretchable 03: public MultiLine() 04: { 05: System.out.println("x = " + x); 06: } 07: } Strectchable x MultiLine x 21

22 1 this super. 01: public class Wealthy 03: public String answer = "Yes!"; 04: public void wantmoney() 05: { 06: String answer = "No!"; 07: System.out.println("Do you want to give me $1,000,000? > " + 08: answer); 09: System.out.println("Would you like $1,000,000? > " + 10: this.answer); 11: } 12: public static void main(string[] args) 13: { 14: Wealthy w = new Wealthy(); 15: w.wantmoney(); 16: } 17: } Do you want to give me $1,000,000 > No! Would you like $1,000,000? > Yes! Wealthy answer wantmoney answer wantmoney answer answer this answer answer answer answer this 01: public class StillWealthy extends Wealthy 03: public String answer = "No!"; 22

23 Item 6: 04: public void wantmoney() 05: { 06: String answer = "maybe?"; 07: System.out.println("Did you see that henway? > " + answer); 08: System.out.println("Do you want to give me $1,000,000? > " + 09: this.answer); 10: System.out.println("Would you like $1,000,000? > " + super.answer); 11: } 12: public static void main(string[] args) 13: { 14: Wealthy w = new Wealthy(); 15: w.wantmoney(); 16: } 17: } Did you see that henway? > maybe? Do you want to give me $1,000,000 > No! Would you like $1,000,000? > Yes! 7 answer 8 StillWealthy this 10 Wealthy super 01: public class Wealthier extends Wealthy 03: public void wantmoney() 04: { 05: System.out.println("Would you like $2,000,000? > " + answer); 06: } 07: public static void main(string[] args) 08: { 09: Wealthier w = new Wealthier(); 10: w.wantmoney(); 11: ((Wealthy)w).wantMoney(); 12: } 13: } 23

24 1 Would you like $2,000,000? > Yes! Would you like $2,000,000? > Yes! Wealthier Wealthy wantmoney main Wealthier w wantmoney() main w Wealthy wantmoney() 01: public class Poorer extends Wealthier 03: String answer = "No!"; 04: public void wantmoney() 05: { 06: System.out.println("Would you like $3,000,000? > " + answer); 07: } 08: public static void main(string[] args) 09: { 10: Poorer p = new Poorer(); 11: ((Wealthier)p).wantMoney(); 12: System.out.println("Are you sure? > " + ((Wealthier)p).answer); 13: } 14: } Do you want $3,000,000?? No! Are you sure? > Yes! Poorer Wealthier main Poorer p p wantmoney wantmoney 11 Poorer wantmoney No! main Are you sure?> 24

25 Item 7: JVM Java 8.5 1: public class ForwardReference 2: { 3: int first = second; // this will fail to compile 4: int second = 2; 5: } ForwardReference.java:3: Can't make forward reference to second in class ForwardReference. first second Java Java 01: public class ForwardReferenceViaMethod 03: static int first = accesstoosoon(); 04: static int second = 1; 05: 06: static int accesstoosoon() 07: { 25

26 1 08: return (second); 09: } 10: 11: public static void main (String[] args) 12: { 13: System.out.println ("first = " + first); 14: } 15: } second accesstoosoon second 0 first 0 1 Java 01: import java.awt.*; 02: import java.awt.event.*; 03: import java.io.*; 04: import java.util.*; 26

27 Item 8: 05: 06: import javax.swing.*; 07: import javax.swing.event.*; 08: 09: public class ListDialog extends JDialog 10: implements ActionListener, ListSelectionListener 11: { 12: JList model; 13: JButton selectbutton; 14: LDListener listener; 15: Object[] selections; 16: 17: public ListDialog (String title, 18: String[] items, 19: LDListener listener) 20: { 21: super ((Frame)null, title); 22: 23: JPanel buttonpane = new JPanel (); 24: selectbutton = new JButton ("SELECT"); 25: selectbutton.addactionlistener (this); 26: selectbutton.setenabled (false);//nothing selected yet 27: buttonpane.add (selectbutton); 28: 29: JButton cancelbutton = new JButton ("CANCEL"); 30: cancelbutton.addactionlistener (this); 31: buttonpane.add (cancelbutton); 32: 33: this.getcontentpane().add (buttonpane, BorderLayout.SOUTH); 34: 35: this.listener = listener; 36: setmodel (items); 37: } 38: 39: void setmodel (String[] items) 40: { 41: if (this.model!= null) 42: this.model.removelistselectionlistener (this); 43: this.model = new JList (items); 44: model.addlistselectionlistener (this); 45: 46: JScrollPane scroll = new JScrollPane (model); 47: this.getcontentpane().add (scroll, BorderLayout.CENTER); 48: this.pack(); 49: } 50: 51: /** Implement ListSelectionListener. Track user selections. */ 52: 53: public void valuechanged (ListSelectionEvent e) 54: { 55: selections = model.getselectedvalues(); 27

28 1 56: if (selections.length > 0) 57: selectbutton.setenabled (true); 58: } 59: 60: /** Implement ActionListener. Called when the user picks the 61: * SELECT or CANCEL button. Generates the LDEvent. */ 62: 63: public void actionperformed (ActionEvent e) 64: { 65: this.setvisible (false); 66: String buttonlabel = e.getactioncommand(); 67: if (buttonlabel.equals ("CANCEL")) 68: selections = null; 69: if (listener!= null) 70: { 71: LDEvent lde = new LDEvent (this, selections); 72: listener.listdialogselection (lde); 73: } 74: } 75: 76: public static void main (String[] args) // self-testing code 77: { 78: String[] items = (new String[] 79: {"Forest", "Island", "Mountain", "Plains", "Swamp"}); 80: LDListener listener = 81: new LDListener() 82: { 83: public void listdialogselection (LDEvent e) 84: { 85: Object[] selected = e.getselection(); 86: if (selected!= null) // null if user cancels 87: for (int i = 0; i < selected.length; i++) 88: System.out.println (selected[i].tostring()); 89: System.exit (0); 90: } 91: }; 92: 93: ListDialog dialog = 94: new ListDialog ("ListDialog", items, listener); 95: dialog.show(); 96: } 97: } LDListener LDEvent 01: public interface LDListener 03: public void listdialogselection (LDEvent e); 04: } 01: import java.util.eventobject; 28

29 Item 8: 02: 03: public class LDEvent extends java.util.eventobject 04: { 05: Object source; 06: Object[] selections; 07: 08: public LDEvent (Object source, Object[] selections) 09: { 10: super (source); 11: this.selections = selections; 12: } 13: 14: public Object[] getselection() 15: { 16: return (selections); 17: } 18: } ListDialog API ListDialog ListSelectionEvents 44 addlistselectionlistener(...) model private ListDialog 17 String super(...) ListDialog Javadoc setmodel(...) items ListDialog setmodel(...) 01: public SoundDialog (String title, LDListener listener, 02: String path) 03: { 04: super (title, null, listener); 29

30 1 05: String[] items = getitems (path); 06: setmodel (items); 07: model.addlistselectionlistener (this); 08: model.setselectionmode (ListSelectionModel.SINGLE_SELECTION); 09: } Exception occurred during event dispatching: java.lang.nullpointerexception... at java.awt.window.pack(window.java:259) at ListDialog.setModel(ListDialog.java:48) at ListDialog.<init>(ListDialog.java:36) at SoundDialog.<init>(SoundDialog.java:18) at SoundDialog.main(SoundDialog.java:89) ListDialog setmodel(...) NullPointerException model item JList pack() ListDialog setmodel(...) private 01: import java.applet.*; 02: import java.awt.*; 03: import java.io.*; 04: import java.net.*; 05: 06: import javax.swing.*; 07: import javax.swing.event.*; 08: 09: public class SoundDialog extends ListDialog 10: implements FilenameFilter, ListSelectionListener 11: { 12: String selection; 13: 14: public SoundDialog (String title, LDListener ldl, String path) 15: { 16: super (title, null, ldl); 17: String[] items = getitems (path); 18: setmodel (items); 19: } 30

31 20: 21: public void setmodel (String[] items) 22: { 23: if (items!= null) 24: { 25: super.setmodel (items); 26: model.addlistselectionlistener (this); 27: model.setselectionmode 28: (ListSelectionModel.SINGLE_SELECTION); 29: } 30: } 31: 32: public String[] getitems (String path) 33: { 34: File file = new File (path); 35: File soundfiles[] = file.listfiles (this); 36: String[] items = new String [soundfiles.length]; 37: for (int i = 0; i < soundfiles.length; i++) 38: items = soundfiles.getname(); 39: return (items); 40: } 41: 42: // implement FilenameFilter 43: public boolean accept (File dir, String name) 44: { 45: return (name.endswith (".aiff") 46: name.endswith (".au") 47: name.endswith (".midi") 48: name.endswith (".rmf") 49: name.endswith (".wav")); 50: } 51: 52: // implement ListSelectionListener 53: public void valuechanged (ListSelectionEvent e) 54: { 55: super.valuechanged (e); 6: JList items = (JList) e.getsource(); 57: String filename = items.getselectedvalue().tostring(); 58: if (!filename.equals (selection)) 59: { 60: selection = filename; 61: play (selection); 62: } 63: } 64: 65: private void play (String filename) 66: { 67: try 68: { 69: File file = new File (filename); 70: URL url = new URL ("file://" + file.getabsolutepath()); Item 8: 31

32 1 71: AudioClip audioclip = Applet.newAudioClip (url); 72: if (audioclip!= null) 73: audioclip.play(); 74: } 75: catch (MalformedURLException e) 76: { 77: System.err.println (e + ": " + e.getmessage()); 78: } 79: } 80: 81: public static void main (String[] args) // self-test 82: { 83: LDListener listener = 84: new LDListener() 85: { 86: public void listdialogselection (LDEvent e) 87: { 88: Object[] selected = e.getselection(); 89: if (selected!= null) // null if user cancels 90: for (int i = 0; i < selected.length; i++) 91: System.out.println (selected[i].tostring()); 92: System.exit (0); 93: } 94: }; 95: SoundDialog dialog = 96: new SoundDialog ("SoundDialog", listener, "."); 97: dialog.show(); 98: } 99: } 32 ListDialog private public

33 Item 9: Swing JList JList JList setlistdata(...) setmodel(...) Swing C C++ Java Java pointer arithmetic Java Java Java Java Java boolean byte short int long char float double Hashtable PassPrimitiveByReference1 Hashtable.put() getpersoninfo() 33

34 1 Java getpersoninfo() 01: import java.util.hashtable; 02: 03: public class PassPrimitiveByReference1 04: { 05: public static void main (String args[]) 06: { 07: String name = null; 08: int age = 0; 09: float weight = 0f; 10: boolean ismarried = false; 11: 12: getpersoninfo(name, age, weight, ismarried); 13: 14: System.out.println("Name: " + name + 15: "\nage: " + age + 16: "\nweight: " + weight + 17: "\nis Married: " + ismarried); 18: 19: storepersoninfo(name, age, weight, ismarried); 20: } 21: 22: private static void getpersoninfo(string name, int age, 23: float weight, boolean ismarried) 24: { 25: name = "Robert Smith"; 26: age = 26; 27: weight = 182.7f; 28: ismarried = true; 29: } 30: 31: private static void storepersoninfo (String name, int age, 32: float weight, boolean ismarried) 33: { 34: Hashtable h = new Hashtable(); 35: h.put("name", name); 36: h.put("age", age); // produces compile time error 37: h.put("weight", weight); // produces compile time error 38: h.put("ismarried", ismarried); // produces compile time error 39: } 40: } PassPrimitiveByReference2 PassPrimitiveByReference1 Java 34

35 Item 9: Hashtable.put() java.lang int Integer float Float boolean Boolean set(...) 1 getpersoninfo() 01: import java.util.hashtable; 02: 03: public class PassPrimitiveByReference2 04: { 05: public static void main (String args[]) 06: { 07: String[] name = new String[1]; 08: int[] age = new int[1]; 09: float[] weight = new float[1]; 10: boolean[] ismarried = new boolean[1]; 11: 12: getpersoninfo(name, age, weight, ismarried); 13: 14: System.out.println("Name: " + name[0] + 15: "\nage: " + age[0] + 16: "\nweight: " + weight[0] + 17: "\nis Married: " + ismarried[0]); 18: 19: String name2 = name[0]; 20: Integer age2 = new Integer(age[0]); 21: Float weight2 = new Float(weight[0]); 22: Boolean ismarried2 = new Boolean(isMarried[0]); 23: 24: storepersoninfo(name2, age2, weight2, ismarried2); 25: } 26: 27: private static void getpersoninfo (String[] name, int[] age, 28: float[] weight, boolean[] ismarried) 29: { 30: name[0] = "Robert Smith"; 31: age[0] = 26; 32: weight[0] = 182.7f; 33: ismarried[0] = true; 34: } 35

36 1 35: 36: private static void storepersoninfo (String name, Integer age, 37: Float weight, Boolean ismarried) 38: { 39: Hashtable h = new Hashtable(); 40: h.put("name", name); 41: h.put("age", age); 42: h.put("weight", weight); 43: h.put("ismarried", ismarried); 44: } 45: } PassPrimitiveByReference2 Name: Robert Smith Age: 26 Weight: Is Married: true Java C++ C Java & C++ Java & && C++ if (ptr!= null & ptr->count > 1) // wrong operator! Gnu C warning: suggest parentheses around comparison in operand of & ptr null 36

37 Item 10: Java boolean & Java Vector if ((v!= null) & (v.size() > 0)) // wrong operator! v null NullPointerException short-circuit && if ((v!= null) && (v.size() > 0)) true && & 37

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

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

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

Fun Time (1) What happens in memory? 1 i n t i ; 2 s h o r t j ; 3 double k ; 4 char c = a ; 5 i = 3; j = 2; 6 k = i j ; H.-T. Lin (NTU CSIE) Referenc

Fun Time (1) What happens in memory? 1 i n t i ; 2 s h o r t j ; 3 double k ; 4 char c = a ; 5 i = 3; j = 2; 6 k = i j ; H.-T. Lin (NTU CSIE) Referenc References (Section 5.2) Hsuan-Tien Lin Deptartment of CSIE, NTU OOP Class, March 15-16, 2010 H.-T. Lin (NTU CSIE) References OOP 03/15-16/2010 0 / 22 Fun Time (1) What happens in memory? 1 i n t i ; 2

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

chp6.ppt

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

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 : 1Z0-854 Title : Java Standard Edition 5 Programmer Certified Professional Upgrade Exam Version : Demo 1 / 12 1.Given: 20. public class CreditCard

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

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

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

More information

D C 93 2

D C 93 2 D9223468 3C 93 2 Java Java -- Java UML Java API UML MVC Eclipse API JavadocUML Omendo PSPPersonal Software Programming [6] 56 8 2587 56% Java 1 epaper(2005 ) Java C C (function) C (reusability) eat(chess1,

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Chapter 9: Objects and Classes

Chapter 9: Objects and Classes What is a JavaBean? JavaBean Java JavaBean Java JavaBean JComponent tooltiptext font background foreground doublebuffered border preferredsize minimumsize maximumsize JButton. Swing JButton JButton() JButton(String

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

概述

概述 OPC Version 1.6 build 0910 KOSRDK Knight OPC Server Rapid Development Toolkits Knight Workgroup, eehoo Technology 2002-9 OPC 1...4 2 API...5 2.1...5 2.2...5 2.2.1 KOS_Init...5 2.2.2 KOS_InitB...5 2.2.3

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

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

javaexample-02.pdf

javaexample-02.pdf n e w. s t a t i c s t a t i c 3 1 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

More information

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

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

More information

FileMaker 16 ODBC 和 JDBC 指南

FileMaker 16 ODBC 和 JDBC 指南 FileMaker 16 ODBC JDBC 2004-2017 FileMaker, Inc. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker FileMaker Go FileMaker, Inc. FileMaker WebDirect FileMaker Cloud FileMaker,

More information

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

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

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

《大话设计模式》第一章

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

More information

mvc

mvc Build an application Tutor : Michael Pan Application Source codes - - Frameworks Xib files - - Resources - ( ) info.plist - UIKit Framework UIApplication Event status bar, icon... delegation [UIApplication

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

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

利用Java技术编写桌面软件基础

利用Java技术编写桌面软件基础 利 用 Java 技 术 编 写 桌 面 软 件 基 础 在 学 习 Java 编 程 语 言 的 细 节 和 语 法 时, 我 们 会 碰 到 这 样 一 个 问 题 : 开 发 桌 面 应 用 软 件 需 要 使 用 哪 些 Java 技 术, 应 当 引 入 哪 些 package? 这 一 问 题 的 答 案 取 决 于 开 发 的 应 用 软 件 类 型 和 它 的 作 用 这 篇 文 章

More information

FileMaker 15 ODBC 和 JDBC 指南

FileMaker 15 ODBC 和 JDBC 指南 FileMaker 15 ODBC JDBC 2004-2016 FileMaker, Inc. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker FileMaker Go FileMaker, Inc. / FileMaker WebDirect FileMaker, Inc. FileMaker

More information

FY.DOC

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

More information

科学计算的语言-FORTRAN95

科学计算的语言-FORTRAN95 科 学 计 算 的 语 言 -FORTRAN95 目 录 第 一 篇 闲 话 第 1 章 目 的 是 计 算 第 2 章 FORTRAN95 如 何 描 述 计 算 第 3 章 FORTRAN 的 编 译 系 统 第 二 篇 计 算 的 叙 述 第 4 章 FORTRAN95 语 言 的 形 貌 第 5 章 准 备 数 据 第 6 章 构 造 数 据 第 7 章 声 明 数 据 第 8 章 构 造

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

尽 管 Java 语 言 是 在 C++ 语 言 基 础 上 发 展 起 来 的, 但 是 有 别 于 C++,Java 是 一 种 纯 粹 的 面 向 对 象 语 言 (Object-oriented language) 在 像 Java 这 样 纯 粹 的 面 向 对 象 语 言 中, 所 有

尽 管 Java 语 言 是 在 C++ 语 言 基 础 上 发 展 起 来 的, 但 是 有 别 于 C++,Java 是 一 种 纯 粹 的 面 向 对 象 语 言 (Object-oriented language) 在 像 Java 这 样 纯 粹 的 面 向 对 象 语 言 中, 所 有 玩 转 Object 不 理 解, 就 无 法 真 正 拥 有 歌 德 按 其 实 而 审 其 名, 以 求 其 情 ; 听 其 言 而 查 其 累, 无 使 放 悖 ( 根 据 实 际 明 辨 名 称, 以 便 求 得 真 实 情 况 ; 听 取 言 辞 后 弄 明 它 的 类 别, 不 让 它 混 淆 错 乱 ) 三 玩 转 Object 大 围 山 人 玩 转 Object...1 1. 通

More information

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

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

More information

基于ECO的UML模型驱动的数据库应用开发1.doc

基于ECO的UML模型驱动的数据库应用开发1.doc ECO UML () Object RDBMS Mapping.Net Framework Java C# RAD DataSetOleDbConnection DataGrod RAD Client/Server RAD RAD DataReader["Spell"].ToString() AObj.XXX bug sql UML OR Mapping RAD Lazy load round trip

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

Important Notice SUNPLUS TECHNOLOGY CO. reserves the right to change this documentation without prior notice. Information provided by SUNPLUS TECHNOLO

Important Notice SUNPLUS TECHNOLOGY CO. reserves the right to change this documentation without prior notice. Information provided by SUNPLUS TECHNOLO Car DVD New GUI IR Flow User Manual V0.1 Jan 25, 2008 19, Innovation First Road Science Park Hsin-Chu Taiwan 300 R.O.C. Tel: 886-3-578-6005 Fax: 886-3-578-4418 Web: www.sunplus.com Important Notice SUNPLUS

More information

RUN_PC連載_12_.doc

RUN_PC連載_12_.doc PowerBuilder 8 (12) PowerBuilder 8.0 PowerBuilder PowerBuilder 8 PowerBuilder 8 / IDE PowerBuilder PowerBuilder 8.0 PowerBuilder PowerBuilder PowerBuilder PowerBuilder 8.0 PowerBuilder 6 PowerBuilder 7

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

雲端 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

2009年9月全国计算机等级考试二级Java真题及答案

2009年9月全国计算机等级考试二级Java真题及答案 2009 年 9 月 全 国 计 算 机 等 级 考 试 二 级 Java 真 题 及 答 案 [ 录 入 者 :NCRE100 时 间 :2009-10-08 19:41:34 作 者 : 来 源 :NCRE100.com 浏 览 :1421 次 ] 2009 年 9 月 全 国 计 算 机 等 级 考 试 二 级 笔 试 试 卷 Java 语 言 程 序 设 计 ( 考 试 时 间 90 分 钟,

More information

尽 管 Java 语 言 是 在 C++ 语 言 基 础 上 发 展 起 来 的, 但 与 C++ 不 同,Java 是 一 种 纯 粹 的 面 向 对 象 语 言 (Object-oriented language) 在 Java 世 界 中, 所 有 事 物 都 是 Object 1. 通 过

尽 管 Java 语 言 是 在 C++ 语 言 基 础 上 发 展 起 来 的, 但 与 C++ 不 同,Java 是 一 种 纯 粹 的 面 向 对 象 语 言 (Object-oriented language) 在 Java 世 界 中, 所 有 事 物 都 是 Object 1. 通 过 玩 转 Object 不 理 解, 就 无 法 真 正 拥 有 歌 德 按 其 实 而 审 其 名, 以 求 其 情 ; 听 其 言 而 查 其 累, 无 使 放 悖 ( 根 据 实 际 明 辨 名 称, 以 便 求 得 真 实 情 况 ; 听 取 言 辞 后 弄 明 它 的 类 别, 不 让 它 混 淆 错 乱 ) 三 玩 转 Object 大 围 山 人 玩 转 Object...1 1. 通

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

内 容 提 要 将 JAVA 开 发 环 境 迁 移 到 Linux 系 统 上 是 现 在 很 多 公 司 的 现 实 想 法, 而 在 Linux 上 配 置 JAVA 开 发 环 境 是 步 入 Linux 下 JAVA 程 序 开 发 的 第 一 步, 本 文 图 文 并 茂 地 全 程 指

内 容 提 要 将 JAVA 开 发 环 境 迁 移 到 Linux 系 统 上 是 现 在 很 多 公 司 的 现 实 想 法, 而 在 Linux 上 配 置 JAVA 开 发 环 境 是 步 入 Linux 下 JAVA 程 序 开 发 的 第 一 步, 本 文 图 文 并 茂 地 全 程 指 内 容 提 要 将 JAVA 开 发 环 境 迁 移 到 Linux 系 统 上 是 现 在 很 多 公 司 的 现 实 想 法, 而 在 Linux 上 配 置 JAVA 开 发 环 境 是 步 入 Linux 下 JAVA 程 序 开 发 的 第 一 步, 本 文 图 文 并 茂 地 全 程 指 导 你 搭 建 Linux 平 台 下 的 JAVA 开 发 环 境, 包 括 JDK 以 及 集

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

(京)新登字063号

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

More information

27 :OPC 45 [4] (Automation Interface Standard), (Costom Interface Standard), OPC 2,,, VB Delphi OPC, OPC C++, OPC OPC OPC, [1] 1 OPC 1.1 OPC OPC(OLE f

27 :OPC 45 [4] (Automation Interface Standard), (Costom Interface Standard), OPC 2,,, VB Delphi OPC, OPC C++, OPC OPC OPC, [1] 1 OPC 1.1 OPC OPC(OLE f 27 1 Vol.27 No.1 CEMENTED CARBIDE 2010 2 Feb.2010!"!!!!"!!!!"!" doi:10.3969/j.issn.1003-7292.2010.01.011 OPC 1 1 2 1 (1., 412008; 2., 518052), OPC, WinCC VB,,, OPC ; ;VB ;WinCC Application of OPC Technology

More information

PowerPoint 簡報

PowerPoint 簡報 Paint 繪圖板 JAVA 程式設計 指導老師 : 鄞宗賢 組員 : 4A3G0901 劉彥佐 4A3G0907 韓偉志 畫面預覽 匯入參數 package paint; import java.awt.*; import java.awt.event.*; import javax.swing.*; 主程式 public class paint{ public static void main(string[]

More information

untitled

untitled JavaEE+Android - 6 1.5-2 JavaEE web MIS OA ERP BOSS Android Android Google Map office HTML CSS,java Android + SQL Sever JavaWeb JavaScript/AJAX jquery Java Oracle SSH SSH EJB+JBOSS Android + 1. 2. IDE

More information

(Microsoft Word - \272\364\263q\245|\244A_49636107_\304\254\253\330\336\263__\272\353\302\262\263\370\247i.doc)

(Microsoft Word - \272\364\263q\245|\244A_49636107_\304\254\253\330\336\263__\272\353\302\262\263\370\247i.doc) SCJP (Oracle Certified Professional, Java SE5/6 Programmer) 學 制 / 班 級 : 四 年 制 / 網 通 四 乙 指 導 老 師 : 方 信 普 老 師 學 生 學 號 / 姓 名 : 49636107 蘇 建 瑋 繳 交 年 份 : 100 年 6 月 一 SCJP 介 紹 SCJP 是 Sun Certified Java Programmer

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

Microsoft Word - 苹果脚本跟我学.doc

Microsoft Word - 苹果脚本跟我学.doc AppleScript for Absolute Starters 2 2 3 0 5 1 6 2 10 3 I 13 4 15 5 17 6 list 20 7 record 27 8 II 32 9 34 10 36 11 44 12 46 13 51 14 handler 57 15 62 63 3 AppleScript AppleScript AppleScript AppleScript

More information

Microsoft Word - 物件導向編程精要.doc

Microsoft Word - 物件導向編程精要.doc Essential Object-Oriented Programming Josh Ko 2007.03.11 object-oriented programming C++ Java OO class object OOP Ruby duck typing complexity abstraction paradigm objects objects model object-oriented

More information

IoC容器和Dependency Injection模式.doc

IoC容器和Dependency Injection模式.doc IoC Dependency Injection /Martin Fowler / Java Inversion of Control IoC Dependency Injection Service Locator Java J2EE open source J2EE J2EE web PicoContainer Spring Java Java OO.NET service component

More information

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

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

More information

Microsoft Word - 把时间当作朋友(2011第3版)3.0.b.06.doc

Microsoft Word - 把时间当作朋友(2011第3版)3.0.b.06.doc 2 5 8 11 0 13 1. 13 2. 15 3. 18 1 23 1. 23 2. 26 3. 28 2 36 1. 36 2. 39 3. 42 4. 44 5. 49 6. 51 3 57 1. 57 2. 60 3. 64 4. 66 5. 70 6. 75 7. 83 8. 85 9. 88 10. 98 11. 103 12. 108 13. 112 4 115 1. 115 2.

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

c_cpp

c_cpp C C++ C C++ C++ (object oriented) C C++.cpp C C++ C C++ : for (int i=0;i

More information

Microsoft Word - Broker.doc

Microsoft Word - Broker.doc Broker 模式 采用 broker 模式对分布式计算进行简单模拟 系统在一个进程内模拟分布式环境, 因此不涉及网络编程和进程间通信,Broker 通过本地函数调用的方式实现 request 和 response 的转发 采用 broker 模式对分布式计算进行简单的模拟, 要求如下 : 设计四个 server, 一个 server 接收两个整数, 求和并返回结果, 一个 server 接收两个整数,

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

epub83-1

epub83-1 C++Builder 1 C + + B u i l d e r C + + B u i l d e r C + + B u i l d e r C + + B u i l d e r 1.1 1.1.1 1-1 1. 1-1 1 2. 1-1 2 A c c e s s P a r a d o x Visual FoxPro 3. / C / S 2 C + + B u i l d e r / C

More information

Chapter 9: Objects and Classes

Chapter 9: Objects and Classes (Swing) AWTEvent Font LayoutManager 1 Classes in the javax.swing package Heavyweight FontMetrics Object Color Panel Applet JApplet Graphics Component Container Window Frame JFrame * Dialog JDialog JComponent

More information

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

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

More information

epub 94-3

epub 94-3 3 A u t o C A D L AY E R L I N E T Y P E O S N A P S T Y L E X R E F - AutoLISP Object ARX A u t o C A D D C L A u t o C A D A u t o d e s k P D B D C L P D B D C L D C L 3.1 Wi n d o w s A u t o C A D

More information

RunPC2_.doc

RunPC2_.doc PowerBuilder 8 (5) PowerBuilder Client/Server Jaguar Server Jaguar Server Connection Cache Thin Client Internet Connection Pooling EAServer Connection Cache Connection Cache Connection Cache Connection

More information

<4D6963726F736F667420576F7264202D20C8EDC9E82DCFC2CEE7CCE22D3039C9CF>

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

More information

untitled

untitled ArcGIS Server Web services Web services Application Web services Web Catalog ArcGIS Server Web services 6-2 Web services? Internet (SOAP) :, : Credit card authentication, shopping carts GIS:, locator services,

More information

无类继承.key

无类继承.key 无类继承 JavaScript 面向对象的根基 周爱 民 / aimingoo aiming@gmail.com https://aimingoo.github.io https://github.com/aimingoo rand = new Person("Rand McKinnon",... https://docs.oracle.com/cd/e19957-01/816-6408-10/object.htm#1193255

More information

(procedure-oriented)?? 2

(procedure-oriented)?? 2 1 (procedure-oriented)?? 2 (Objected-Oriented) (class)? (method)? 3 : ( 4 ???? 5 OO 1966 Kisten Nygaard Ole-Johan Dahl Simula Simula 爲 6 Smalltalk Alan Kay 1972 PARC Smalltalk Smalltalk 爲 Smalltalk 爲 Smalltalk

More information

C++ 程式設計

C++ 程式設計 C C 料, 數, - 列 串 理 列 main 數串列 什 pointer) 數, 數, 數 數 省 不 不, 數 (1) 數, 不 數 * 料 * 數 int *int_ptr; char *ch_ptr; float *float_ptr; double *double_ptr; 數 (2) int i=3; int *ptr; ptr=&i; 1000 1012 ptr 數, 數 1004

More information

PowerPoint Presentation

PowerPoint Presentation Visual Basic 2005 學 習 範 本 第 7 章 陣 列 的 活 用 7-1 陣 列 當 我 們 需 要 處 理 資 料 時, 都 使 用 變 數 來 存 放 資 料 因 為 一 個 變 數 只 能 代 表 一 個 資 料, 若 需 要 處 理 100 位 同 學 的 成 績 時, 便 要 使 用 100 個 不 同 的 變 數 名 稱, 這 不 但 會 增 加 變 數 名 稱 命 名

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

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

untitled

untitled 1 .NET 利 [] [] 來 說 切 切 理 [] [ ] 來 說 拉 類 類 [] [ ] 列 連 Web 行流 來 了 不 不 不 流 立 行 Page 類 Load 理 Response 類 Write 料 Redirect URL Response.Write("!! ives!!"); Response.Redirect("WebForm2.aspx"); (1) (2) Web Form

More information

ebook8-30

ebook8-30 3 0 C C C C C C++ C + + C++ GNU C/C++ GNU egcs UNIX shell s h e l l g a w k P e r l U N I X I / O UNIX shell awk P e r l U N I X C C C C C C U N I X 30.1 C C U N I X 70 C C U N I X U N I X U N I X C Dennis

More information

RxJava

RxJava RxJava By 侦跃 & @hi 头 hi RxJava 扩展的观察者模式 处 观察者模式 Observable 发出事件 Subscriber 订阅事件 bus.post(new AnswerEvent(42)); @Subscribe public void onanswer(answerevent event) {! }! Observable observable = Observable.create(new

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

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

1 LINUX IDE Emacs gcc gdb Emacs + gcc + gdb IDE Emacs IDE C Emacs Emacs IDE ICE Integrated Computing Environment Emacs Unix Linux Emacs Emacs Emacs Un

1 LINUX IDE Emacs gcc gdb Emacs + gcc + gdb IDE Emacs IDE C Emacs Emacs IDE ICE Integrated Computing Environment Emacs Unix Linux Emacs Emacs Emacs Un Linux C July 27, 2016 Contents 1 Linux IDE 1 2 GCC 3 2.1 hello.c hello.exe........................... 5 2.2............................... 9 2.2.1 -Wall................................ 9 2.2.2 -E..................................

More information

RUN_PC連載_8_.doc

RUN_PC連載_8_.doc PowerBuilder 8 (8) Web DataWindow ( ) DataWindow Web DataWindow Web DataWindow Web DataWindow PowerDynamo Web DataWindow / Web DataWindow Web DataWindow Wizard Web DataWindow Web DataWindow DataWindow

More information

ThreeDtunnel.doc

ThreeDtunnel.doc (12) 1 1. Visual Basic Private Sub LoadDatabase() Dim strip As String Dim straccount As String Dim strpassword As String Dim strdatabase As String Dim strtable As String Dim strsql As String Dim strtemp1

More information

Microsoft PowerPoint - plan08.ppt

Microsoft PowerPoint - plan08.ppt 程 序 设 计 语 言 原 理 Principle of Programming Languages 裘 宗 燕 北 京 大 学 数 学 学 院 2012.2~2012.6 8. 面 向 对 象 为 什 么 需 要 面 向 对 象? OO 语 言 的 发 展 面 向 对 象 的 基 本 概 念 封 装 和 继 承 初 始 化 和 终 结 处 理 动 态 方 法 约 束 多 重 继 承 总 结 2012

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

untitled

untitled 1 LinkButton LinkButton 連 Button Text Visible Click HyperLink HyperLink 來 立 連 Text ImageUrl ( ) NavigateUrl 連 Target 連 _blank _parent frameset _search _self 連 _top 例 sample2-a1 易 連 private void Page_Load(object

More information

ebook

ebook 26 JBuilder RMI Java Remote Method Invocation R M I J a v a - - J a v a J a v J a v a J a v a J a v a R M I R M I ( m a r s h a l ) ( u n m a r c h a l ) C a ff e i n e J a v a j a v a 2 i i o p J a v

More information

SDK 概要 使用 Maven 的用户可以从 Maven 库中搜索 "odps-sdk" 获取不同版本的 Java SDK: 包名 odps-sdk-core odps-sdk-commons odps-sdk-udf odps-sdk-mapred odps-sdk-graph 描述 ODPS 基

SDK 概要 使用 Maven 的用户可以从 Maven 库中搜索 odps-sdk 获取不同版本的 Java SDK: 包名 odps-sdk-core odps-sdk-commons odps-sdk-udf odps-sdk-mapred odps-sdk-graph 描述 ODPS 基 开放数据处理服务 ODPS SDK SDK 概要 使用 Maven 的用户可以从 Maven 库中搜索 "odps-sdk" 获取不同版本的 Java SDK: 包名 odps-sdk-core odps-sdk-commons odps-sdk-udf odps-sdk-mapred odps-sdk-graph 描述 ODPS 基础功能的主体接口, 搜索关键词 "odpssdk-core" 一些

More information

附录J:Eclipse教程

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

More information

A Preliminary Implementation of Linux Kernel Virus and Process Hiding

A Preliminary Implementation of Linux Kernel Virus and Process Hiding 邵 俊 儒 翁 健 吉 妍 年 月 日 学 号 学 号 学 号 摘 要 结 合 课 堂 知 识 我 们 设 计 了 一 个 内 核 病 毒 该 病 毒 同 时 具 有 木 马 的 自 动 性 的 隐 蔽 性 和 蠕 虫 的 感 染 能 力 该 病 毒 获 得 权 限 后 会 自 动 将 自 身 加 入 内 核 模 块 中 劫 持 的 系 统 调 用 并 通 过 简 单 的 方 法 实 现 自 身 的

More information