Q: What is the difference between an Interface and an Abstract class?
A: An abstract class can have instance methods that implement a default behavior. An Interface can only declare constants and instance methods, but cannot implement default behavior and all methods are implicitly abstract. An interface has all public members and no implementation. An abstract class is a class which may have the usual flavors of class members (private, protected, etc.), but has some abstract methods.
Q: What is the purpose of garbage collection in Java, and when is it used?
A: The purpose of garbage collection is to identify and discard objects that are no longer needed by a program so that their resources can be reclaimed and reused. A Java object is subject to garbage collection when it becomes unreachable to the program in which it is used.
Q: Describe synchronization in respect to multithreading.
A: With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchonization, it is possible for one thread to modify a shared variable while another thread is in the process of using or updating same shared variable. This usually leads to significant errors.
Q: Explain different way of using thread?
A: The thread could be implemented by using runnable interface or by inheriting from the Thread class. The former is more advantageous, 'cause when you are going for multiple inheritance..the only interface can help.
Q: What are pass by reference and passby value?
A: Pass By Reference means the passing the address itself rather than passing the value. Passby Value means passing a copy of the value to be passed.
Q: What is HashMap and Map?
A: Map is Interface and Hashmap is class that implements that.
Q: Difference between HashMap and HashTable?
A: The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls. (HashMap allows null values as key and value whereas Hashtable doesnt allow). HashMap does not guarantee that the order of the map will remain constant over time. HashMap is unsynchronized and Hashtable is synchronized.
Q: Difference between Vector and ArrayList?
A: Vector is synchronized whereas arraylist is not.
Q: Difference between Swing and Awt?
A: AWT are heavy-weight componenets. Swings are light-weight components. Hence swing works faster than AWT.
Q: What is the difference between a constructor and a method?
A: A constructor is a member function of a class that is used to create objects of that class. It has the same name as the class itself, has no return type, and is invoked using the new operator.
A method is an ordinary member function of a class. It has its own name, a return type (which may be void), and is invoked using the dot operator.
Q: What is an Iterator?
A: Some of the collection classes provide traversal of their contents via a java.util.Iterator interface. This interface allows you to walk through a collection of objects, operating on each object in turn. Remember when using Iterators that they contain a snapshot of the collection at the time the Iterator was obtained; generally it is not advisable to modify the collection itself while traversing an Iterator.
Q: State the significance of public, private, protected, default modifiers both singly and in combination and state the effect of package relationships on declared items qualified by these modifiers.
A: public : Public class is visible in other packages, field is visible everywhere (class must be public too)
private : Private variables or methods may be used only by an instance of the same class that declares the variable or method, A private feature may only be accessed by the class that owns the feature.
protected : Is available to all classes in the same package and also available to all subclasses of the class that owns the protected feature.This access is provided even to subclasses that reside in a different package from the class that owns the protected feature.
default :What you get by default ie, without any access modifier (ie, public private or protected).It means that it is visible to all within a particular package.
Q: What is an abstract class?
A: Abstract class must be extended/subclassed (to be useful). It serves as a template. A class that is abstract may not be instantiated (ie, you may not call its constructor), abstract class may contain static data. Any class with an abstract method is automatically abstract itself, and must be declared as such.
A class may be declared abstract even if it has no abstract methods. This prevents it from being instantiated.
Q: What is static in java?
A: Static means one per class, not one for each object no matter how many instance of a class might exist. This means that you can use them without creating an instance of a class.Static methods are implicitly final, because overriding is done based on the type of the object, and static methods are attached to a class, not an object. A static method in a superclass can be shadowed by another static method in a subclass, as long as the original method was not declared final. However, you can't override a static method with a nonstatic method. In other words, you can't change a static method into an instance method in a subclass.
Q: What is final?
A: A final class can't be extended ie., final class may not be subclassed. A final method can't be overridden when its class is inherited. You can't change value of a final variable (is a constant).
...
Read more ...
2009-07-24
2009-05-15
Latex Editor under Linux
話說,之前我都是很硬的直接用vim...反正也沒什麼不好。
直到最近,開始要弄畢業的論文了,tex檔案數量一多起來,vim就不在那麼好用了...
經過一番尋找,找到了Kile
#--------------------------
sudo apt-get install kile
#--------------------------
使用到目前為止,功能上相當的完整...介面也設計的很好,我認為比winEdit還要好用!...
Read more ...
直到最近,開始要弄畢業的論文了,tex檔案數量一多起來,vim就不在那麼好用了...
經過一番尋找,找到了Kile
#--------------------------
sudo apt-get install kile
#--------------------------
使用到目前為止,功能上相當的完整...介面也設計的很好,我認為比winEdit還要好用!...
Read more ...
2009-04-09
香蕉蛋糕
突然很想吃那家的早餐,走了一小段路到店門口。
「還有三明治嗎?」我問說。
「阿,很抱歉,今天已經全部賣完了...還有bagel就是了...」
「這樣阿~~那謝謝,沒關係~」
走出店門口,老闆娘追了出來,用一口不太標準的國語,中英交替的說:「我們今天是最後一天營業了,明天就不再營業了。謝謝你長期以來的支持...這是我自己昨晚考的蛋糕,it's for free,just a little appreciate for your support」。
一下子,我愣住了,不知道該如何是好,看著老闆娘,仔細的切著香蕉蛋糕,小心翼翼的裝進盒子裡...週遭的一切似乎全都靜止,兩個店員停下手邊的工作,看著老闆娘切著蛋糕...
打開盒子,我咬了一口...好好吃...濃濃的香蕉香,伴著濃濃的人情味......
Read more ...
「還有三明治嗎?」我問說。
「阿,很抱歉,今天已經全部賣完了...還有bagel就是了...」
「這樣阿~~那謝謝,沒關係~」
走出店門口,老闆娘追了出來,用一口不太標準的國語,中英交替的說:「我們今天是最後一天營業了,明天就不再營業了。謝謝你長期以來的支持...這是我自己昨晚考的蛋糕,it's for free,just a little appreciate for your support」。
一下子,我愣住了,不知道該如何是好,看著老闆娘,仔細的切著香蕉蛋糕,小心翼翼的裝進盒子裡...週遭的一切似乎全都靜止,兩個店員停下手邊的工作,看著老闆娘切著蛋糕...
打開盒子,我咬了一口...好好吃...濃濃的香蕉香,伴著濃濃的人情味......
Read more ...
2009-03-20
2009-03-19
[轉錄]學144個無敵單字
這144 個對於提升英語力超有用的字彙是:
1-25
abject, abstract, acrimonious, acumen, aesthetic, affinity, affluence, alacrity, analogous, apathy, arbitrary, benevolent, candid, capricious, clairvoyant, chicanery, cognizant, complacent, compulsory, conciliatory, conjecture, conspicuous, deleterious, destitute, deviate,
26-50
devious, diligent, discernible, disdain, disparage, disseminate, diverse, dogmatic, eccentric, emulate, enigma, epiphany, erudite, expedite, exonerate, extricate, facetious, fallacious, fortuitous, futile, gratuitous, hackneyed, homogeneous, impeccable, impervious,
51-75
impetuous, incessant, incorrigible, indifferent, indolent, incognito, inevitable, innocuous, inquisitive, insatiable, insidious, integrity, jocular, judicious, kindle, kinetic, lethargy, loquacious, ludicrous, lugubrious, meticulous, mitigate, morose, mundane, nihilism,
76-100
novice, obscure, obsequious, oscillate, ostensible, ostentatious, palpable, pandemonium, paradigm, penitent, pertinent, plausible, precipitous, precocious, prerogative, prevaricate, propensity, provocative, querulous, quiescent, recalcitrant, ramification, rapacious, recant, reclusive,
101-125
recrimination, rectify, redolent, redundant, refutable , regressive, relegate, relinquish, remonstrate, reparation, replenish, repose, reprehensible, repudiate, requisite, resilient, resolute, reticent, reverence, rigorous, rudimentary, sanguine, scrutinize, sedentary, soporific,
126-144
spontaneous, squander, stringent, succinct, superficial, surreptitious, terse, theoretical, truncate, ubiquitous, unctuous, unobtrusive, unscrupulous, vacuous, vindictive, virulent, wanton, xenophile, zenith
我明白沒有人喜歡背單字,但是既然已經耗了這麼多年青春歲月,與其血本無歸,不如這次就認了,老老實實把這144個字背下來吧!
這裡有個比較不吃力的記憶方法,跟大家分享:
第一步:
將分成六組的這144個字紀錄在可以隨身攜帶的資料卡上面
第二步:
每個不熟悉的新字至少要經過三遍的反覆記憶,才能夠長期留在腦中,所以前7天,每天背21個字(不要按照字母順序從A開始背,最好是每一組開頭選三個就好),將144個字都先背誦過一遍後,第二遍花4天,第三遍花2天,就會有相當好的效果。
第三步:
將學過的字彙,大量運用在生活簡短的表達中,而不要背誦整個句子,增加負擔,也不要去記憶一個辭的多重意思,只要記憶其中最主要的就可以了。
學習如何正確使用這144個字,可以幫助無論在正式場合說話,或是書寫的時候,大幅提升內容的品質,這些字並不是像托福字彙那樣冷僻,古怪,讓人用來賣弄,而是實際上正式場合天都會派上用場的實用字,可以的話,製作成為字卡,隨身攜帶,直到自然而然能夠在日常使用為止。
就算沒有辦法記得144個,就算只熟練使用其中44個字,也絕對可以在任何正式場合讓人刮目相看。...
Read more ...
1-25
abject, abstract, acrimonious, acumen, aesthetic, affinity, affluence, alacrity, analogous, apathy, arbitrary, benevolent, candid, capricious, clairvoyant, chicanery, cognizant, complacent, compulsory, conciliatory, conjecture, conspicuous, deleterious, destitute, deviate,
26-50
devious, diligent, discernible, disdain, disparage, disseminate, diverse, dogmatic, eccentric, emulate, enigma, epiphany, erudite, expedite, exonerate, extricate, facetious, fallacious, fortuitous, futile, gratuitous, hackneyed, homogeneous, impeccable, impervious,
51-75
impetuous, incessant, incorrigible, indifferent, indolent, incognito, inevitable, innocuous, inquisitive, insatiable, insidious, integrity, jocular, judicious, kindle, kinetic, lethargy, loquacious, ludicrous, lugubrious, meticulous, mitigate, morose, mundane, nihilism,
76-100
novice, obscure, obsequious, oscillate, ostensible, ostentatious, palpable, pandemonium, paradigm, penitent, pertinent, plausible, precipitous, precocious, prerogative, prevaricate, propensity, provocative, querulous, quiescent, recalcitrant, ramification, rapacious, recant, reclusive,
101-125
recrimination, rectify, redolent, redundant, refutable , regressive, relegate, relinquish, remonstrate, reparation, replenish, repose, reprehensible, repudiate, requisite, resilient, resolute, reticent, reverence, rigorous, rudimentary, sanguine, scrutinize, sedentary, soporific,
126-144
spontaneous, squander, stringent, succinct, superficial, surreptitious, terse, theoretical, truncate, ubiquitous, unctuous, unobtrusive, unscrupulous, vacuous, vindictive, virulent, wanton, xenophile, zenith
我明白沒有人喜歡背單字,但是既然已經耗了這麼多年青春歲月,與其血本無歸,不如這次就認了,老老實實把這144個字背下來吧!
這裡有個比較不吃力的記憶方法,跟大家分享:
第一步:
將分成六組的這144個字紀錄在可以隨身攜帶的資料卡上面
第二步:
每個不熟悉的新字至少要經過三遍的反覆記憶,才能夠長期留在腦中,所以前7天,每天背21個字(不要按照字母順序從A開始背,最好是每一組開頭選三個就好),將144個字都先背誦過一遍後,第二遍花4天,第三遍花2天,就會有相當好的效果。
第三步:
將學過的字彙,大量運用在生活簡短的表達中,而不要背誦整個句子,增加負擔,也不要去記憶一個辭的多重意思,只要記憶其中最主要的就可以了。
學習如何正確使用這144個字,可以幫助無論在正式場合說話,或是書寫的時候,大幅提升內容的品質,這些字並不是像托福字彙那樣冷僻,古怪,讓人用來賣弄,而是實際上正式場合天都會派上用場的實用字,可以的話,製作成為字卡,隨身攜帶,直到自然而然能夠在日常使用為止。
就算沒有辦法記得144個,就算只熟練使用其中44個字,也絕對可以在任何正式場合讓人刮目相看。...
Read more ...
2008-11-14
Everyone is No.1
最近想要找一些勵志性質的影片給教會中國三的弟兄們看,找來找去,我還是最喜歡劉德華拍的這部mv,可能是因為我的腳也受過傷,自哀自怨的感受我也經歷過(雖然沒有影片中那樣的嚴重...)。每次看完,眼眶都不禁泛紅...
謝謝那些,激發我們的勇氣去面對人生的運動員,謝謝你們...
...
Read more ...
謝謝那些,激發我們的勇氣去面對人生的運動員,謝謝你們...
...
Read more ...
訂閱:
文章 (Atom)