SCJP1.4高效率复习提纲
2008-01-05 18:22:38 来源:WEB开发网 闂傚倸鍊搁崐鎼佸磹閹间礁纾归柟闂寸绾惧綊鏌熼梻瀵割槮缁炬儳缍婇弻鐔兼⒒鐎靛壊妲紒鐐劤缂嶅﹪寮婚悢鍏尖拻閻庨潧澹婂Σ顔剧磼閻愵剙鍔ょ紓宥咃躬瀵鎮㈤崗灏栨嫽闁诲酣娼ф竟濠偽i鍓х<闁绘劦鍓欓崝銈囩磽瀹ュ拑韬€殿喖顭烽幃銏ゅ礂鐏忔牗瀚介梺璇查叄濞佳勭珶婵犲伣锝夘敊閸撗咃紲闂佺粯鍔﹂崜娆撳礉閵堝洨纾界€广儱鎷戦煬顒傗偓娈垮枛椤兘骞冮姀銈呯閻忓繑鐗楃€氫粙姊虹拠鏌ュ弰婵炰匠鍕彾濠电姴浼i敐澶樻晩闁告挆鍜冪床闂備胶绮崝锕傚礈濞嗘挸绀夐柕鍫濇川绾剧晫鈧箍鍎遍幏鎴︾叕椤掑倵鍋撳▓鍨灈妞ゎ厾鍏橀獮鍐閵堝懐顦ч柣蹇撶箲閻楁鈧矮绮欏铏规嫚閺屻儱寮板┑鐐板尃閸曨厾褰炬繝鐢靛Т娴硷綁鏁愭径妯绘櫓闂佸憡鎸嗛崪鍐簥闂傚倷娴囬鏍垂鎼淬劌绀冮柨婵嗘閻﹂亶姊婚崒娆掑厡妞ゃ垹锕ら埢宥夊即閵忕姷顔夐梺鎼炲労閸撴瑩鎮橀幎鑺ョ厸闁告劑鍔庢晶鏇犵磼閳ь剟宕橀埞澶哥盎闂婎偄娲ゅù鐑剿囬敃鈧湁婵犲﹤鐗忛悾娲煛鐏炶濡奸柍瑙勫灴瀹曞崬鈻庤箛鎾寸槗缂傚倸鍊烽梽宥夊礉鎼达絽鍨濇い鏍仜妗呴梺鍛婃处閸ㄦ壆绮婚幎鑺ュ€甸柨婵嗙凹缁ㄨ棄霉閻樿崵鐣烘慨濠冩そ濡啫鈽夊▎鎰€烽梺璇插閻噣宕¢幎鑺ュ仒妞ゆ洍鍋撶€规洖鐖奸、妤佸緞鐎n偅鐝┑鐘愁問閸n垳寰婇崜褉鍋撶粭娑樻搐缁犳煡鏌涢妷顔煎闁藉啰鍠栭弻锝夊棘閹稿孩鍠愰梺鑽ゅ枎缂嶅﹪寮诲☉鈶┾偓锕傚箣濠靛洨浜俊鐐€ら崜娆撴偋閸℃稈鈧棃宕橀鍢壯囧箹缁厜鍋撻懠顒€鍤紓鍌氬€风欢锟犲窗濡ゅ懎绠伴柟闂寸劍閸嬧晠鏌i幋锝嗩棄缁绢厸鍋撻梻浣虹帛閸旀洜绮旈棃娴虫盯宕橀鍏兼К闂侀€炲苯澧柕鍥у楠炴帡骞嬪┑鎰磻闁诲氦顫夐幐椋庣矆娓氣偓閸╃偤骞嬮敂钘変汗闂佸湱绮敮鈺傚閳ь剛绱撴担鐟板姢鐟滄壆鍋熼崚鎺戔枎閹惧疇鎽曞┑鐐村灦閻喖鈻介鍫熺厵閻熸瑥瀚慨鍥ㄣ亜閵夛妇绠炴慨濠冩そ閺屽懘鎮欓懠璺侯伃婵犫拃鍌氬祮闁哄瞼鍠栭幖褰掝敃閿濆懐锛撻梻浣瑰缁诲嫰宕戝☉銏犵厴闁瑰濮崑鎾绘晲鎼存ê浜炬い鎾寸⊕濞呭﹪鏌$仦鐣屝f繛纰变邯楠炲繒浠﹂挊澶婅厫闂傚倷鐒﹂惇褰掑磹閺囥垹绠犻柟閭﹀枟椤洟鏌熼幆褏鎽犲┑顖涙尦閺屾盯骞橀弶鎴犵シ闂佸憡鎸稿畷顒勨€旈崘顔嘉ч柛鈩冾殘娴犳悂姊洪懡銈呮毐闁哄懏鐩幃楣冩倻閽樺)銊ф喐婢舵劕纾婚柟鍓х帛閺呮煡骞栫划鐟板⒉闁诲繐绉瑰铏圭磼濡闉嶅┑鐐插级閿曘垺淇婇悽绋跨妞ゆ牗姘ㄩ悿鈧梻鍌氬€搁悧濠勭矙閹邦喛濮抽柤娴嬫櫇绾捐棄霉閿濆牊顥夐柣鎾村姈閹便劌螣缁嬪灝顬嬪┑鈥冲级閸旀瑩鐛Ο鍏煎珰闁肩⒈鍓﹀Σ浼存⒒娴gǹ鏆遍柟纰卞亰瀹曟劖绻濆В绋挎喘瀵埖鎯旈幘瀛樻澑婵$偑鍊栧濠氬Υ鐎n亶鍟呴柕澶涜礋娴滄粍銇勯幘璺轰粶婵℃彃顭烽弻锝夋晲閸パ冨箣濡ょ姷鍋炵敮锟犵嵁鐎n喖绫嶉柍褜鍓熼幃妤佺節濮橆厸鎷洪柣鐔哥懃鐎氼參宕曞Δ鍛厱婵☆垵銆€閸嬫捇鎮㈤幓鎺戠阀濠电姷鏁告慨鐑藉极閸涘﹥鍙忛柣鎴f閺嬩線鏌涘☉姗堟敾闁告瑥绻戦妵鍕箻閸楃偟浠肩紒鐐劤椤兘寮婚悢鐓庣鐟滃繒鏁☉銏$厓闂佸灝顑呴悘锕傛煏閸パ冾伃妤犵偞甯″畷鍗烆渻閹屾缂傚倸鍊搁崐椋庣矆娓氣偓钘濋梺顒€绉撮弸浣糕攽閻樿櫕鐨戠€规挷绶氶弻娑㈠焺閸愵亖濮囬梺绋匡功閸忔﹢寮诲☉妯锋斀闁糕剝顨忔导鈧俊鐐€栧褰掑礉閺囥垹鐓橀柟杈鹃檮閸婂鏌涢妷銏℃珖閺嶏繝姊绘担鍛婂暈闁圭ǹ顭烽幃鐑芥晜閻e备鏀虫繝鐢靛Т濞诧箓宕甸崘顔界厓闁告繂瀚弳鐔兼煥濞戞瑧鐭掓慨濠囩細閵囨劙骞掗幋婊冩瀳闂備礁鎲¢悷銉︻殽閹间礁鐓濋柟鐐灱閸亪鏌涢銈呮灁闁告ɑ鎮傞弻锝堢疀閺囩偘鎴风紒缁㈠幖閻栫厧鐣烽幋锕€绠婚悹鍥皺閻も偓濠电偠鎻徊浠嬪箟閿熺姴纾规い鏍仦閳锋垹鐥鐐村櫣濞存粌缍婇幃璺衡槈閺嵮冨Е闂佺硶鏂侀崑鎾愁渻閵堝棗绗掗柛鐕佸亰閹啫煤椤忓懐鍘告繛杈剧到濠€杈ㄦ櫠椤忓牊鐓冮悷娆忓閻忔挳鏌熼鐣屾噰鐎殿喖鐖奸獮瀣偐鏉堫煈鏁囬梻鍌氬€风粈浣革耿鏉堛劎浠氶梻浣侯攰婵倗鍒掓惔銊ョ闁圭儤顨呯猾宥夋煕椤愩倕鏋庡ù鐘烘缁辨挻鎷呴崜鎻掑壍濡炪倖娲樻繛濠囧极閸愵喖纾兼繛鎴炶壘楠炲牓姊绘担鍛婃儓婵炲眰鍨藉畷婵嗙暆閸曨剙鈧爼鏌eΟ鑲╁笡闁绘挻娲熼弻鐔兼嚋椤掆偓婵$厧霉濠婂嫬鍔ら柍瑙勫灴閺佸秹宕熼鈩冩線闂備胶枪閿曘儵鎮ч悩鑼殾婵犻潧顑嗛弲婵嬫煃瑜滈崜鐔煎灳閿曞倸閿ゆ俊銈傚亾闁绘帒鐏氶妵鍕箳瀹ュ牆鍘$紓浣哄Т婢т粙鍩€椤掆偓閸樻粓宕戦幘鏂ユ斀闁绘ǹ浜粣鏃堟煕鐎n偒娈旈柍瑙勫灴椤㈡瑧娑甸悜鐣屽弽婵犵數鍋涢幏鎴犲緤閸啣锝夊箛閺夎法顔婇梺鐟板暱绾绢參宕伴幘璇茬闁绘ḿ绮崵鎴︽煠缁嬭法浠涙慨锝嗗姍濮婂宕掑顑藉亾閻戣姤鍤勯柤鍝ユ暩娴犳碍绻濋悽闈涗粶妞ゆ洦鍙冨畷妤€螣娓氼垰娈ㄥ銈嗗姂閸婃牜鈧碍姘ㄩ埀顒傛嚀婢瑰﹪宕伴弽褉鏋旈柕濠忓缁♀偓闂佹眹鍨藉ḿ褎鐗庣紓浣哄亾濠㈡ḿ绮旈悷閭﹀殨闁哄被鍎辩粻鐢告煙閻戞ḿ绠橀柛鐐垫暬閺岋綁鎮╅悜姗嗕哗闁诲繐绻堥崝宀勵敊韫囨稑唯鐟滃宕戦幘鑸靛枂闁告洦鍓欑喊宥呪攽閳藉棗浜濈紒璇插€块敐鐐剁疀濞戞瑦鍎梺闈╁瘜閸橀箖鏁嶅⿰鍐f斀闁宠棄妫楅悘鐘绘煙绾板崬浜伴柨婵堝仜椤撳ジ宕堕埡鍐跨闯濠电偠鎻紞渚€藟閹捐绀夌€广儱顦伴悡娆戠磼鐎n亞浠㈤柡鍡涗憾閺岋綁鏁愰崶褍骞嬪Δ鐘靛仜椤戝寮崘顔肩劦妞ゆ帒鍊绘稉宥呪攽閻樺磭顣查柛瀣剁秮閺屾盯濡烽幋婵嗘殶濡ょ姴娲幃妤冩喆閸曨剙纰嶇紓浣割槹閹告娊鍨鹃弮鍫濈妞ゆ柨妲堣閺屾盯鍩勯崗鐙€浜Λ鍕吋閸モ晝锛濇繛杈剧到婢瑰﹪宕曢幇鐗堢厱闁靛ǹ鍎遍。宕囩磼椤旂⒈鍎忔い鎾冲悑瀵板嫮鈧綆浜栭崑鎾绘煥鐎c劋绨婚梺鐟版惈缁夊爼藝閿旈敮鍋撳▓鍨灈闁诲繑绻堥崺鐐哄箣閿曗偓閻擄繝鏌涢埄鍐炬畼濞寸媭鍨跺娲川婵犲海鍔堕梺鍛婃处閸欏骸煤閸涘﹣绻嗛柕鍫濈箳閸掍即鏌涢悤浣哥仸鐎规洘鍔欏畷褰掝敃閿濆懎浼庢繝纰樻閸ㄦ娊宕㈣缁傚秵銈i崘鈺佲偓鍨叏濡厧浜鹃悗姘炬嫹

核心提示:SECTION 1: DECLARATIONS AND access CONTROL1. An identifier in java must begin with a letter, a dollar sign($), or an underscore (_); subsequent characters may b
SECTION 1: DECLARATIONS AND access CONTROL
1. An identifier in java must begin with a letter, a dollar sign($), or an underscore (_); subsequent characters may be letters, dollar signs, underscores, or digits.
2. All the keyWords in java are comPRised of lower case characters only.
3. There are three top-level elements that may appear in a file. None of these elements is required. If they are present, then they must appear in the following order:
-package declaration
-import statements
-class definitions
4. A Java source file (Java file) cannot have more than one public class, interface or combination of both.
5. The variables in an interface are implicitly public, final and static. If the interface, itself, is declared as public the methods and variables are implicitly public.
6. Variables cannot be synchronized.
7. The variables in Java can have the same name as method or class.
8. A transient variable may not be serialized.
9. The transient keyword is applicable to variables only.
10. The native keyword is applicable to methods only.
11. The final keyword is applicable to methods, variables and classes.
12. The abstract keyword is applicable to methods and classes.
13. The static keyword is applicable to variables, methods or a block of code called static initializers.
14. A native method cannot be abstract but it can throw exception(s).
15. A final class cannot have abstract methods.
16. An abstract class might not have any final methods.
17. All methods of a final class are automatically final.
18. Interfaces cannot be final and should not be declared abstract.
19. The visibility of the class is not limited by the visibility of its members. I.e. A class with the entire members declared private can still be declared public.
20. Interface methods cannot be native, static, synchronized, final, private, protected or abstract. They are implicitly public, abstract and non-static.
21. The statement float f = 5.0; will give compilation error as default type for floating values is double and double cannot be directly assigned to float without casting. But f=5.0f is ok.
22. A constrUCtor cannot be native, abstract, static, synchronized or final.
23. Be careful for static and abstract keyword in the program.
24. Also be careful for private keyword in front of a class as top level classes or interfaces cannot be private.
25. friendly is not a java keyword. This is often used as an alternate word in java literature to indicate the default access level by placing no modifier like public, private or protected in front of members of classes and interfaces.
26. A local variable, already declared in an enclosing block and therefore visible in a nested block, cannot be redeclared in the nested block.
27. Array in Java can be declared and defined like ---
int[] count = null; int []count = null; int count[] = null;
int count[] = new int[50]; int count[] = {5,10,15,20,25}
SECTION 2: FLOW CONTROL, ASSERTIONS, AND EXCEPTION HANDLING
28.Three types of statements regarding flow controls are used in Java:
* Selection statements ' if…else, switch…case, try…catch…finally
* Iteration statement ' while, do…while, for
* Transfer statement ' return, break, continue
29.The argument to switch can be either byte, short, char or int. Be careful about long, float, double or boolean as argument to switch.
30.The eXPression for an if and while statement in Java must be a boolean.
31.Breaking to a label (using break
32.The if() statement in Java takes only boolean as an argument. Note that if (a = true){}, provided a is of type boolean is a valid statement then code inside the if block will be executed otherwise skipped.
33.The (-0.0 == 0.0) will return true, while (5.0 == -5.0) will return false.
34. An assertion is a conditional expression that should evaluate to true if and only if your code is working correctly. If the expression evaluates to false, an error is signaled. Assertions are like error checks, except that they can be turned completely off, and they have a simpler syntax.
34.AssertionError is the immediate subclass of java.lang.Error.
35.assert is a java keyword from JDK1.4. So it cannot be used as an identifier from JDK1.4 or later. But as other JDK versions (JDK1.3 or earlier) had no keyword named assert, an interesting backward compatibility problem arises for those programs that used assert as a java identifier.
36.Assertion checks can be turned on and off at runtime. By default, assertion mechanism is turned off. When assertions are off, they don't use system resources.
37.The command for compiling a source using Java's new assertion feature is javac -source 1.4 filename.java. But if -source argument is not mentioned like javac filename.java, it will be assumed like javac -source 1.3 filename.java so that existing code compiles correctly even if it uses assert as a regular identifier.
38.Remember that Assertions can be enabled and disabled for specific packages as well as specific classes. For example, assertions can be enabled in general but disabled for a particular package.
39.One of the most common uses of assertions is to ensure that the program remains in a consistent state. Assertions are not alternative to exception handling rather complementary mechanism to improve discipline during development phase.
40.Assertions may be used in the situations like:
* to enforce internal assumptions about aspects of data structures.
* to enforce constraints on arguments to private methods.
* to check conditions at the end of any kind of method.
* to check for conditional cases that should never happen.
* to check related conditions at the start of any method.
* to check things in the middle of a long-lived loop.
41.Assertions may not be used in the situations like:
* to enforce command- line usage.
* to enforce constraints on arguments to public methods.
* to enforce public usage patterns or protocols.
* to enforce a property of a piece of user supplied information.
* as a shorthand for if ( something) error();
* as an externally controllable conditional.
* as a check on the correctness of your compiler, Operating system, or hardware, unless you have a specific
42.reason to believe there is something wrong with it and is in the process of debugging it.
43.An overriding method may not throw a checked exception unless the overridden method also throws that exception or a superclass of that exception.
44.The java.lang.Throwable class has two subclasses: Exception and Error.
45.An Error indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions.
46.The two kinds of exceptions in Java are: Compile time (Checked) and Run time (Unchecked) exceptions. All subclasses of Exception except the RunTimeException and its subclasses are checked exceptions.
Examples of Checked exception: IOException, ClassNotFoundException.
Examples of Runtime exception: ArrayIndexOutOfBoundsException, NullPointerException, ClassCastException, ArithmeticException, NumberFormatException.
47.The unchecked exceptions do not have to be caught.
48.A try block may not be followed by a catch but i
[]
赞助商链接