0% found this document useful (0 votes)
30 views3 pages

Final Exam

Uploaded by

istudy539
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views3 pages

Final Exam

Uploaded by

istudy539
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Final exam

while do-while while v.s. do-while

while will check if the judge is right or not before the loop is work. do-while will
check if the judge is right after the loop is finish.

for v.s while

for will list out all the working of loop at the beginning. while will only list the judge
out. row major

can the code run?

No, the invocation is ambiguous, resulting in compiling error max(1, 2);


public static max(double qq, int ww){
//statement
}
public static max(int qq, double ww){
//statement
}
FileInputStreamFilterInputStream

FileInputStream is for reading a file. The input will be bytes. FilterInputStream is for
reading informations( The input ways are not limited in file input ). However, the
Filter Stream will change the bytes into useful type. Such as integers, doubles, or
strings.
TextField 與 TextArea 差別
TextField is for oneline texting.
TextArea is for block texting.( Multiply line input )
Polymorphism 是啥
Polymorphism means that a variable of a supertype can refer to a subtype object.
Polymorphism 代表著超類的變數可以引用子類物件。
inner class 編譯後會產生甚麼名稱
OuterClassName $ InnerClassName
RuntimeException
ArithmeticException NullPointerException IndexOutOfBoundsException
IllegalArgumentException more…
Pane 寫三個
FlowPane GridPane BorderPane HBox VBox StackPane abstract class 不能創造物件
的 class, 但可 contain abstract methods that are implemented in concrete
subclasses. interface An interface is a class-like constructor for defining common
operations for objects. shallow copy V.S deep copy Shallow copy Copy A objects’ data
to B objects’ means B objects’ pointer point to the memory place that puts the data.
This will cause the change in object A if B object change the data. Deep copy Copy A
objects’ by clone the whole object to B object. The object in B is uncommitted with
A.
Override V.S Overload
Overload define multiple methods with the same name but different signatures
Override provide a new implementation for a method in the subclass.
constructor 的回傳值
沒有

Text I/O Binary I/O


Text I/O Is built upon binary I/O to provide a level of abstraction for character
encoding and decoding.
Binary I/O While not have different between the input and the storge. Serializable

序列化就是把一個 java object 轉成 byte stream. 記錄著所有這個 object 的訊


息( ex: 它的型態,包含什麼 variable. ) 轉成 byte stream 後就能夠拿 來儲存 or
傳輸 概念: 序列化的概念就是將一個 java object 轉換成一個 byte stream,這
個 byte stream 記錄著所有關於這個物件的所有訊息( 型態,參數等等 ),物件
本 身是無法拿來儲存或是做其他目的的,所以如果我想記錄或是傳輸這 個物
件,我就需要進行序列化。 ObjectInputStream( byte stream 反序列化 object )
和 ObjectOutputStream( object 序列化 byte stream ) 一個 class 要能序列化需
要滿足兩個條件 一個就是有實作 Serializable 另一個是每個 instance variable
要可以被序列化或是 transient( 不需要序 列化,代表 variable 不是這個物件的
persistent state )
aggregation 是甚麼
Aggregation 是 association 的一種特殊形式,表示兩個對象的所有權關 係 整
體可脫離部分而單獨存在,且具有各自的生命週期。
Aggregation vs Composition
Dependency: Aggregation implies a relationship where the child can exist
independently of the parent. For example, Bank and Employee, delete the Bank and
the Employee still exist. whereas Composition implies a relationship where the child
cannot exist independent of the parent. Example: Human and heart, heart don’t exist
separate to a Human Type of Relationship: Aggregation relation is “has-a” and
composition is “part-of” relation. Type of association: Composition is a strong
Association whereas Aggregation is a weak Association.

懶人翻譯包
Aggregation 跟 Composition 最大的差異在於從屬關係和類型
Aggregation 屬於低依賴關係,兩者會擁有上下關係,但又互相獨立於對 方,
舉例來說: 公司員工,員工的基本資料狀態並不會受到到底在哪間 公司工作影
響( 性別是男生不會跑到別的公司就變成女的 ),因此任意 關係的一方的任意
改動是不影響另一關係的,Aggregation 適合使用在重 複使用 code 的部分( 關
係重組不影響任意 class 本身 )
Composition 屬於高依賴關係,屬於受限形式,在組成上兩者相互依賴, 任
意部分改動都會影響整體,例如圖書館和藏書的關係,圖書館沒有了 ,屬於這
個圖書館的特色書籍救也會消失。
static variable 所有人共用的變數
Static is using for declaring “static” something in program. What is the difference of
static member or not?? For example, if a data member in class is static data member.
And there is ten different objects have used this data member. When one is work.
The all static data will be change.
RadioButton
RadioButton 讓你可以在很多選項中抓出單一項目
讀檔跟寫檔跟是用什麼 class
FileInputStream, FileOutputStream 判斷 button 是否觸發
The button is an event source object where the action originates. Need to create an
object capable of handling the action event on a button. The object is call event
handler. And the handler must be registered with the event source object if we need
it to work.

愚蠢加分題
助教名字 孫嘉宏 助教 office hour 3:40 P.M.~ 6:30 P.M. Monday and by
appointments
老師名字 ???
老師 office hour 12:30 P.M. ~ 1:30 P.M. Friday and by appointments
課本作者名 Y. Daniel Liang

You might also like