Some notes do when preparing SCJP

xiaoxiao2021-03-06  114

Source: chinaitlab2004-4-24 11:29:00

Some terms may be more strange, but everyone should still understand.

1. The initialization class variable is automatically initialized to 0 or NULL, and the local variable must be initialized before use.

2, the main type of overload type matching order: Follow the byte-> short-> char-> int-> long-> float-> Double order. One primary type can only match the parameter range is not smaller than its own and its own scope, the most closely close function is Int i; 1.F (Short S); 2.F (long L); i can only apply to the second F function If it is constant, the compiler is treated as an int

3. The result of the main type calculation result is an INT type. The type and maximum range calculator are consistent, but the minimum is also int, ie

4, Short type and char types cannot be assigned each other (because short has symbols, char no symbol)

5, Package must be placed in the first line of Java files (except for annotation)

6, IMPORT can only be placed under the first line or Package

7, multiple Import's package If you have the same name Class, you must specify package when using

8. I only have a declaration and a fixed number in Interface.

9. Class implementation interface must implement all methods

10. Class and Interface can only have a public in the same java file.

11. In order to declare, add FINA change before the variable (a bit forgotten, please confirm, :)) l Trungeons, the variables cannot be changed, but the attribute of Object can be changed.

12. The column cannot be automatically initially used by Char A when the declaration; can also use {0, RR [12] during NEW, specified in the form, you must use the New to specify the size. Specify 0,0} form designation

13. If an Object is NULL, use its attribute or method to generate nullpointerException

14. If you use a base index to access the column, generate ArrayOfboundSexception

15, with a ranked name .length

16. If there is a return value, the compiler will look at the general method.

17. If you want to use Super (..) and this (..), you must use it.

18. If there is no explicit call in a non-parameter of constructor super and this, the compiler is automatically inserted into super () in the first line (); requires superclars to save

19. If there is no explicit statement, there is no default constructor constructor, the compiler automatically generates the default parameter constructor. Once

20. Decorative sub-sequence (access range order) PU No Same Package Private This CLABLIC is fully open Protected Package or subclass in SS

21, OVERRIDE method does not make access ranges, that is, the PUBLIC method in the parent class cannot be protected by Protected Override

22, Static method can't be Override? confirm

23, constructor can't be inherited

24, abstract class can't be modified by Static modification

25, Native: Method is implemented by other languages ​​other than Java 26, Interface: final modification method defaults to public abstract modified variables Default as public static

27, Abstract and Final, Abstract and Static, Abstract and Private cannot specify at the same time

28, &&, || For short circuit condition operators &, | for short-circuit condition operators

29, Switch () can only judge Byte, Short, Int, Char (Long, Float, Double)

30, Exception includes Class C translator check, Runtime ExceptHeck Exception and Runtime Exceion are not checked by the compiler, but can be pption CHECK EXCEPTION can be caught by Catch capture

31, Try {} catch {} catc Skip directly, the super class eXceptionH {} multiple catch statements can capture subclasses in order, once captured, later Catch

32. Even if there is Return, the finally segment will be executed.

33, Method declaration with throws, throw Exception with throw

34. Forced garbage recycling, system.gc (); prompting garbage collection, but not immediately recycling

35, finalize (); automatic call during garbage collection; suggesting express.Finalize ();

36. The arrival of the main method is the first parameter, for example: Java Test A B C, Args [0] is "a"

37. In the class in the STATIC paragraph, it cannot be very abnormal, and the constructor cannot throw exceptions.

38. For division: integer transport or -infinity calculates the arithmeticException implementation does not throw an exception; return to Infinity

39, Instanceof Operators, IS Meaning, for example: betty instanceof girl, return true, :)

40, Override and OverLoad are very simple, not written

41, Inner Class (Internal Category: Key Note)

Nest Class: Class inside Class Class

Includes (Member Class: Class defined as a Class of CLASS

Local Class: Class as a Method local variable

Anonymous Class: There is no name for NEW.

42, Inner Class: In addition to all Nest Class, all Nest Class except Static MEMBER CLASS

Static paragraphs cannot be defined in the Inner Class

Inner Class does not define static variables without final modified sub-modified

Inner Class can't define Interface? (I can't remember, I confirm it yourself)

43, MEMBER Class How to Use: TopClass.memberClass44, the generation method of Member Class of the Static Declaration:

TopClass's instance.new memberclass () or

New TopClass.memberclass ();

45, Local Class cannot explicitly modified

46. ​​Local class can only access the superiometric variables modified by Final modified (note)

47, Anonymous Class Instance Generative Method:

New superclass name () {.......} or

New interface name () {...}

48, Anonymous Class

Can't define Sub Class (because you have no name)

Can't be defined as Abstract Class

Can't define constructor (note)

49, Thread generation method

Inherit java.lang.thread

Implementing Java.lang.Ruclass to generate Thread Instait () method and notify (), Nonnable Interface, then use new nce 50, thread's JOIN method, etc. TifyAll () method (thread, thread (to implement Runnable interface THREAD ends 51, Object's own looks)

52, the same period reserved word: synchronized (may request spelling)

53. If you use the synchronized to modify the Static method, Static writes in front

54, String and StringBuffer difference: String is not changed after initialization, StringBuffer can change

String S1 = "Hello"; string s2 = "hello";

IF (S1 == S2) {system.out.println ("ok");

The result is printed OK

55, >> The operator is a high-level filler symbol bit, which is an arithmetic shift >> Operator high-level filling 0, is a logic shifting the rest of the SWT, UTIL, IO, basically a hard work There is not much to say it here.

转载请注明原文地址:https://www.9cbs.com/read-101789.html

New Post(0)