When To Use Interfaces
An interface allows somebody to start from scratch to implement your interface or implement your interface in some other code whose original or primary purpose was quite different from your interface. To them, your interface is only incidental, something that have to add on to the their code to be able to use your package.
When To Use Abstract classes
An abstract class, in contrast, provides more structure. It usually defines some default implementations and provides some tools useful for a full implementation. The catch is, code using it must use your class as the base. That may be highly inconvenient if the other programmers wanting to use your package have already developed their own class hierarchy independently. In Java, a class can inherit from only one base class.
2) Explain System.out.println ?
System is a predefined final class,
out is a PrintStream object and
println is a built-in overloaded method in the out object.
3) What we will get if System.out.println(null) and why?
Compilation error
4) How to create the immutable class with the properties as name and date ? tell any 2 ways ???
5) How to find out ip address of the java address ?
6) How to read the last 100 lines in a 1GB file ?
7) How can we find the free memory in java ?
8) Will the immutable objects impact the Garbage collection ? Are the immutable objects are good or bad for GC?
9) Open a file à modify the file àclose the file à where can we close the file ?
10) For (1 to 100) { string str =”Hello” } how many string objects are created in the for loop ?
11) Basic structure of Hash table? Code to write our own hash table ? create a class , 2 properties like key and value.. use collection to do it ……. What makes the hash table as so fast ??
12) How to you write a singleton class… implements serializes …but can we make them deserialiable .. what method .. any type single ton method.. which method we need to override … clone()
13) How do you create a connection? load the driver manager ?
14) How to execute a sql statement using java
15) If the invoke a close() under a statements … will the resultSet object will be closed ?
16) How many resultsets can we have for a statement ?
17) Out of memory .. how can we resolve the error ??? which method we are supposed to use ????
18) What are cursors .. ??? what is purpose of cursors ….
19) How do insert data to DB using JDBC ? excuteUpdate() or excute() what are the other ways ????
20) Resultset .insertRow ()
21) Diff between Forward() and sendRedirect () ?
22) We have servlets .. how can measure execution time of a servlets ? suppose we have login logic ???
23) What is doPost() ? how do we get the doPost() execution time ???
24) How can find no. of requests comings to a web application ???
25) Every time any request comes to web application , we want to write some info into log file.. what methods we use ?
26) A jsp returns a message “Welcome “ … the jsp can’t be modified by us… how can change the “welcome” message to “Goodbye “ ?
27) How do we implements filter ?
28) What is design pattern used in Struts ? MVC
29) How many Action servlets object can be there in struts ?
30) In struts , how can I pass my objects to actionServlet … simultaneous 2 or more
31) Extend the actionServlet .. which method we are suppose to override ? excute () ?
32) Jsp page … form à button à send a button .. click multiple times.. multiple times the files has been sent ?? how can we slove this … that only one time the files has to sent instead of multiple times ….. in struts and normal ???
33) Anyone can access the page.. one can access the file.. other can’t access the page .. access controller API ???
34) What is outer join?
35) What is biff between outer join and inner join?
36) Syntax to create a SP…
37) Table , varchar filename, filesDesc .. data is case sensitive ???
38) File table … fileID ,filename , file table is very huge …. To run the query .. it is taking 10 min… how can we tune the query ?????
39) Is the data in Oracle is case sensitive ?
40) How to execute the SP in SQL+ ?
41) How do we parse XML in java ?
42) Diff between SAX and DOM ?
43) How to we modify the XML as a well-formed??
44) How can we know that some attribute has been set to the session?
45) How can we make sure that parent class method is going to modify by the child class ?
46) What is a thread dump?
47) How many sockets can w open in Java at a time ?
48) How do we create server socket ?
49) What are features of JDK 1.5 ?
50) What are Auto switch Jobs ?
51) Difference between CVS and SVN ?
52) What is object in JavaScript?
53) How do we solve the memory leaks in java ? when do the memory leaks occur ?
54) How do we debug a jsp in product env .?
55) How to select different targets in Ant?
56) What is the root element in Ant?
57) How do we know that some events are happening in Java ?
58) Difference between doPost() and doGet() ?
59) How do we make the singleton as 100% even in 2 JVMS ?
60) What is thread Local class?
61) How do we delete a file in Java?
62) Dif between string buffer and string builder and string?
63) We have 32 bit JVM, but we are going to read 3GB data,, due to this we are going to get out of memory.. how we are going to handle the situation suing JDBC ?
64) Other way to insert data using JDBC other than execute() ?
65) What is setrogated key in DB ?
66) How would we create a object which is similar to hash table ?
67) How can we create a single ton class which implements serializable ?
68) How many ways can we create instance in java ?
69) what is the difference b/w request.getAttribute & getPrameter
To clarify just a bit. Parameters in a request are set there by the HTML client when the request is created, typically from elements (input and file elements to be exact) within an HTML form. Therefore if the form that called your servlet/JSP page had an element with a name "fred", you would retrieve the value of that form element by using getParameter("fred"). An HTML form does not set attributes, only parameters.Attributes are set programatically. If you set an attribute, then you can get it. This is typically done by a servlet or java POJO that either does some pre-processing and sets some additional attribute values, or one that processes the request, finds errors and therefore sets attributes and returns the request back to the originator. The originator may look for these attributes (for example error messages) and display them. You don't programatically set parameters, only attributes. -
70) how to change the port number in tomcat -- RUNNING.txt
71) where does the Ajax lies – both in the server side & client side…
72) what is the default port number of oracle – 80
73) What are the different transaction mgt in spring?
74) 6) where exactly we deploy the war file in tomcat --- webapps
75) what is the configuration we need to make to configure the debug mode in the eclipse – just run in the debug mode..
76) what are steps to configure the Tomcat with eclipse ..
77) what are inner joins & outer joins -
In outer Join some extra rows will come but in the inner join we get only the common rows. There is no option for the outer join to add the left or right joins..
78) how the resultSet maps to the data fetched from the query?
79) How can we make the code as synchronized w/o using the synchronized key word.
Use the Lock concept in JDK1.5
12) How Log4J works internally? What are the severity levels in it?
13) what is diff/bt warning & bug in log4J?
14) what are the advantages of the inheritance & polymorphism?
15) How do we send the java objects to the stored procedures?
16) how do we the session object in the servlet?
Http Session session = request.getSession(true);
*) why do we need a protocol specific sessions.
17) can we call abstract method in the non abstract () – yes.
18) Inheritance advantages
19) why we need so many layers in our project?
20) how can make sure that the implementing class will call the non shape.. color..
21) with using normal joins .. how many rows will get? no of rows of first table * no of rows in 2nd table
22) Implementation of the Abstraction & exact meaning of Abstraction?
23) Implementation of the Encapsulation
24) what is the significant of the user- defined exception?
25) is synchronized is the access modifier?
26) multicasting? – During the java sockets we need to use the multicasting.
27) main() of one class can be called in other class? - yes
28) throw & throws & throwable?
29) can a static class be there? No
30) Different methods in Redirecting the servlets? – RequestDispatcher.farward() & response.sendRedirect()
31) Advantages of the datasources over JDBC?
32) Abstract Factory pattern?
33) Inner Joins, outer joins & normal joins?
34) What algorithm does the Garbage collector uses?
35) How many static blocks can a class can have?
36) How to sort the arraylist.. – sort().
37)JDBC steps….
38) DriverManager is a interface or a class? - class
39) What does Class.forName return? - returns the class instances that representing the class….
Mainly it loads the class & returns the instatnce of the given class.
40) What are the ways to create an instance of the class?
a. Using new operater
b. Using the class.forname(“fdgdf ”).newInstance()
c. Using the deserialization
d. Using clone
41) Examples of the checked exceptions – FileNotFound.
42) How a Stored Procedure returns more than one RS.
a. Rs.getMoreResultset(), it also has rs.hasMoreResult.
43) How to pass an object to the Stored Procedure?
44) What is a RequestDispatcher?
a. RequestDispatcher dispatcher = getServletConfig ( ) .getServletContext ( ) .getRequestDispatcher ( "/"file_name ) ; dispatcher.forward ( request, response ) ;
b. ServletContext sc = getServletContext ( ) ; RequestDispatcher rd = sc.getRequestDispatcher ( url ) ; rd.forward ( req, res ) ;
45) Can a abstacr class contains the full nonabstact class?
46) Is it illegal to have a abstact modifier infornt of a interface method?
47) How can you pass the error page in the jsp…
a. In web.xml :
i.
49) How can we store the objects of the e.printstactTrace into a string & store into a DB?
a. StringWritter sw = new StringWritter(e.printStactTrace());
b. PrintWritter pw = new printwritter(sw);
c. String str = sw.tostring();
d. Store the str in the DB.
50) How do you handle Nullpointer exception?