Java interview 32 questions

Source: Internet
Author: User

First, let's list these 32 questions. You can leave me alone and think about what it will do if the interview feels like.

First, let's talk about the differences between final, finally, and finalize.

Second, can anonymous inner class (anonymous internal class) be extends (inherited) other classes, or implements (implemented) interface (Interface )?

Third, the difference between static nested class and inner class is that the more you say, the better (the more general the interview questions are ).

Fourth, the difference between & and.

Fifth, the difference between hashmap and hashtable.

Sixth, the difference between collection and collections.

7. When to use assert.

Eighth, what is GC? Why does GC exist?

Ninth, string S = new string ("XYZ"); how many string objects are created?

10. How much is math. Round (11.5? Math. Round (-11.5) and so on?

11th, short S1 = 1; S1 = S1 + 1; what is the error? Short S1 = 1; S1 + = 1; what is the error?

12th. What is the difference between sleep () and wait?

13th. Does Java have a goto?

14th, does the array have the length () method? Does string have the length () method?

15th, the difference between overload and override. Can the overloaded method change the type of the returned value?

16th. The elements in the set cannot be repeated. How can we identify whether the elements are repeated or not? Is = or equals () used ()? What are their differences?

17th. Give me the most common runtime exception.

18th, what is the difference between error and exception?

19th, list, set, and map are inherited from the collection interface?

20th. What is the difference between abstract class and interface?

21st can abstract methods be both static, native, and synchronized?

22nd. Can an interface inherit an interface? Can an abstract class implement the (implements) interface? Can an abstract class inherit a concrete class )?

23rd. Is run () or start () used to start a thread ()?

24th. Can constructor be overwritten?

25th. Can I inherit the string class?

26th. After a thread enters a synchronized method of an object, can other threads access other methods of this object?

27th, there is a return statement in try {}, so will the code in finally {} following this try be executed? When will it be executed, before or after return?

28th. Programming question: how many equals 2x8 in the most efficient way?

29th, the two objects have the same value (X. Equals (y) = true), but different hash codes are available, right?

30th. After an object is passed as a parameter to a method, this method can change the attributes of the object and return the changed result, so is it a value transfer or a reference transfer?

31st. Does swtich work on byte, long, and string?

32nd programming question: Write a singleton.

 

Some interview questions are nonsense. For example, the names of the three terms in the first question are a little similar. In fact, there is no connection at all. What are the differences?

 

 

 

 

 

 

 

 

 

 

 

 

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.