1. Windows
- Close the form:
- Method 1:set Defaultcloseoperation (Jframe.exit_on_close)
- Method 2:
- Add WindowListener (New Windowadapter () {
- public void windowclosing (WindowEvent e) {
- System.exit (0)
- }
- Run:
- public static void execute (String cmd) {
- Runtime r = Runtime.get runtime ();
- R.exec (CMD)}
1.1 Differences in using collections
- Linkedhashset Add Delete
- HashSet find
- TreeSet sort
2. Multithreading
- Process: The program being executed
- Threads: Execution Units
- Synchronized (this) {
- Locked content
- }
- Thread Sleep
- try{
- Thread.Sleep (1000);
- }catch (Exception e) {
- e.getmessage;//getting error messages
- E.printstacktrace ();//Get stack error message
- }
3. Arrays
- Arrys.sort () sort
- Arrys.tostring ()
- Arrys.deeptostring (); multidimensional arrays
4. Garbage Object Recycling
- System.GC ()//Mandatory garbage collection
- Finalize () Method: Garbage Collection
5. Garbled conversion
- byte[] data = username.getbytes ("iso-8859-1")
- Username = new String (data, "Utf-8")
6. Object-oriented
- inheritance keyword: extends
- Calling the parent class
- Construction Method : Super (); Must be the first sentence, not inherit
- method : Super. Method
- Override Overrides, Overrides
- polymorphic
- 1. The operation of an object is determined by the type of claim
- 2. Specific implementation is determined by the object
- Richter Replacement : Reference of parent class to child class object
- View Object type: P.getclass (). GetName ()
- class : Default/public default
- final: Cannot overwrite before method, cannot be inherited before class
- interface : interface; implementation: Implements
- Exception :
- Run-time exception
- Check exception: Forced processing at compile time
- Thrown by exception: throw
- Throw multiple exceptions in the method: throws
- Custom exception: Inherit exception
- Nullpointexception: null pointer exception
- Array index out of Bounds exception array bounds exception
- Arith Meticexception Mathematical Operation Anomaly
- code block : Part of a construction method
- Static code blocks: classes are loaded only once
- Instanceof type detection is not strict
- Final constant capital + mate static saves memory
- Memory
- 1, the value of the basic data type is stored in the stack memory
- 2. A reference to a local variable whose value is the address of the heap memory
- The value of the property of the object, which is present in the heap memory
- 3, = = Compare the value in the stack memory
Javase Tip 2