SCJP some notes

zhaozj2021-02-16  80

1. The initialization class variable is automatically initialized to 0 or NULL, and the local variable must be initialized 2, the main type overload type matching order: according to byte-> short-> char-> int-> long-> float-> Double order match . 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 a constant, the compiler is consistent as an int processing 3, the type of main type calculation result is consistent with the type of maximum calculator, but the minimum is also int, ie, byte byte result is INT. 4, Short type and char types cannot be assigned each other (because short is symbolic, Char no symbol) 5, Package must be placed in the first line of Java file (except for annotation air line) 6, IMPORT can only be placed in the first line or Package 7, multiple imported packages If you have the same name Class, you must specify the package 8 when you use, you can have a method declaration and a fixed number 9. Class implementation interface must implement all method 10, the same java file Class and Interface only It can have a public 11, in order to declare, add Final Trungeon before the variable, the variable is not changeable, but the attribute of Object can change (a bit forgot, please confirm, :)) 12, the column cannot use char Arr during the declaration [12]; form specified, you must specify the size with the New. The auto initialization is specified; or the form is specified in the form of {0, 0, 0} when NEW can be used. If an Object is NULL, use its attribute or method, generate NullPointerException 14, if you use a base index access, generate ArrayOfboundSexception 15. Appendix with a list .length 16, constructor If there is a return value, the compiler is treated as a general method. If you want to use super (..) and this (..), you must put it in the first line, and Only one 18 can be used, if there is no explicit call Super and this, the compiler automatically inserts super () in the first line (); requires the superclass must exist without parameters, if there is no explicit statement constructor, the compiler automatically generates the default No parameters constructor.

Once declare, there is no default constructor 20, the modifier (access range size order) public complete public Protected Package Private This Class 21, OVERRIDE method does not make the access range 即 Public method can not be Can't be Override for protected override 22, static method? Confirm 23, Constructor cannot be inherited 24, abstract class cannot be modified by Static Treatment 25, native: method is implemented by other languages ​​other than Java, INTERFACE: Method Default to public abstract modified variable defaults to public static final modification 27, Abstract And Final, Abstract, and Static, Abstract and Private cannot specify 28, &&, || for short-circuit conditional operators &, | For short-circuit condition operators 29, switch () can only judge Byte, Short, Int, Char (Long , Float, Double does not line 30, Exception includes CHECK Exception and Runtime Exception CHECK Exception can be checked by the compiler, Runtime Exception is not checked by the compiler, but can be captured by Catch 31, try {} catch} catch {} The CATCH statement checks in the order of declaration, once caught, then Catch is directly skipped, and the super class Exception can capture the subclass Exception 32. Even if there is Return, the FinalLy section will be executed 33, and the method declaration with throws, throw Exception uses Throw 34, forced garbage collection, system.gc (); promotes garbage collection, but not immediately recycling 35, Finalize (); automatically calls when garbage recycling; suggestion of Explicit call Super.Finalize (); 36, main Method of Args [0] is the first parameter, for example: Java Test ABC, Args [0] is "a" 37, the Static segment in the class cannot be exceptions, the constructor cannot throw exception 38, for division zero: integer operation Throwing the ArithmeticException implementation does not throw an exception; return infinity or -infinity 39, the instanceof operator, IS means, for example: betty instanceof girl, return true, :) 40, override and overload differences are very simple, not to write 41, Inner Class (Internal Category: Key Note) NEST CLASS: Class Internal Defined Class included (Member Class: Class Loc Al Class:

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

New Post(0)