1.Runnable objects
Start thread: (New Thread (new Myrunnable ()). Start ()
2.jsp <%@ page language= "java" import= "java.util.*" errorpage= "error.jsp" iserrorpage= "false"%>
The exception object cannot be used for page changes
3. Enumeration
enum accounttype{ Saving, FIXED, current; Private AccountType () { System.out.println ("It is a account type"); } } class enumone{ publicstaticvoid Main (String[]args) { System.out.println (accounttype.fixed); }}
The above code output 3 times it is a account type plus fixed
The difference between static include and dynamic include in 4.jsp
Dynamic include uses Jsp:include action to implement <jsp:include page= "included.jsp" flush= "true"/> It always checks for changes in the included files, is suitable for containing dynamic pages, and can take parameters 。 Each file is compiled first and then combined into a single file.
Static include pseudo-code implementation, will not check the changes contained in the file, applicable to include static page <%@ include file= "included.htm"%>. First, the code of the file is added to the main page intact so as to synthesize a file and then translate it, and the same variable is not allowed at this time.
The following are the differences between the two usages of include, the main one is two different;
One: The execution time:
<%@ include file= "relativeuri"%> is executed during the translation phase
<jsp:include page= "Relativeuri" flush= "true"/> is executed during the request processing phase.
Two: the introduction of different content:
<%@ include file= "Relativeuri"%>
Introduces static text (html,jsp), which is incorporated into a JSP page before it is transformed into a servlet.
<jsp:include page= "Relativeuri" flush= "true"/> Introduces the answer text generated by the execution page or servlet.
5.java identifiers
Identifiers are used to represent constants, variables, labels, methods, classes, interfaces, and the names of packages.
- Only letters, numbers, underscores, and dollar characters can be used.
- You can only start with a letter, underscore, and dollar symbol, not with a number.
- Strictly case-sensitive, no length limit.
- Cannot use Java keyword
How 6.java Web Development implements session tracking
There are four ways to implement session tracking technology: URL Rewriting, hiding form fields, cookies, session.
1) Hide form fields: <input type= "hidden", ideal for session applications that require a large amount of data storage.
2) URL rewrite: URL can be appended with parameters, and the server's request sent together, these parameters are name/value pairs.
3) Cookie: A cookie is a small, named data element. The server uses the Set-cookie header to use it as an HTTP
Part of the response is delivered to the client, the client is requested to save the Cookie value, and the subsequent request to the same server uses a
The Cookie header returns it to the server. Compared to other technologies, one of the advantages of cookies is that after the end of a browser session, even
It can still retain its value after the client computer restarts
4) Session: Bind an object to a session using the SetAttribute (String str,object obj) method
7.ant and Maven
Both Ant and Maven are Java-based build tools. In theory, there are some things like make in (Unix) C, but there is no flaw in make. Ant is a software building tool, and Maven is positioned as a software project management and Understanding tool.
Ant features?
Don't have an agreed directory structure? What do you have to make ant do, when, and then compile, package? Without a lifecycle, you must define the target and the task sequence it implements. No integrated dependency Management
MAVEN Features
? have a contract, know where your code is, where to go? Have a life cycle, such as executing mvn install to automate the build process such as compiling, testing, packaging, etc. just define a pom.xml and then put the source into the default directory, and MAVEN will help you with other things? have dependency management, warehouse management
8.java comparison between basic types of different precision
43 pages in the Java core Volume I have the following representations: Two values for a two-dollar operation, the following conversion action occurs: if one of the two operands is a double type, the other operation is converted to a double type. Otherwise, if one of the operands is of type float, the other will be converted to the float type. Otherwise, if one of the operands is of type long, the other is converted to a long type. Otherwise, the two operands are converted to the int type.
9. Each subclass creates a corresponding parent class at the time of Creation
Public classParent {Static{System.out.println ("Parent class static code block"); } {System.out.println ("Parent Class code block"); } PublicParent () {System.out.println ("Parent class constructor"); }}classChildextendsparent{Static{System.out.println ("Subclass Static code block"); } {System.out.println ("Subclass code Block"); } PublicChild () {System.out.println ("Subclass Constructor"); } Public Static voidMain (string[] args) {NewChild (); System.out.println ("----------"); NewChild (); }}
The above code output results:
Parent class static code block
Sub-class static code block
Parent Class code block
Parent class Constructors
Subclass code Block
Sub-class constructors
----------
Parent Class code block
Parent class Constructors
Subclass code Block
Sub-class constructors
9.java garbage Collection related
Java provides a system-level thread, the garbage collector thread. Used to track each allocated memory space. When the JVM is idle, automatically reclaims every memory that may be reclaimed, the GC is completely automatic and cannot be enforced. Programmers can only use System.GC () to recommend that the garbage collector reclaim memory, but the exact payback time is unknowable.
10.this (), super ()
Both must be placed at the beginning of the program execution
11.byte Type plus operation
byte b1=1,b2=2finalbyte b4=4,b5=6; B6=b4+b5; B3= (b1+b2); SYSTEM.OUT.PRINTLN (B3+b6);
b3= (B1+B2) compile-time error
The final modified variable is a constant, where the b6=b4+b5 can be seen as b6=10, and at compile time it becomes b6=10 and B1 and B2 are byte types, which are evaluated in Java as an int type, then computed, b1+ The B2 is already an int type, the assignment to B3,b3 is a byte type, the type does not match, the compilation does not pass, and a cast is required. Byte,short,char in Java is promoted to the int type when it is evaluated.
Java Basics Supplements (iv)