java--Notes (1)

Source: Internet
Author: User
Tags xms

1 swing is in AWT based on a set of new graphical interface system, it provides the awt All the functions that can be provided, and with pure java Span style= "font-family: the song Body;" The code extends the function of awt awt is a local method based c/c++ program, it runs faster; swing is based on awt java program, it runs slower.

2. HashMap can insert a null key or value, when inserted, Check if the same key already exists , andif it does not, insert it directly if it exists, replacing the old value with the new value .

3. JVM memory configuration Parameters

-XMX: Maximum heap size

-XMS: initial heap Size

-XMN: Young generation size

-xxsurvivorratio: the size ratio of Eden and Survivor in the young generation

Young Generation 5120m, Eden:survivor=3,Survivor Area size =1024m ( Survivor There are two districts that will be divided into young generations 5 copies, each Survivor area) with a total size of 2048m .

-XMS The initial heap size is the minimum memory value of 10240m.

4. The life cycle of a Servlet is divided into 5 phases: Load, create, initialize, process client requests, uninstall.

(1) loading: Containers are used by the class loader servlet the file load of the corresponding class servlet

(2) create: by calling servlet constructor to create a servlet Object

(3) Initialize: Call Init Method Initialization

(4) handle customer requests: whenever there is a customer request, the container creates a thread to process the customer request

(5) Uninstall: Call Destroy method to let servlet release the resources that they occupy

5. the data type of the expression is automatically promoted , and the following rules are noted for automatic elevation of the type.

① all the values of the Byte,short,char type will be promoted to the int type;

② if one operand is long , the result is a long type;

③ if one of the operands is a float type, the result is a float type;

④ if one of the operands is double , the result is a double type;

A variable declared final will be gifted by the JVM .

6.: The difference when creating:

Statement Statement = Conn.createstatement ();

PreparedStatement prestatement = conn.preparestatement (sql);

at the time of execution :

ResultSet rSet = statement.executequery (sql);

ResultSet PSet = Prestatement.executequery ();

from the above can be seen, PreparedStatement has a precompiled process, has been bound to SQL, and no matter how many times after execution, will not go to compile,

and statement different, if executed multiple times, then the corresponding will compile how many times SQL, so from this point of view,prestatement efficiency than Statement be taller.

7. 2sdk is a JAVA Development environment package that contains the JDK ( Development Kit ) and JRE (Run- time Environment Pack )

JDK contains JRE

JDK is a developer must-install software

JRE is a required software for client runtime

J2SDK is the JDK for the Java 2 Platform

J2jre is the JRE for the Java 2 Platform

JCreator is software for JAVA development ( recommended )

8. What happens when a thread stops executing

(1) exception, the execution is stopped

(2) hibernate, then stop execution

(3) block, then stop execution

9. The final class is the final modified class, and the final method is The method that is final decorated. The final class cannot be inherited, and the final method cannot be overridden.

. Types of Java programs

Application

-Java Application "is a Java program that can run independently .

by The Java interpreter controls execution.

Applet

-TheJava applet cannot be run independently (embedded in a Web page). Performed by a Java -compatible browser control.

Serverlets

is a Java Technology for CGI programming solutions.

is run on On the Web server , as a request from the Web browser or other HTTP client , and on the a middle-tier program between the database on the server and other applications.

Serverlets 's work is:

read the data sent by the user (usually in a form in a Web page )

find hidden in Other request information in the HTTP request, such as browser feature details, requester-side hostname, and so on.

Produce Results ( call other programs, access the database, direct compute )

Formatting results (Web page)

Set HTTP response Parameters ( such as telling the browser to return the document Format )

Returns the document to the client.

java--Notes (1)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.