Essays Java Interview Basics

Source: Internet
Author: User

ext.: http://blog.csdn.net/wenwen360360/article/details/54969418Application

The ―java application is a Java program that can run independently.
Executed by the Java interpreter control.

applets

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

serverlets

Is the Java Technology Solution for CGI programming.
is a middle-tier program that runs on the Web server as a request from the Web browser or other HTTP client side and 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)
Identify additional request information that is implied 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 the HTTP response parameter (such as telling the browser to return the document format)
Returns the document to the client.

Subclass, parent class code block execution order1, static code blocks, static variables are related to the class, will be executed with the load of the class, and only once in the life cycle of the class, 2, non-static code blocks, non-static variables are related to the object, each construction of an object will be executed once; execution order: executes static members of the parent class (variables and code blocks, The execution sequence executes according to the code order written)--executes the static members of the subclass (variables and code blocks, execution order executes according to written code order)--executes the non-static members of the parent class (variables and code blocks, executes the same order as above)--executes the constructor of the parent class-- Executes a non-static member of a subclass (variables and code blocks, executed in the same order as above)--executes the constructor of the subclassoverloadedfunction overloading refers to the same function name, but with different parameters. The different parameters here refer to the following situations: 1. The formal parameter type is different; 2. The number of formal parameters is different; it is important to note that function overloading cannot be implemented based on the return value type, for simple reasons, first we need to know the implementation principle of function overloading: one language, such as C + +, Java, supports function overloading because they compile the function's arguments as part of the function name into the underlying language. Therefore, overloaded functions can differentiate between different overloaded functions based on the different (types and numbers) of the parameters. For example: public void Add (int x,int y, int z)--after compilation--[email protected]@[email protected]public void Add (double x, double y, double z)--after compilation-->[email Protected]@[email protected];p ubic int Add (int x, int y , int z)--after compilation-->[email Protected]@[email protected]//and first function conflict, if the first function is in the base class, then this function will overwrite (not overload!!!). ) The first function. The function's return value does not participate in the compilation of the function name, so the function cannot be overloaded based on the return value of the function. Automatic conversion of data types

Conversions of data types are divided into automatic conversions and casts. Automatic conversion is a program in the execution of the "quietly" conversion, do not require the user to declare in advance, generally from a low number of bits of the type to a high number of bits conversion; Coercion type conversions must be declared in code and the order of conversion is not restricted.

Automatic data type conversions

Automatic conversions are converted in order from low to high. The priority relationships between different types of data are as follows:
Low---------------------------------------------> High
byte,short,char-> int, long, float---double

Operations, different types of data are converted to the same type first, then the operation, the conversion rules are as follows:

Forcing data type conversions

The format of the cast is to add "()" before the data that needs to be transformed, and then add the data type that needs to be converted in parentheses. Some of the data after the transformation operation, the accuracy will be lost, and some will be more accurate

Float can automatically convert double, but the reverse is forced conversions

Essays Java Interview Basics

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.