每个优秀的 Java/Java EE 开发人员都应该能够回答的问题?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2114212/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Questions every good Java/Java EE Developer should be able to answer?
提问by Rachel
I was going through Questions every good .Net developer should be able to answerand was highly impressed with the content and approach of this question, and so in the same spirit, I am asking this question for Java/Java EE Developer.
我正在研究每个优秀的 .Net 开发人员都应该能够回答的问题,并且对这个问题的内容和方法印象深刻,因此本着同样的精神,我为 Java/Java EE 开发人员提出了这个问题。
What questionsdo you think should a good Java/Java EE programmer be able to answer?
有什么问题你认为应在良好的Java / Java EE的程序员能够回答?
I am marking this question as community wiki as it is not user specific and it aims to serve programming community at large.
我将这个问题标记为社区维基,因为它不是特定于用户的,它旨在为整个编程社区提供服务。
Looking forward for some amazing responses.
期待一些惊人的回应。
EDIT: Please answer questions too, as suggested in the comments, so that people could learn something new regarding the language, too.
编辑:也请按照评论中的建议回答问题,以便人们也可以学习有关该语言的新知识。
采纳答案by Jeff
What is the relationship between hashCode() and equals()? What is the significance of these methods? What are the requirements for implementing them?
hashCode() 和 equals() 有什么关系?这些方法有什么意义?实施它们的要求是什么?
回答by Jon
What is the difference between Set, Map and List?
Set、Map 和 List 之间有什么区别?
I'm still amazed how many people don't know this one in a telephone interview.
我仍然很惊讶有多少人在电话采访中不知道这个。
回答by mP.
Describe the differences between the "four" (not three ;)) types of inner class..
描述内部类的“四种”(不是三种 ;))类型之间的区别。
回答by Chinmay Kanchi
Trick question: What kinds of parameters are passed by reference in Java?
技巧问题:Java 中通过引用传递哪些类型的参数?
It's amazing how many people still parrot the "primitives are passed by value, objects are passed by reference" mantra.
令人惊讶的是,有多少人仍然重复“原始值按值传递,对象按引用传递”的口头禅。
回答by Dan
Advantages and disadvantages of thread-safe classes and explicitly synchronized code and examples of good applications of both. It is often not correct to trust on thread-safe classes as guarantees for data consistency in multi-threaded applications.
线程安全类和显式同步代码的优缺点以及两者的良好应用示例。信任线程安全类作为多线程应用程序中数据一致性的保证通常是不正确的。
回答by sateesh
Usage of finalkeyword in method calls.
For example why does the method testin below code does not give any compile error despite using finalqualifier for the method parameter.
在方法调用中使用final关键字。例如,尽管对方法参数使用了最终限定符,但为什么下面代码中的方法测试没有给出任何编译错误。
class Name {
private String name;
public Name (String s) {
this.name = s;
}
public void setName(String s) {
this.name = s;
}
}
private void test (final Name n) {
n.setName("test");
}
class Name {
private String name;
public Name (String s) {
this.name = s;
}
public void setName(String s) {
this.name = s;
}
}
private void test (final Name n) {
n.setName("test");
}
回答by Pascal Thivent
Many questions and interviews are available at http://www.techinterviews.com/interview-questions/javaand I don't really see value in copy / pasting a selection of them.
http://www.techinterviews.com/interview-questions/java上提供了许多问题和采访,我认为复制/粘贴其中的一部分并没有什么价值。
No, it's up to you to create your own compilation of things youthink are important. Personally, I proceed always in two steps: first a few questions to get a basic idea of the experience and skills, then a problem solving situation. I'm indeed not convinced that being able to answer any knownquestions makes you a good or bad unknownproblems solver. So, I prefer to ask people to solve a given problem, to give them some requirements, and ask them to write code (but not on paper). I give them some time to come back to me and check how they did it, their coding style, how they used the suggested APIs, etc.
不,您可以自行编辑您认为重要的内容。就我个人而言,我总是分两步进行:首先是几个问题来了解经验和技能的基本概念,然后是解决问题的情况。我确实不相信能够回答任何已知问题会让你成为一个好的或坏的未知问题解决者。所以,我更喜欢让人们解决给定的问题,给他们一些要求,并让他们写代码(但不是写在纸上)。我给他们一些时间来找我检查他们是如何做到的、他们的编码风格、他们如何使用建议的 API 等。
That all being said, my favorite question is "what don't you like about Java?" (in the spirit of this one). It is really a excellent question, it gives you an immediate feedback on how much a candidate has used Java and explored its API and if he just religious about it or not (as the OP wrote).
话虽如此,我最喜欢的问题是“您不喜欢 Java 的哪些方面?” (本着这一精神)。这确实是一个很好的问题,它可以让您立即反馈有关候选人使用 Java 和探索其 API 的程度以及他是否只是对此感兴趣(如 OP 所写)。
Update:As suggested by CPerkins, a better wording for the question suggested above might be "What would you most like to see changed in Java?". And indeed, I prefer this way.
更新:正如 CPerkins 所建议的那样,对上述问题的更好措辞可能是“您最希望看到 Java 中的哪些变化?”。事实上,我更喜欢这种方式。
回答by Ravisha
Simple questions such as,
简单的问题,例如,
- What is JRE and JDK?
- Why does java claim interoperability?
- 什么是 JRE 和 JDK?
- 为什么java声称具有互操作性?
Though these are very basic, many developers do not know the answers. I suggest these be asked before the code-related queries.
尽管这些都是非常基础的,但许多开发人员并不知道答案。我建议在与代码相关的查询之前询问这些。
回答by Adisesha
What is 'System', 'out', 'println' in System.out.println ? What happens when you call 'put' on HashMap ?
System.out.println 中的 'System', 'out', 'println' 是什么?当你在 HashMap 上调用 'put' 时会发生什么?
回答by Kristian
How about what is a session bean and describe some differences between stateless and stateful session beans.
什么是会话 bean 并描述无状态和有状态会话 bean 之间的一些区别。