as everyone knows ,Web Applications are deployed to Web Running in server , about Java For developers , understand Web The principle of server is very necessary . This series of articles mainly records how bloggers can write simple Web The server , The content includes knowledge points :Java Reflex mechanism ,XML analysis ,Http agreement , as well as Java
Web Basics .

Java reflex

Reflection can be said to be Java The most powerful technology in , It has too many uses . such as , Let the program build objects of any class at runtime , You can understand the class to which any object belongs , Understanding member variables and methods of a class , Call methods of arbitrary objects . The reflex is Java The key to dynamic language . Many excellent frameworks are used Java reflex , of course ,Web The server also needs reflection to complete .

Class class

be careful , This is about Class class , no class keyword .Class Class can be said to be Java The core of reflection mechanism . Objects of any class can get their corresponding Class Class object , It stores information related to this class , For example, member variables , Methods, etc . obtain Class There are three methods for class objects :

The first , Through the getClass() Method to get , An example is as follows :
// Mode 1 Person person = new Person(); Class<Person> clazz1 = (Class<Person>)
The second , adopt Class name .class obtain , An example is as follows :
// Mode 2 Class<Person> clazz2 = Person.class;
The third , adopt Class.forName(“ Full path of class ”) Method acquisition , An example is as follows :
// Mode 3 Class<Person> clazz3 = (Class<Person>)
under normal conditions , We're using a third approach , But pay attention , If this class does not exist , Will throw ClassNotFoundException abnormal , At this time, we need to do a good job of corresponding treatment .


This is my first blog , It will be updated later , Mainly some of my own learning notes and experience summary , For beginners , Big bulls light spray !

©2019-2020 Toolsou All rights reserved,
java Four functional interfaces ( a key , simple )os Simple use of module Browser kernel ( understand ) Some East 14 Pay change 16 salary , Sincerity or routine ?HashMap Explain in detail It's unexpected Python Cherry tree (turtle The gorgeous style of Library )html Writing about cherry trees , Writing about cherry trees