1. At is platform independent?
Ans: java is not platform independent, rather its application is platform independent. This is due to the byte code which can be interpreted by jvm which covert it into executable code, which was directly done in case of C/C++.
2. How do you redirect in JSP and in Struts?
Ans: If you use response.sendRedirect("path") you will lose your request object.
Use requestDispatcher.forward("path") to retain your request object.
3. Why all methods are virtual ?
Ans: We have seen the problem of Multiple Inheritance in other OOP language like C++, where the solution was to make the function explicitly virtual. To avoid this every function in java is by default virtual
4. What is the disadvantage of threads?
Ans: The main disadvantage of thread is: There are number of functions of threads are run in a program.so, we can't use the similar(particular) thread.
5. what is session pooling?
Ans: The Session Pool contains sessions created from transactions that originate in the Start state and have no input/output parameters.
6. What is the use of keyword transient
Ans: Transiate is a access modifier that can not be serialized, Means it is unable to maintain its state.If we declare any varrible as transiate then that varrible is cannot be serialized.We cannot send that data onto the network.
7. What is session pooling?
Ans: Stateless Session beans are pooled and shared between clients. In general pooling is sharing resources rather than allocating new one for each request.
8. Why we can not override static method?
Ans: A Static method is class-specific and not part of any object, while overriding methods are involved on behalf of objects of the subclass. However, a static method in a subclass can hide a static method in the superclass.
9. What is difference b/n forward and sendRedirect?
Ans: forward : when forward is used server forwards the request to the new url and the control stays on the same page. in other words it just forward the request to new ur and come back fomr where forward is called.
sendRedirect : sendRedirect forward the request to url as new request and the cotrol goes to the destination page and never come back to the calling page
10. What is deadlock and how it can be avoid?
Ans: Deadlock is a situation when two threads are waiting on each other to release a resource. Each thread waiting for a resource, which is held by the other waiting thread. In Java, this resource is usually the object lock obtained by the synchronized keyword.
11. How all can you free memory?
Ans: If a programmer really wants to explicitly request a garbage collection at some point, System.gc() or Runtime.gc() can be invoked, which will fire off a garbage collection at that time.
12. What is CDC?
Ans: The Connected Device Configuration (CDC) is a specification for a J2ME configuration. Conceptually, CDC deals with devices with more memory and processing power than CLDC; it is for devices with an always-on network connection and a minimum of 2 MB of memory available for the Java system.
13. What is the sweep and paint algorithm ?
Ans: The painting algorithm takes as input a source image and a list of brush sizes.
sweep algo is that it computes the arrangement of n lines in the plane a correct algorithm.
14. What does a well-written java program look like?
Ans: A well-written java program exhibits recurring structures that promote abstraction, flexibility, modularity and elegance.
15. What is heap in Java?
Ans: JAVA is fully Object oriented language. It has two phases first one is Compilation phase and second one is interpratation phase. The Compilation phase convert the java file to class file (byte code is only readable format of JVM) than Intepratation phase interorate the class file line by line and give the proper result.
16. What is the MIDP?
Ans: The MIDP defines a set of APIs for mobile devices, such as cell phones and low-end PDAs
17. What is difference between War file and Ear file?
Ans: War - This is Web Application archive which contains basic web application like servlet, jsp, html. This can be run on simple tomcat server.
EAR - This is enterprise application which can have many War and EJB and other j2ee components into it and this can be run on weblogic , websphere.. and other server which supports enterprise application.
18. What are the differences between ArrayList and a Vector ?
Ans: ArrayList will grow half the size what you initialise ..where as vector will grow doble the initial size.
19. What is CDC?
Ans: The Connected Device Configuration (CDC) is a specification for a J2ME configuration. Conceptually, CDC deals with devices with more memory and processing power than CLDC; it is for devices with an always-on network connection and a minimum of 2 MB of memory available for the Java system.
20 .hat is difference between abusinesslogic nd presentation logic?
Ans: Presentation's responsibilities are display information to users and interpret commands from use into action upon domain and data source.
buinesslogic's responsibilities are logic upon domain.