《java英语面试大全.docx》由会员分享,可在线阅读,更多相关《java英语面试大全.docx(6页珍藏版)》请在三一办公上搜索。
1、java英语面试大全1. 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-ind
2、ependent power of Java 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 applications. Java beans is very powerful tool you can use in your servlet/JSP bridge. You ca
3、n use the servlets to build the bean and can be passed over to the JSP for reading. This provides tight encapsulation of the data while preserving the sanctity of servlets and JSP。 2. What is RMI? RMI stands for Remote Method Invocation. Traditional approaches to executing code on other machines acr
4、oss 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, and that you can send a message to the remote object and get a result as if the object lived on your local machine. Th
5、is simplification is exactly what Java Remote Method Invocation (RMI) allows you to do. 3. How does Java inheritance work? A class can only directly extend one class at a time. Multiple inheritance is only allowed with regard to interfaces. A class can implement many interfaces. But a class can only
6、 extend one non-interface class. 4. How does exception handling work in Java? 1.It separates the working/functional code from the error-handling code by way of try-catch clauses. 2.It allows a clean path for error propagation. If the called method encounters a situation it cant manage, it can throw
7、an exception and let the calling method deal with it. 3.By enlisting the compiler to ensure that exceptional situations are anticipated and accounted for, it enforces powerful coding. 4.Exceptions are of two types: Compiler-enforced exceptions, or checked exceptions and Runtime exceptions, or unchec
8、ked exceptions. Compiler-enforced (checked) exceptions are instances of the Exception class or one of its subclasses - excluding the RuntimeException branch. The compiler expects all checked exceptions to be appropriately handled. Checked exceptions must be declared in the throws clause of the metho
9、d throwing them - assuming, of course, theyre not being caught within that same method. The calling method must take care of these exceptions by either catching or declaring them in its throws clause. Thus, making an exception checked forces us to pay heed to the possibility of it being thrown. An e
10、xample of a checked exception is java.io.IOException. As the name suggests, it throws whenever an input/output operation is abnormally terminated. 5. Does Java have destructors? Java does not have destructors. Garbage collector does this job periodically depending upon the memory requirements of the
11、 machine and on the fact that a particular object is no longer needed. But it has finalizers that does a similar job. The syntax is public void finalize If an object has a finalizer, the method is invoked before the system garbage collects the object, but using finalize does not guarantee that it wo
12、uld be called b4 garbage collector is invoked. 6. What does the final keyword mean in front of a variable? A method? A class? A final variable cannot be reassigned, but it is not constant. For instance, final StringBuffer x = new StringBuffer; x.append(hello); is valid. X cannot have a new value in
13、it, but nothing stops operations on the object that it refers, including destructive operations. Also, a final method cannot be overridden or hidden by new access specifications. This means that the compiler can choose to in-line the invocation of such a method. (I dont know if any compiler actually
14、 does this, but its true in theory.) The best example of a final class is String, which defines a class that cannot be derived. 6. Access specifiers: public, protected, private, nothing? Public? Any other class from any package can instantiate and execute the classes and methods Protected? Only subc
15、lasses and classes inside of the package can access the classes and methods Private? The original class is the only class allowed to execute the methods. And in case if there is no modifier specified, it means, only the classes inside the package can access this class and its methods, it is also cal
16、led Friendly. Question:What is the difference between an Interface and an Abstract class? Question: What is the purpose of garbage collection in Java, and when is it used? Question: Describe synchronization in respect to multithreading. 1.what is single inheritance. ans:one class is inherited by onl
17、y other one class 9.what is interface. ans:Interface has only method declarations but no definition 10.what is differenec between abstract class and interface. ans:In abstract class some methods may contain definition,but in interface every method should be abstract 11.how to u prove that abstrace c
18、lass cannot instantiate directly. ans:As they dont have constructor they cant be instantiated 12.what is differenece between string and stringbuffer. ans:Strings are immutable where as string buffer can be modified 13.what is immutable ans:Which cant be changed 18.what is legacy interface. ans: lega
19、cy is something that is old in terms of technology/ system 19.what is main difference hashmap and hastable ans:Hash table is synchronized 20.what is main difference between arraylist and vector. ans:Vector is synchronised 22.what are distributed techonologies. distributed technologies means any tech
20、nology / s/w program that are having many components in multiple environments that interact with each other depending on the functional requirements and design. 23.what is advantage and disadvantage of distributed techonologies. language is avoided. Application can be built flexible to meet requirem
21、ents. Division of labour is possible. Best of all the technologies and platforms can be optimally utilized. Complexity of requirements can be reduced. 25.what is difference between procedure and functions. ans:Fuctions can return value ,procedures cant return value 26.what is jdbc. ans:Connecting to
22、 DB from java program requires JDBC 31.what is deployment descriptor. ans:Which contains the infrnmation like which file to be used 40.what is platfrom independent ans:A language is said to be platform independent if it can be run on any machine with out modifying code 46.what is major concepts in o
23、ops. ans:Abstraction,polymorphism,encapsulation,inheritance 48.what is implicit object. ans:Implicit objects are a set of Java objects that the JSP Container makes available to developers in each page 49.how many implicit objects in jsp ans:out,page,session,request,response,application,page context,config