2018 NetEase Java Pen question

Source: Internet
Author: User

2018 NetEase Java Pen question

    1. Three features of OOP

Packaging:

Inherited:

Polymorphic:

    1. How to implement multiple inheritance in Java

Implementing multiple interfaces

Using internal classes

    1. Java Object Generation Process

The difference between 4.HashTable and HashMap

ü Historical Reason: Hashtable is based on the old dictionary class, HashMap is an implementation of a map interface introduced by Java 1.2

ü synchronization: Hashtable is synchronous, some methods in this class ensure that objects in Hashtable are thread-safe, and HashMap is asynchronous, so objects in HashMap are not thread-safe because the requirements of synchronization affect the efficiency of execution. So you don't need a thread-safe collection, so using HashMap is a good choice to avoid the overhead of unnecessary performance due to synchronization, thus improving efficiency

ü value: HashMap can be stored in NULL as key or value,hashtable.

5. What are the properties of the member domain of the interface

Must be of type public

6. Frequently used three design patterns, draw UML diagram, and write out Java code

7.final, finally, finalize the difference

Final Key Words
First look at the final keyword, which can be used in several places:
1. Modifier attributes, local variables, method parameters:
If the final decoration is a basic type, it means that the value given by the variable cannot be modified, that is, it is a constant, and if the final decoration is an object, it means that the reference given by the variable is not modifiable

2. Modification Method:
The method that is final modified cannot be overwritten.

3. Decoration class
The final class is not allowed to be inherited (if the string Class), and the compiler treats all its methods as final when it is processed (but the data members can be either final or not, as defined by the previous adornments), so the final analogy of the ordinary class has higher efficiency:

finally Key Words
The finally keyword is used at the end of the Try/catch statement, indicating that the statements in the finally block will eventually be executed, whether or not an exception is thrown

Finalize Key Words
Finalize () is a method of the object class, and the Finalize () method is part of the GC (garbage collector) run mechanism, called by the object's garbage collector, and the Finalize () method is called when an object is reclaimed.

The role of 8.SOAP, WSDL, and UDDI

What are the two types of 9.Java input and output streams

10.ArrayList How to implement a custom sort

11. How the following code optimizes

public string Test (string s1,string s2)

{

String s = S1;

S+=S2;

return s;

}

(The code is not the original problem, it should be a string to StringBuffer optimization)

12. Write a jsp/servlet, implement incoming A and B, calculate a*b, and display the result

Common face question finishing:

①. The difference between an abstract class and an interface

    1. Interface is public, there can not be a private method or variable, the interface can not inherit other classes, can only implement other interfaces, subclasses must implement all the methods inside the interface, the interface inside the method is abstract.

Abstract classes can have a method or variable, the implementation of the abstract class can selectively rewrite the need to use the method, but must implement all the abstract methods inside, abstract class can have non-abstract methods, subclasses also implement all the abstract methods inside the abstract class.

      1. A variable defined in an interface can be a public static final type only and must be given its initial value, so the implementation class cannot be redefined or changed.
        Variables in abstract classes can define public private, whose values can be redefined in subclasses or re-assigned.
      2. Abstract classes can have a construction method, while interfaces do not

2018 NetEase Java Pen question

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.