Java Knowledge points:
Object-oriented:
Object-oriented is a kind of thought
Programming guidance
Packaging:
Object-oriented 2 large core:
1. Class: Descriptive information, abstract
Format: [public/abstract/final] class name {
Property
Construction method
Method
}
2. Object: concrete Example
Format: Class Name Object [=new class name ([actual parameter list]];
Usage of this
1. Refers to this kind of object
2, call the construction method
Parameter passing of the method:
1, the basic type: the transmission is the data itself
2. Reference type: The address is transmitted
Static: Statically
1. Modifier properties
2. Modification method
3. Modifying code blocks
4. Modify the Inner class
Package:
1. Package: Disclaimer
2. Import: Importing
Inherited:
Inheritance: A class has properties or methods of another class
Constructors cannot be inherited
Parent class, superclass, base class
Sub-class, derived class
Extends
Super: Used in subclasses
1. You can call a property or method in a parent class
2, you can call the constructor method in the parent class
Overriding: Extending a method in a parent class
Rules:
1, the access modifier can not be more strict than the parent class
2, static, non-static, return value type, method name, formal parameter list is the same
Overloading: Methods with similar functions using the same method name
Rules:
1. Same method name
2. Different form parameter list
Access modifiers:
Public---->protected---> Default---->private
Abstract: Abstraction
1. Modification method
2. Decoration class
Abstract classes do not necessarily have abstract methods
Classes with abstract methods must be abstract classes
Final: The Ultimate
1. Modifier variables
2. Modification method
3. Decoration class
Interfaces: composed of abstract methods and constants
Java can only be single-inheritance, but more implementations
Object class: Ancestor class for all classes
What is the difference between = = and equals?
First choice interface in development second abstract class
Polymorphic:
1. Compile-time polymorphism
Overload
2. Run-time polymorphism
Rewrite
Object transformation
1, upward transformation: Automatic, Subclass----> Parent class
2. Downward transformation: Mandatory, parent-----> Subclass
Instanceof: Verifies whether an object can be cast
Inner class:
1. member Inner class
2. Anonymous inner class
3. Static internal class
4. Local inner class
Design mode:
1. Single Case mode
2. Simple Factory mode
3. Decorator Mode
Arrays: Data structures that store a set of identical data types
2 Major Core:
1. Type of element
2, the length of the array
2 Ways to create
1. Static
2. Dynamic
Index: 0~length-1
Arrays: Array Tool class
Two-dimensional arrays
Handling of Exceptions:
1, try{
code block that could throw an exception
}catch (Exception Class) {
Handling of exceptions
}finally{
Code that is bound to execute
}
2, throws
Common classes:
Calendar class Calendars
SimpleDateFormat
String
StringBuilder
Math
Collections: Dynamic Storage objects
When storing data, use arrays first, followed by collections
Variable number of elements using the collection
1, Collection<e>: Inherits the iterator interface, so you can enhance the For loop
1, List<e>: orderly, repeatable, indexed
Add
Get
Set
Remove
1, Arraylist<e>: Low-level array, new and deleted inefficient, query and modification efficiency is high
2, Linkedlist<e>: Low-level double-link, new and deleted efficiency, query and modification efficiency is lower
2, Set<e>: unordered, non-repeatable, no index
Add
Remove
1, HashSet: High efficiency
Element should override Hashcode and equals
2, TreeSet
Element must be sortable
3, Linkedhashset
2, Map<k,v>: Key-value pair storage
Put
Get
1, HashMap
2, TreeMap
Comparator interface:
1, Comparable<t>: Natural order
2, Comparator<t>: Custom
Collections: Collection Tool class
Flow: A conduit for data communication
File class: Class for manipulating files or directories
Common methods:
Mkdir
Mkdirs
Length
GetName
Renameto
Delete
List
Listfiles
FilenameFilter: File name Filter interface
Recursive traversal
Recursive deletion
I/O Flow:
Flow is a conduit for data communication
Source of data:
1. Documents
2. Memory
3. Network
Classification of streams:
According to the direction of flow:
1. Input stream
2. Output stream
According to transmission Unit points:
1. Byte stream
2. Character Stream
According to the function of:
1. Node flow
2. Filter Flow
Common Stream classes:
1. File stream: The flow of the operation file
4 x
2. Memory stream: The flow of operating memory
2 x
3. Buffer stream: Improve reading and writing efficiency
4 x
4. Conversion stream: Conversion between bytes and characters, specifying encoding format---character stream
2 x
5. Object flow: Write and read of all data types, serialization and deserialization---byte stream
2 x
6. Print Flow: Supports output of all data types
2 x
7. Data flow: Basic type and string write and read
2 x
8. Random read File class: Read and Write
Randomaccessfile
Serializable interface
Serializing interfaces
Transient: Transient
Multithreading in Java:
Process: stand-alone application
Threads: An execution path inside a program
Multithreaded development
How threads are created:
1. Inherit the thread class and rewrite the Run method
2. Implement Runnable interface
User Threads and Daemon threads
The default thread is the user thread
The daemon thread is constrained by the corresponding user thread and is destroyed when the corresponding user thread is destroyed.
Priority: The probability of getting the CPU
[1,10]
What is the difference between start and run of a thread?
Thread scheduling: Ways to change the state of a thread
1. Sleep
2. Join
3. Yield
4. Wait
5, Notify/notifyall
The life cycle of a thread
New
Ready
Run
Blocking
Death
Thread-Safe:
Data security may be raised when multiple threads operate on the same data source
Troubleshooting Multithreading Security:
Synchronized: Mutex keyword
1. Modifying code blocks: synchronizing code blocks
Format: Synchronized (Object) {
Code blocks that may raise security
}
2. Modification method: Synchronous method
1, modified non-static method: Lock is the current class object
2. Modify static method: Lock is the class object of the current classes
Deadlock: The current thread has entered a block waiting for a blocking condition to end
TCP/IP protocol: Transmission Control Protocol/Internet Protocol
Ip
Port number
TCP Programming:
ServerSocket
Socket
Features of TCP:
1. Connection-oriented
2. No size limit for each transmission
3. Byte stream data interaction
SQLite database
SQL statements:
1. Create
2. Alter
3. Drop
4. Insert
5. Update
6. Delete
7. Select
HTTP protocol: Hypertext Transfer Protocol
Request Properties
Request parameters
Request Method:
1. GET
Insecure, information sensitive
Size is limited
Chinese garbled
Fast speed
2. POST
Safety
Unlimited size
Slow speed
Common HTTP Technologies:
1, HttpURLConnection
Steps to use:
1. Create a URL object
2. Create a Connection object
3. Set Request Information
4. Connection
5. Verification Status Response code
6. Get response Results
7. Close
2, OkHttp
Steps to use:
1. Creating Client Objects
2. Create the Request Content Object (POST)
3. Create the Request object
4. Create a Response object
5. Verify Success
6. Get Response Content
XML: Extensible Markup Language
Describe the data
XML parsing:
1. SAX
Steps to use:
1. Create classes based on data
2. Create subclasses of the DefaultHandler class and override
3. Analysis
1, create the Analytic factory saxparsefactory
2. Create a parser
3. Create the object of the subclass of the custom DefaultHandler class
4. Start parsing
5. Get analytic results
2. Pull
Steps to use:
1. Create classes based on data
2. Analysis
1, create the Analytic factory xmlpullparsefactory
2. Create a parser
3. Set up parsing data source
4. Start parsing
1. Create a collection store parsing results
2. Get the initial event
3. Loop Get Events
Event constants:
0---start document
1---End document
2---start tag
3---end tag
4---text content
JSON: Rules for strings
Rules:
{}---> Objects
[]---> Arrays
:----> Connection properties and Values
,----> multiple attributes or multiple elements separated
""----The value of the > property name or String type
Encountered {} is Object
Encountered [] is an array
Parsing mode:
1. JSON official
Jsonobject: Objects
Jsonarray: Array
2, Gson Google
Gson class
3, Fastjson Ali
JSON Tool class
Interface callback:
Declares the traversal of an interface type by implementing a class object to complete the instantiation
Then use the interface variable to invoke the method in the interface, which is called the interface callback
HTML: Hypertext Markup Language
Show data
Fixed label
Case insensitive
Nested use
Html5+css3+javascript
Servlet:java languages to write programs running on the server
Steps to use:
1. Create a servlet (Web project)
2. Rewriting Doget and Dopost methods
3. Release
Regular Expressions: Validation of strings, substitution
Reflection: Class
1. The runtime gets the properties, methods, construction methods, annotations of the class
2. Execute private method or private property
Annotations: Comments added for code
Annotation
@interface Defining annotations
Four Yuan annotations:
1. @Target
2. @Retantion
A summary of the end of the Qianfeng-java course of "changing millions of scenes"