Various Java pen questions

Source: Internet
Author: User

Sina pen questions

 

Optional items:

1. Interfaces cannot be modified ()

A. Private B. Public C. Protected D. Static

 

2. system. Out. println (-1 >>> 1) output.

A.-1 B .1 C. 2147483647 D.-2147483647

 

3. Which of the following statements about the servlet lifecycle is false ().

A. When creating your own servlet, you should create a servlet instance in the init () method of the initialization method.

B. In the service phase of the servlet lifecycle, execute the Service () method and the corresponding doget () or dopost () method based on the method requested by the user.

C. In the destruction stage, the system immediately recycles the garbage after the destroy () method is executed.

D. Run the destroy () method only once. That is, the method is executed when the server is stopped and the servlet is uninstalled.

 

4. Which of the following statements about the exception handling mechanism are true ()

A. the finally part is executed only when exceptions are caught in the catch part.

B. When an exception occurs in the try section program, the catch section program will be executed.

C. The finally part is executed no matter whether an error occurs in the program or the exception is caught.

D. All of the above are

 

Are there any errors in the following programs?

1.

Public classSomething {

VoidDosomething (){

PrivateString S = "";

IntI = S. Length ();

}

}

 

 

 

 

 

2.

Abstract classSomething {

Private AbstractString dosomething ();

}

 

 

 

 

 

3.

Public classSomething {

Public static voidMain (string [] ARGs ){

Something S =NewSomething ();

System.Out. Println ("S. dosomething () returns" + dosomething ());

}

PublicString dosomething (){

Return"Do something ...";

}

}

 

 

 

4.

Public classSomething {

Public static voidMain (string [] ARGs ){

Other =NewOther ();

NewSomething (). addone (other );

}

Public voidAddone (FinalOther ){

Other. I ++;

}

}

ClassOther {

Public intI;

}

 

 

 

5.

InterfaceA {

Int X= 0;

}

ClassB {

IntX = 1;

}

ClassCExtendsBImplementsA {

Public voidPrintx (){

System.Out. Println (X );

}

Public static voidMain (string [] ARGs ){

NewC (). printx ();

}

}

Programming questions:

1. What built-in objects does JSP have? What are their roles?

 

 

 

 

 

 

2. Because no primary key is set, the table Weibo has many duplicate records. Write an SQL statement to delete all duplicate records and leave a unique record.

 

 

 

 

 

3. Write a method, input any integer, and return its factorial.

 

 

 

 

 

 

 

 

4. Write a program. Three threads Output A, B, and C respectively, and output ABC 10 times in sequence.

 

 

 

 

 

 

 

 

 

 

 

 

5. Write a binary search algorithm and pay attention to the details.

 

 

 

 

Air China interview questions:

Name:

 

Complete the following 10 questions within 15 minutes.

 

 

1. What is the difference between. ABC and # ABC in the CSS definition file?

# ID
. Stands for class

Class can be used repeatedly, and Id can only be used once on a page

2. What is the difference between passing the parameter value in the get method in Chinese and English when HTTP is submitted?

Garbled characters are passed when passing Chinese parameters. transcoding is required!

3. Using jquery syntax, how do I specify the page element whose ID is ABC?

$ ("ABC ")

4. When struts 2.0 is integrated with spring, what is the difference between scope and Struts 1.x when defining action bean in spring?

Struts1.x is a single instance (Singleton) by default, that is, each request is processed by the same action. Therefore, if struts1.x is specified by default, concurrency issues may occur. Strust2.x is a multi-instance (prototype) by default. Each request generates an action instance for processing, which avoids concurrency issues.

 

5. What is the meaning of inverse = true in hibernate?

The inverse attribute is used in the Set tag. The inverse attribute determines whether to reflect changes to the set to the database.

True is not reflected, and false is reflected.

 

6. What is SQL outer join?

The SQL Outer Join returned to the query result set contains not only rows that meet the connection conditions, but also the left table (when the left Outer Join is performed) and the right table (when the right outer join is performed) or all data rows in two edge join tables (all Outer Join.

 

7. Compile a JSON structure string that contains a single element and an array at the same time.

{"A": [{"key": "1", "value": 2 },{ "key": "3", "value": 14 }, {"key": "4", "value": 21 },{ "key": "5", "value": 12 },{ "key ": "6", "value": 21}]}

 

8. What is the role of the final keyword modifier in Java?

When final is used before the class name, it indicates that the class cannot be inherited,

When final is used before the function name, it indicates that the function cannot be overwritten by functions,

When final is used before an attribute, it indicates that the attribute cannot be assigned a value after initialization.

 

9. How to specify the maximum and minimum memory used for running the Java Virtual Machine?

Set-XMS and-xmx attributes

 

10. How can I run a quartz scheduled TASK CLUSTER only on a single node?

I have not used it yet. Sorry.

 

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.