Java面试中最经常被问到的问题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Java面试中最经常被问到的问题
1. What is the difference between an Applet and an Application?
2. What are java beans?
3. What is RMI?
4. What gives java it's "write once and run anywhere" nature?
5. How does Java inheritance work?
6. What are native methods? How do you use them?
7. Class A subclass B subclass C. All override foo(). I cast C to A and call foo(). What happens? C an C call A->foo()?
8. What does the "static" keyword mean in front of a variable? A method? A class? Curly braces {}?
9. How many different types of JDBC drivers are present? Discuss them.
10. Does Java have "goto"?
11. Why "bytecode"? Can you reverse-engineer the code from bytecode?
12. How does exception handling work in Java?
13. Does Java have destructors?
14. What does the "final" keyword mean in front of a variable? A method? A class?
15. Access specifiers: "public", "protected", "private", nothing?
3. What is RMI?
4. What gives java it's "write once and run anywhere" nature?
5. How does Java inheritance work?
6. What are native methods? How do you use them?
7. Class A subclass B subclass C. All override foo(). I cast C to A and call foo(). What happens? C an C call A->foo()?
8. What does the "static" keyword mean in front of a variable? A method? A class? Curly braces {}?
9. How many different types of JDBC drivers are present? Discuss them.
10. Does Java have "goto"?
11. Why "bytecode"? Can you reverse-engineer the code from bytecode?
12. How does exception handling work in Java?
13. Does Java have destructors?
14. What does the "final" keyword mean in front of a variable? A method? A class?
15. Access specifiers: "public", "protected", "private", nothing?
1. What is the difference between an Applet and an Application?
A Java application is made up of a main() method declared as public static void that accepts a string array argument, along with any other classes that main() calls. It lives in the environment that the host OS provides.
A Java applet is made up of at least one public class that has to be subclassed from java.awt. Applet. The applet is confined to living in the user's Web browser, and the browser's security rules, (or Sun's appletviewer, which has fewer restrictions).
The differences between an applet and an application are as follows:
1. Applets can be embedded in HTML pages and downloaded over the Internet whereas Applicatio ns have no special support in HTML for embedding or downloading.
2. Applets can only be executed inside a java compatible container, such as a browser or appletvie wer whereas Applications are executed at command line by java.exe or jview.exe.
3. Applets execute under strict security limitations that disallow certain operations(sandbox model security) whereas Applications have no inherent security restrictions.
4. Applets don't have the main() method as in applications. Instead they operate on an entirely diff erent mechanism where they are initialized by init(),started by start(),stopped by stop() or destroye d by destroy().
2. What are java beans?
JavaBeans is a portable, platform-independent component model written in the Java programming language, developed in collaboration with industry leaders. It enables developers to write reusable components once and run them anywhere -- benefiting from the platform-independent power of Ja va technology. JavaBeans acts as a Bridge between proprietary component models and provides a seamless and powerful means for developers to build components that run in ActiveX container ap plications.
Java beans is very powerful tool you can use in your servlet/JSP bridge. You can use the servlets t o build the bean and can be passed over to the JSP for reading. This provides tight encapsulation o f the data while preserving the sanctity of servlets and JSP.
3. What is RMI?
RMI stands for Remote Method Invocation. Traditional approaches to executing code on other ma chines across a network have been confusing as well as tedious and error-prone to implement. The nicest way to think about this problem is that some object happens to live on another machine, an d that you can send a message to the remote object and get a result as if the object lived on your lo cal machine. This simplification is exactly what Java Remote Method Invocation (RMI) allows yo u to do.
4. What gives java it's "write once and run anywhere" nature?