Last year, I met with several candidates and knew what pitfalls lay in the Java interview process. I recorded the process in the form of a dialogue, wrote a column called “Good Interview”, including the most appropriate answers for you. After reading these, the Java foundation is basically no problem

What have I done with the basic data types

How many basic data types are there in Java? How old?

Java has eight basic data types, namely

  • Byte: occupies 1 byte and 8 bits
  • Char, 2 bytes 16 bits
  • Short, which takes up 2 bytes and 16 bits
  • Int, takes up 4 bytes 32 bits
  • Float, which takes up 4 bytes 32 bits
  • Long, 8 bytes 64 bits
  • Double, 8 bytes, 64 bits
  • Boolean, occupy a byte 8 bits

False, default Boolean to a byte is basically all beginners pass.

Note: The size of Boolean is unknown, although we can only use 1bit to store Boolean: true, false, but we do not specify 1bit, because there is no Boolean type for the virtual machine. In the Java Virtual Machine Specification, there are two definitions: four bytes and a Boolean array of one byte. However, depending on whether the virtual machine implementation complies with the specification, either one byte or four bytes is possible. It’s a game between efficiency and storage, and both are very important.

So what are the integers?

These are package types. Each base type has a corresponding package type, and the assignment between the base type and its corresponding package type is done using automatic packing and unpacking. Such as:

Integer number1 = 2;     // Boxing calls integer.valueof (2)
int number2 = number1;         // Unboxing number1.intValue()
Copy the code

What’s the difference between new Integer(1024) and integer.valueof (1024)?

First, new Integer(1024) creates a new object each time, while integer.valueof (1024) uses objects from the buffer pool, and multiple calls get a reference to the same object.

Let me give you an example:

No, this is my pit, and I’ve used this trick on multiple candidates.

Note: Integer.valueof (1024) and integer.valueof (1024) void do not equal true, but false. Integer.valueOf The value taken from the buffer pool is limited in size and is not any number

ValueOf () checks whether the value is in the buffer pool and returns the contents of the buffer pool if it is.

Currently my JDK version is 8, and in JDK8 the default Integer buffer pool size is -128 to 127.

As an interviewer, I love to dig out details from people’s answers. You just talked about automatic packing and unpacking, what do you understand?

The compiler calls the valueOf() method during auto-boxing, so multiple instances of Integer with the same value and within the range of the cache pool are created using auto-boxing and reference the same object, thus returning true when compared.

Dig deeper to see how well the candidate knows the knowledge. What are the buffer pools that you know about?

Currently, buffer pools corresponding to basic types are as follows:

  • Boolean buffer pool, true and false
  • Byte buffer pool
  • Short buffer pool
  • Int buffer pool
  • Char buffer pool

Therefore, when we use the wrapper type corresponding to these basic types, if the value range is within the buffer pool scope, we can directly use objects from the buffer pool.

Keep digging and see if he’s seen the source code for the buffer pool. Do you mean that the upper and lower limits of these buffer pools are constant? Or can it be set?

In JDK 1.8, Integer’s buffer pool IntegerCache is special. The lower bound of the buffer pool IntegerCache is -128. The upper bound is 127 by default, but this upper bound is adjustable. We can look at the source code

When the JVM starts, we can through – XX: AutoBoxCacheMax = < size > to specify the size of the buffer pool, at the time of the JVM initialization, this setting will set a called Java. Lang. IntegerCache. High system properties, The system property is then read when IntegerCache is initialized to determine the upper bound.

Conclusion: the pit above have the size of the Boolean respectively, the size of the buffer pool, automatic unpacking and packing, the size of the buffer pool is variable, basically these a few pits can pit down sixty percent of the candidates, the second is as a interviewer, I like to dig the details of the candidate answer questions, dig, after all, can see you really have a material!!!!!!

See what I’ve done with String

Now that you’ve said basic types, tell me what you know about strings

String is declared final, so it cannot be inherited. In Java 8, strings use char arrays internally to store data and are declared final, which means that once a value array is initialized, it cannot reference any other array. There is no way to change the value array internally. So String is guaranteed to be immutable.

Dig a little deeper and talk about the benefits of immutability?

The answer to this question is more general, and there are more points that can be said, which can be roughly divided into:

  • The first is that immutability naturally implies security, and immutability guarantees immutability when a String is referenced as an argument.

  • Secondly, it can cache hash values. In fact, we often use them as map keys during development. Immutable features make hash values immutable, so only one calculation is required.

  • If a String object has already been created, the reference will be taken from the String Pool, and the String Pool can only be used if the String is immutable. If it were mutable, the String Pool would not be designed.

Have you ever used StringBuffer and StringBuilder? What are the differences between String, StringBuffer and StringBuilder?

First of all, they’re all final modified classes, they’re not inheritable, but in terms of variability, String is immutable, as we just said, whereas StringBuffer and StringBuilder are mutable because of their internal structure, Arrays of data inside StringBuffers and StringBuilders are not modified by final.

Second, from the aspect of thread safety

  • String is immutable and thread-safe

  • StringBuilder is not thread-safe because it does not use any safety handling internally

  • Stringbuffers are thread-safe and use synchronized internally

You just said that String Pool, tell me what you understand

A String Pool is also known as a String constant Pool, which holds all String literals and is determined at compile time.

String Pool is determined at compile time. Is it immutable?

Yes.

Error, a problem all beginners make, is to ignore the existence of String. Intern, I often use this pit to distinguish beginner and intermediate candidates!!

We can use the String intern() method to add strings to the String Pool at run time.

We can see that

This is a native method; you can’t see the source code, but you can see the comments

When a String calls equals(), a reference to the String in the String Pool is returned if an equals() String already exists in the String Pool. Otherwise, a new String is added to the String Pool and a reference to the new String is returned.

Use a demo to explain this process

S1 and S2 create two different strings using new String(), whereas S3 and S4 get the same String reference using s1.intern() and s2.Intern (). The first intern() first puts “Fan Talk programming” into the String Pool and returns the String reference, while the second intern() reads directly from the String Pool, so S3 and S4 refer to the same String.

Continue to dig holes, ready to bury the candidate just said new String! = new String(” programming “), then “programming” and “programming” equal? What’s the process?

It’s the same. We can see that

The reason for this is that by creating strings in this literal form, the JVM automatically puts the strings into the String Pool, so they are equal.

To dig into the details, this is a tricky question. New String: What does the JVM do?

The first step is to create two String objects, provided, of course, that the String Pool does not already have a String object called “Dintan”, so compile time will create a String object in the String Pool that points to the dintan String literal.

Then, using new, create a String object in the heap, which we can look at in conjunction with the String constructor

public String(String original) {
    this.value = original.value;
    this.hash = original.hash;
}
Copy the code

As you can see, when passing a String object as a constructor argument to another String object, the JVM takes the String object from the String Pool and passes it as an argument to the String constructor, assigning the array of values and hash values to the new object.

Conclusion: String is used a lot in everyday development, but a qualified candidate should understand the differences between String, StringBuilder, and StringBuffer, and understand as much as possible about how String pools work.

See what I’ve done in terms of computing

In Java, method parameters are passed by reference. Or value passing?

This depends, if the parameter is a primitive type, it is passed by value, and if it is a reference type, it is passed by reference.

Wrong, this is a lot of beginners easy to mistake the place, but also my daily dig hole buried people’s place

Java parameters are all passed to methods as values, not references. If the argument is a primitive type, a copy of the literal value of the primitive type is passed. If the argument is of a reference type, the value passed is a copy of the heap address value of the object referenced by the argument.

Float f = 2.2

It looks like it’s okay, but it’s actually a problem, and I don’t use it for interviews, I use it for exams.

2.2 This literal is of type double, so you cannot assign 2.2 directly to float because this is a downward cast. Remember that Java cannot implicitly perform a downward cast because it would reduce accuracy.

The normal way to write it is

float f = 2.2 f;
Copy the code

Keep digging, so float f = 2.2f; F + = 2.2; You can?

This is also a question I would put in the exam for candidates, and it works because the JVM performs implicit type conversions using the += or ++ operators.

The above statement is equivalent to transforming the calculation result of S1 + 1 downward:

f = (float) (f + 2.2);
Copy the code

Conclusion: in the aspect of operation of buried pit is the foundation, is usually placed in the interview questions, and in fact use idea development can, in fact, in the development stage will be an error, but this does not mean that the idea can be detected, you can’t understand, want to come to our company interview, in particular, this means that your professional ability to pass.

See what I’ve done with modifiers

Say something about the final modifier

The first is the use of final on variables, which means that the data is declared as a constant, either at compile time or after initialization at run time. The effects can be divided into:

  • For basic types, final leaves the value unchanged;
  • For reference types, final leaves the reference unchanged and therefore cannot refer to other objects.

If final is used on a method, declare that the method cannot be overridden by subclasses.

If final is used on a class, the declared method is not allowed to be inherited.

Final int b = 1; final int b = 1; You can’t change it after B; So if this is the case, can I change x of object A

Fianl is modifiable. This is one of the reference types. Fianl operates on A reference, not on the data member X of an OBJECT, so it is modifiable.

You just said that declaration methods cannot be overridden by subclasses, so the question is why this is ok

You know, the typical candidate would stumble around here and not be able to tell what’s going on.

Well, his theory was right, but he didn’t actually try to write it the way I did. In fact, when a private method is implicitly specified as final, if the method defined in the subclass has the same signature as a private method in the base class, the subclass method does not override the base method, but defines a new method in the subclass.

Talk about what you know about the static modifier

First is to use on the variable, the variable we usually call it a static variable, can also be called class change, that is to say, the variable belongs to the class, the class all instance Shared static variables, generally we are directly by the name of the class to access it, need to pay attention to the thing, there is only a static variables in memory.

A static method exists when the class is loaded. It does not depend on any instance. Therefore, a static method must have an implementation, that is, it cannot be abstract.

Can I use the this or super keyword in static methods to start digging

Static fields and methods of the class can only be accessed. Static fields and methods of the class cannot have this or super keywords.

An intern made this mistake while writing code, and look at the result below

The correct answer is

A simple point to remember here is that static statement blocks take precedence over normal statement blocks, and normal statement blocks take precedence over constructors.

So what if there is an inheritance relationship? For example, in this problem, tell me the order in which they execute

Most junior candidates stumble over this question, and the correct answer should be:

In other words, in the case of inheritance, the initialization sequence is:

  • Parent class (static variables, static statement blocks)
  • Subclasses (static variables, static statement blocks)
  • Parent classes (instance variables, plain statement blocks)
  • Parent class (constructor)
  • Subclasses (instance variables, plain statement blocks)
  • Subclass (constructor)

See what HOLE I buried in the Object generic method

Did you use equals? Look at this problem and tell us what is the difference between equals method before and after?

It makes no difference.

False. Beginners or people who type too little code can make this mistake.

Test1 will directly raise null pointer exceptions. Null. Equals How can a null pointer have a method right,

* * development: = = = = = = = = = = = = = = = = I really shouldn’t,

Tell me the difference between equlas and ==

The equals method compares the contents of strings for equality, while == compares object addresses.

That’s also true, but we’d like to hear a more professional answer like:

First in Java data types can be divided into two kinds, one kind is the basic data types, also known as the primitive data types, such as byte, short, char, int, long, float, double, Boolean comparison between them, the double equal sign (= =), and compare their values.

The other is compound data types, including classes, which when compared with (==) compare their locations in memory, so unless they are the same new object, the result of the comparison is true, the result of the comparison is false.

All classes in JAVA inherit from the base class Object. The equals method is defined in the base class Object. The initial behavior of this method is to compare the memory addresses of objects, but in some libraries this method is overridden. Among these classes, equals (String,Integer,Date) has its own implementation, rather than comparing the addresses of the classes in the heap.

This answer shows both professional and awesome, but also the atmosphere on the grade, you learn to waste?

Talk about understanding the hashCode and equals methods

When asked this question, a candidate can usually answer:

If two objects are equal to their equals methods, they must have the same hashCode;

If two objects have the same hashCode, their equals() methods are not necessarily equal.

The return value of hashCode() of two objects is equal, but the return value of hashCode() of two objects is not equal.

So what does hashCode do? Why is it so normative

Basically beginners or fresh graduates in this step is stuck by me, prevaricant answers can not much, basically are here to drop marks, because the above standard answer baidu a large number of, but have a deep understanding of the role of hashCode is very few, this question can also see a person’s professional level.

The correct answer is:

The purpose of hashCode is to improve the efficiency of lookups in the hash structure. Of course, the performance of hash storage can only be improved if the hashCode of each Object is as different as possible, which is why all objects provide different hash codes by default.

Here’s an example:

In the case of a HashSet, to ensure that the elements are not duplicated, you need to call the equals method of the object to compare them once. However, if the structure contains many elements, such as 5000 times, you need to compare 5000 times each time you add elements without hashCode, which is different if you have hashCode. The hashCode method is called when a collection is about to add a new element, so that the address of the element can be located without multiple judgments.

What is the result of the clone method?

Every time you ask this question, most people say 2, and a few people say 1.

All wrong. The correct answer is to report an error

Why is that? Since clone is the protect method of Object, subclasses are required to override the Clone method and implement the Cloneable interface.

So the question is, right? What about the Cloneable interface? Is it 2 or 1?

This is another pit I dug to test candidates’ understanding of shallow and deep copies

The final result is actually 2, because the clone copy is a shallow copy, and the reference type of the copied object and the original object are still the same object.

If you want to implement deep copy, you need to rewrite it yourself within the Clone method.

** In enterprise development, we generally do not allow clone method to do copy directly, which may lead to the risk of throwing exceptions and requires type conversion. If I review this code, I will tell my colleagues directly: In Effective Java, it is better not to use Clone (), we can use copy constructor or copy factory to copy an object, such as this

Conclusion: We all know that Java is Object oriented programming. In fact, my understanding is that it is necessary for a beginner programmer to properly use and understand the principles of Equals and hashCode, and the understanding of shallow copy and deep copy is also basic among the basics. I hope to finish reading this series. You can know, the next time you meet this kind of interview question, just blow.

See what I’ve done with abstract classes and interfaces

Test the candidate’s coding skills and explain your understanding of abstract classes

Abstract classes and methods are both declared using the abstract keyword. If a class contains abstract methods, the class must be declared as abstract, and the biggest difference between abstract classes and ordinary classes is that abstract classes cannot be instantiated, but can only be inherited.

Bingo, the answer is right, but it’s not good enough

The above is the standard answer, which can be found in any Java book, but can be added to your understanding of the application, which can reflect your level of coding, I add my ideal answer:

Abstract classes can implement code reuse, the template method design pattern is a typical application of the abstract class, for example we are going to have the same game all the activities of initialization, but initialization time need according to different activities for different function open judgment, then it is possible to define the base class for an activity, make it an abstract methods to estimate the open function Let all activities inherit from the base class, and then turn on judgment in subclass override.

Add your own understanding of the application, which can fully reflect your expertise, and the interviewer will certainly listen to the heart of a hell of a cow.

Go ahead and test the candidate’s coding skills and tell me what you understand about interfaces

An interface is an extension of an abstract class, and all methods in the interface must be abstract. In fact, the method definition in the interface defaults to the public abstract type and the member variable type in the interface defaults to the public Static final type.

You know, this is another standard answer, in fact, not good enough, you can add the following

Starting with Java8, interfaces can also have default method implementations. Why did the Java team support this?

In fact, in Java subsoil years old driver interface no default implementation actually is, maintenance cost is too high, you think about it, if you there are now 100 class implements an interface, and at the same time, need to give interfaces, a new method, yao Java8 before don’t allow to interface with the default implementation, so you have to change to 100 classes, What the hell is that supposed to do to somebody?

Truth: be able to tell the understanding of abstract class and interface application of candidates is not much, basically out of my heart is to blow cow force, capital, because it fully embodies a developer to code in terms of thinking, you don’t know any think and write code that a clean and tidy, rather than simply realize the function of programmers, supervisor will be more like it!!!!!!

A really straightforward answer is the difference between an abstract class and an interface

  • Abstract classes can have constructors; interfaces cannot.

  • Abstract classes can have ordinary member variables, but interfaces do not

  • An abstract class can contain non-abstract ordinary methods, and all methods in an interface must be abstract, with no non-abstract ordinary methods.

  • Abstract classes can contain static methods, but interfaces cannot

  • Abstract classes and interfaces can contain static member variables. The access type of static member variables in an abstract class can be any, but the variables defined in the interface can only be of the public static final type, which is the default type.

  • A class can implement multiple interfaces, but can only inherit from one abstract class.

This is the standard answer, but we are hope can be in response to the difference between the interviewer expand their do answer, when will the understanding of the interface and abstract class above all say it again, not as an endorsement of answer, remember, answer questions, meet understand knowledge, try to do to expand, combined with their own understanding, one is to show the interviewer you professional, Second, you can procrastinate and try to avoid letting the interviewer think of more difficult questions to trap you

Summary: see here, estimate a lot of people to abstract class and interface are sniffed at, are casually can say the answer, but, you think we just want to listen to your endorsement type of answer, wrong, we want to know is behind your expansion and understanding, this can reflect your coding ability and professional.

See what HOLE I put in rewriting and reloading

Take a look at the following question, and tell us what the result is.

This problem is simply, many years ago WHEN I came to apply for division I also met this problem, to tell the truth, fresh students and primary around this problem, now directly to everyone bright card:

To show you how to understand this kind of problem, you need to understand the following principles:

When the JVM calls a method, it first looks for the corresponding method in the class, and if not in the parent class to see if it inherits from the parent class.

What if not? The JVM then transforms the argument into a parent class to see if there is a corresponding method.

In general, the priority of method calls is as follows:

  • this.func(this)
  • super.func(this)
  • this.func(super)
  • super.func(super)

Just remember the process.

Start digging holes to see if the following is a method overload?

class TestMain {

    public int show(int x) {
        return x;
    }

    public void show(int x) { System.out.println(x); }}Copy the code

I interviewed most of the primary or this year will answer is, have to say that this problem is too pit, not joking, you see that pile of people buried by this problem inside have me.

Remember, overloading is defined as a method in the same class that has the same name as an existing method and has at least one different parameter type, number, or order. There’s no return value in this sentence, so it’s not an overload at all if the return value is different and everything else is the same.

Of course, IDEA is directly prompt error, this is why I did not cut idea source out for you to see the reason, a look at the red you know there is a problem. But again, this does not mean that you can not understand what IDEA can detect, which is the basis.

Conclusion: to be honest, in the pen test overloading and rewrite the two problem is all too common, ninety percent of the fresh graduates or primary development have been pit, so remember to read this article collection, did you watch the not remember, but remember before the interview to see it again, but this relationship to your offer on the glittering number limit

See what I’ve done with reflection

Finally reflection, which our interviewers really liked and used to weed out a lot of API engineers

Know anything about reflection? What is reflection?

At runtime, Java reflection, can obtain any kind of name, package information, all of the properties, methods, annotations, type, class loader, realistic interface, etc., and you can call any method and instantiate any of a class alone, through reflection we can realize dynamic assembly, reduce the coupling and realize the dynamic proxy of code, However, overuse of reflection can severely consume system resources.

The above answer is pretty standard, but I dig a little deeper. You mentioned the function of reflection in your previous answer. Where is the reflection mechanism used?

There are many examples, such as:

  • In JDBC, reflection is used to load the database driver dynamically.
  • Sevlet’s service methods are invoked in the Web server using reflection.
  • There are many frameworks that use reflection, inject properties, and call methods, such as Spring.

Basically answer a few can, here because not to the framework module, so not Spring, JDBC and other source code for deep digging, generally is the basis of the topic finished, began to dig the use of the framework and the understanding of the source code.

Keep digging, our interviewers love detail, so make sure you know everything you’re talking about, otherwise hey, hey, hey, you were talking about dynamic proxy, what do you understand about dynamic proxy, and what does it do

Dynamic proxies are simply run-time dynamically generated proxy classes. Applications for dynamic proxies include Spring AOP, back-end mock testing frameworks, RPC, Java annotation object acquisition, and more.

How to implement dynamic proxy?

At present, dynamic proxy can provide two kinds, divided into JDK native dynamic proxy and CGLIB dynamic proxy;

Native JDK dynamic proxies are implemented based on the interface, and additional is based on the inherited current class subclass implementation, when the target class have interface will use the JDK dynamic proxy, because actually the JDK dynamic proxy to agent a class that is no interface, because the JDK dynamic proxy is the use of reflection mechanism to generate an implementation of anonymous proxy interface classes;

CGLIB implements proxying for classes, essentially generating a subclass of a given class and overriding its methods.

You mentioned above that Spring AOP is useful for dynamic proxies. What is the way AOP is used?

Most will answer JDK native dynamic proxies, and a few will answer CGLIB.

But in fact, both are wrong, this is I dug a good pit, too many candidates only know AOP with a dynamic proxy, but can fully answer what kind of is very few, after all, only read the source of talent to answer this question, generally able to answer, I will add extra points

The actual answer is: JDK dynamic proxies are used by default in Spring, and are converted to CGLIB proxies unless the target class does not implement an interface. < AOP :aspectj-autoproxy proxy-target-class=”true” />

In SpringBoot, however, the CGLIB agent has been used by default since 2.0. 六四屠杀

Talk about the pros and cons of reflection

Advantages: Dynamic execution, dynamically executing methods and accessing properties according to business functions during runtime, maximizes the flexibility of Java. Disadvantages: Performance impact, such operations are always slower than directly executing Java code.

Performance is affected. How can I solve this problem?

Basically, a lot of candidates can’t answer at this point. I’ve seen too many people talk about performance at the beginning, but when it comes to how to solve it, they basically falter and fail to answer.

Remember, if you’re talking about performance, think about how you’re going to answer optimization questions, otherwise you’re shooting yourself in the foot.

In fact, it can be answered from the following aspects:

  • When the system starts up, the reflected metadata is saved and used only by calling it from memory.

  • Try to use the higher JDK because the higher version of the virtual machine will be optimized for more frequently executed methods, such as using jit technology, while the lower version will not be implemented at that time.

  • Consider using high-performance reflection libraries, some of which are available in Spring.

Conclusion: It is recommended to play with reflection, not just API calls, for our interviewers, familiar with and understanding reflection is a prerequisite for an intermediate programmer.

Look at the hole I dug with exceptions and annotations

As a Javer, you should be familiar with Error and Exception

Currently, there are two types of classes that can be thrown as exceptions: Error and Exception.

Error is an Error that cannot be handled by the JVM.

  • Exception: use try… catch… Statements are caught and processed, and can be recovered from exceptions;
  • Unchecked Exception: a program runtime error, for example, dividing by 0 causes the Arithmetic Exception to crash and cannot be recovered.

What are annotations? And what does it do

Annotations provide an annotation-like mechanism for associating any information or data with a class, method, or member variable.

Annontation is used like a modifier in declarations of packages, types, constructors, methods, member variables, parameters, and local variables.

Annotations can be used for many purposes. Here are two common examples:

  • Generate documentation. This is the most common and earliest annotation provided in Java, and the system will scan the class that uses the annotation and generate a document based on the annotation information.
  • Format checking is done at compile time. If @Override comes before a method, it will be checked at compile time if your method does not override a superclass method.

Java.lang. Annotation provides four meta-annotations. What are they? What’s the use?

There are several meta annotations in JAVA:

  • @target: The Target of the annotation
  • @Retention: The life cycle of annotations
  • Documented: Whether an annotation should be included in a JavaDoc document
  • @Inherited: Whether a child class is allowed to inherit this annotation

Yes, these meta annotations are all too common, but few people actually use them well.

What are the targets of @target?

There are multiple Target types for @target.

Basically just a few answers, but remember, the TYPE above refers to the class, meaning that this annotation applies to the class.

What are the life cycles of @Retention annotations? What’s the difference?

The life cycle of @Retention annotations can be divided into the following:

  • Etentionpolicy. SOURCE: The current annotation is visible at compile time and is not written to the class file
  • Retentionpolicy. CLASS: discarded during CLASS loading and written to the CLASS file
  • Retentionpolicy. RUNTIME: permanently saved and can be retrieved by reflection

The difference is:

The first is visible only at compile time and then discarded.

The second type is compiled by the compiler into a class file. Classes, methods, and even fields have property tables. The JAVA virtual machine also defines several annotation property tables to store annotation information, but this visibility cannot be carried to the method area and is discarded when the class is loaded.

And the third is the visibility of permanence, which can be reflected, which is basically the dominant one.

For annotating the lifecycle of the understanding can avoid some holes, or the same sentence, basically annotating this can answer the more fluent, the explanation is played with the component or read the source code, because for developing a component, annotations are too common.

The parent class uses an annotation. Does a subclass inherit an annotation from the parent class? If not, how do you implement this process?

This is a question that very few people will answer, because this @Inherited meta-annotation is very new to you.

When using @inherited on an annotation, this annotation will be Inherited by the child classes. Note that this annotation only applies to the class. Members and methods are not affected by this annotation

Therefore, if you want a child class to inherit the annotations from its parent, you need to give the annotations a meta-annotation @Inherited.

Development: Generally, annotations are not used in the initial development, because annotations are mostly used to write components. Our project team likes to customize some annotations to implement components, because it is too comfortable to use.

Java basic basic is almost the same, and then there are

Why are you a Java server developer if you can’t even answer the reference

Development must learn, IO&NIO

Error: For loop removes multiple elements from list

What did the interviewer tell you about JMM and common interview questions

Mp.weixin.qq.com/s/z7yBgd3qq…

Advanced development stumped by constructor loop dependencies?

In my first interview, I almost got hit by the interviewer because of collections.sort

And the Spring collection

Column path

Here you go. Give it a thumbs up. Good luck with your interview.