Java Surface Question essence (basic knowledge)

Source: Internet
Author: User

This blog post is on the network has appeared on the Java Surface Question Post Summary, summary is not to give the link or directly reproduced content, but to analyze and collate the posts in the common, high-frequency surface test questions, these often face the question revealing the interview trend (why can become a classic interview) and the common point of the interviewer. And as a job seeker, technology enthusiasts not only to be able to answer these questions confidently and accurately, but also to know why these problems, the interviewer wants to examine us or what we want to give the answer, appropriate to expand the answer to achieve better results. The interview itself contains a number of psychological things, the interviewer has a heart-expected answer to the question, if the interviewer can touch the edge or misses, the results will naturally not be bad. What's more, when we are able to understand our opponents ' routines, we are able to fully examine our own ideas and make the best of the situation.

Java Surface Question Essence series will be divided into basic knowledge, multi-threading, Web site architecture, data structure, database, performance and security, design patterns, Linux, Algorithm (tentative), a total of nine modules, the basic knowledge of the main, the following began to explain the specific questions.

1. What are the object-oriented features/features/characteristics?

First Jane answers four points: abstract, encapsulation, inheritance, polymorphism, and then express their own views on each point.

Abstraction: The process of building a class by stripping out the common characteristics and behaviors of the same group/class of things according to the actual business needs, which is called abstraction, and the result of abstraction is to get a class. Then the features mentioned earlier correspond to the properties of the class, and the behavior corresponds to the method of the class. There are subtle differences in the properties and methods of the classes that are built under different business scenarios.

Encapsulation: the integration of common / frequently used code blocks / code Snippets into a single method or class ( e.g., a tool class ) To provide services externally and to hide specific implementations. The caller only needs to focus on the method or how the class is used without needing to know how it is implemented internally, and it is convenient for the provider to maintain the code that provides the service, and the difference is the best protection for the Code ( the benefits ).

The third-party jar package We often use in real-world development is a form of encapsulation.

Inheritance: A class a obtains the Public properties and methods of another class B, and a is able to use these things directly and, if necessary, to transform them as needed. There is therefore an association between the two, which is called inheritance. The son of a father is a metaphor for the comparative image of the word inheritance.

For example, sub-categories of private cars, buses, bicycles, motorcycles, trucks are inherited from the parent car, they inherit the property from the parent square plate, wheel, car seat ... inherited the method of driving, manned, braking ... according to the actual needs of the sub-class of these properties and methods have been a certain transformation, so there are different performance. For example, the steering wheel, private cars, buses, trucks are round, bicycles, motorcycles are to handle the form of performance, the number of wheels need different, can carry the number of different, the brake implementation is more different.

Inheritance makes the code continuity, can be used in direct use, cannot be used on the transformation, reducing the common reusable part of the duplicate definition.

Polymorphism: The definition is not refined enough to be replenished.

Java Surface Question essence (basic knowledge)

Related Article

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.