Java back-end interview summary

Source: Internet
Author: User
Pre-order

Today to face a few companies, mainly Java backend, there is a company to ask the thing is really quite a lot of, here to record a deep impression of the problem it. Java Basics

int, Byte, and char each occupy several bits.
Note that this is not a byte, but the bit is asked.
I was saying int 4 bytes, byte 1 bytes, char 2 bytes.
Each byte is 8 bits, multiplied by 8. As a result, the interviewer actually said 1 bytes was 4, and I was in a bit of a shock. Back to check the data found that I was right. 1 bytes is 8 bits ...

Resources:
Https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html

Whether a map set has a method to directly remove all of the value, that is, not through keyset (), EntrySet (), and other indirect methods.
I said no, he gave me a way, values () ... It turns out that there is a way to do this, but we usually use very little.

design mode, single handwriting is not much to say, too simple.

How a List collection can no longer add duplicate elements in.
At the time of addition, the!lsit.contains is judged by the if (), and the result leads to a new question as to how the two objects are judged to be the same. I went on to say that the Equals () and Hashcode () methods of the rewrite class can be, because the underlying is compared by equals ().
Then ask, rewrite the Equals () method, and why rewrite the Hashcode () method. I'm going to just say the Java Official Rules. Actually this is also a convention thing, you can view the Javadoc documentation description in the object class.

Note that it's generally necessary to override the Hashcode method whenever the-so-to overridden The general contract is for the Hashcode method, which states, equal objects must have equal hash codes.

When overriding Equals (), you must also override the Hashcode () method to ensure that the same object's hash value is the same, otherwise there will be unexpected problems. Do not understand why he has been asking this, ah. Finally on the Internet in search of information, said is:
If we rewrite euqals on an object, meaning that the euqals equals True if the value of the member variable of the object is equal, but does not rewrite the hashcode, then we're going to new one.
When the original object. Equals (The new object) equals True, the hashcode of the two are not the same, resulting in an understanding inconsistency, such as storing a hash collection (such as the set class) and storing two values of the same object.
Cause confusion, so you also need to rewrite hashcode ()

The Java Foundation is here, and of course there are many other basic questions, but here it is not explained. Java back-end framework

Because I said I use SPRINGMVC more, so they ask the question is mostly related to this, of course, will be combined with the resume to ask some other questions, the following say.

What are the common annotations of SPRINGMVC?
More commonly used are: @Controller, @Service, @Repository, @Bean, @RequestMapping, @Autowired, @Resouce, @ResponseBody, @ Requestbody and so on there are a lot of, here is not one list.

How to get the variables defined in the @requestmapping annotation.
This is more common in restful style, and @pathvariable ("var") parameters are added to the parameters of the method.

How to get the variables for request requests in Controller, not restful that kind of concatenation parameter.
You can add the httpservletrequest parameter variable directly in the method parameter, and then obtain the corresponding argument based on the Req getparameter ("var") .

How to create a bean from the factory method in Springmvc.
It seems to be less, but I remember it. There is one property in the bean directly in the sprign configuration file called:factory-method.

When using the Hibernate framework, there are ways to query data in addition to HQL .
This I said is the Criteria, the word is not very good to read, I did not read the correct reading of the whole, but we all know what meaning is good. It encapsulates the query conditions in an object-oriented fashion. In fact, can also be directly with the hibernate of the session, was nervous so forget. Why are you nervous because I'm talking nonsense about a JPA. Using JPA to manipulate queries, the result is a lesson to be learned, JPA is the Java Persistence Specification Yes, but it's not much of a relationship with someone else's Hibernate , although Hibernate also implements the JPA specification ...

What is the difference between struts2 and struts1.
Well, struts framework I really used in the project, but also to learn a little, the results of the swagger also added to the resume, the results of a ask about it. Regret, later not too familiar with the best thing not to add on the resume it, or wait for the minus points. As to what the difference is, look up a lot on the internet, here is not much to say.

Well, the back of the framework of knowledge asked me also tears, not to say more. Database

Database can be said in the back end is heavy and heavy, but I have not reached the point of proficiency, but also a beginner, the results of a few problems directly over the.
1. What is the general optimization of the database?
I was talking about the common operations of indexing table fields, splitting tables, and avoiding the use of subqueries for multiple connection queries.
2. How to optimize an SQL statement, what keyword can be used.
At that time I thought explain this, should be the right one.
3. What are the commonly used date fields?
The commonly used on the datetime and timestamp these two kinds of bar.
4. How to add a day operation to the date of the query.
Well, I forgot about this, I remember there was a function, I didn't think of it. Check the search is called Date_add (), the query out of date results into the function of the parameters of the line.
Date_add (My_date, INTERVAL 1 day)

Database related still need to strengthen AH, continue to work hard. Linux

As a Java backend development, Linux can be said to have to master it, after all, the development of software is to run on the server, now the server is almost 80-90% Linux operating system, so the resume must also write this aspect of things. How to automatically boot the application container such as Tomcat when the reboot is powered on.
To edit the/etc/rc.local file directly, add a ${tomcat_home}/bin/startup.sh line to the last line of exit 0, and the tomcat_home variable can be replaced with the path of the installation, of course, If it is directly through the Apt-get installation, it will automatically add to the SYSTEMD, such as the word through the # Systemctl enable TOMCAT7 can also be done automatically boot.

It's almost over here, too much to look at.
The final question is: Has there been any recent research into newer technologies?
I said at that time is Docker, in fact this is not a new bar, 2013 time is very hot, but at that time even the manufacturers are still just stay in the research state, not to mention directly in the production environment used, the technology has not stabilized. Over the past two years, the gradual use of the company only a little more. I also began to learn that last year. This year has not been how to do, it seems to need to pick up again. Summary

This interview, it can be said that I have experienced all interviews, ask the most, the most comprehensive. The comprehensive requirements for people are very high and the interviewers are generally nice. Through this interview I also found myself serious deficiencies. Many of the knowledge is still on the very surface of the level, not a little bit deeper. This is also no way of things Ah, who let me is halfway decent, and still engage in Android origin. Accumulation AH accumulation, Long March road long.

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.