Owner: javainterviewquestions URL:http://www.bestjavainterviewquestions.com/ Join Date: Fri, 20 Jun 2008 20:52:13 -0500 Rating:0 Site Description: This site will give all the relavent and important information which can help u in the interview point of view Site statistics:Click here
Cookie Examples 2008-09-08 13:04:50 Introduction
Cookie
s are a way of storing data on the client side. They have been used extensively for personalization of portal sites, user preference tracking, and logging into web sites. For enterprise customers using cookies in their web sites, cookie support in Java Plug-in and Java Web Start facilitates deployment of client-side Java.
Cookie support allows a [...] Read more:Examples
Define Stateless Session 2008-09-07 07:36:18 what is stateless
Refers to software that does not keep track of configuration settings, transaction information or any other data for the next session. When a program “does not maintain state” (is stateless) or when the infrastructure of a system prevents a program from maintaining state, it cannot take information about the last session into the [...]
Define Cookie Poisoning 2008-09-07 06:36:53 Q) What is cookie poisoning:
A) The modification of or theft of a cookie in a user’s machine by an attacker in order to release personal information. If the cookie contains username and password, thieves can use their own computers and confiscated cookies to enter victims’ accounts. See cookie. Read more:Cookie
Explain session destroy in Servlets 2008-09-02 13:30:03 Question: How you can destroy
the session
in Servlet?
Answer: You can call invalidate() method on the session object to destroy the session. e.g. session.invalidate();
Explain Session tracking using Servlet 2008-09-02 13:29:04 Question: How to track a user session in Servlets?
Answer: The interface HttpSession can be used to track the session in the Servlet. Following code can be used to create session object in the Servlet: HttpSession session = req.getSession(true);
Define Session Migration 2008-09-02 13:27:46 Question: What is Session Migration
?
Answer: Session Migration is a mechanism of moving the session from one server to another in case of server failure. Session Migration can be implemented by:
a) Persisting the session into database
b) Storing the session in-memory on multiple servers.
Define Session Hijacking 2008-09-02 13:26:52 Question: What is session hijacking?
Answer: If you application is not very secure then it is possible to get the access of system after acquiring or generating the authentication information. Session hijacking refers to the act of taking control of a user session after successfully obtaining or generating an authentication session ID. It involves an attacker [...]
Java Package 2008-09-23 11:44:06 Package : A package represents a sub directory where we store some Classes and Interfaces
Also A package is a sub directory that contains a group of Classes and Interfaces
Advantages of Packages :
1) It hides Classes and Interfaces in a subdirectory so that accidental deletion is not possible
2) The Classes of one [...]
Naming Conventions in Java 2008-09-23 11:18:06 1) Package name in java are written in all small (lower) case letters
Ex: java.awt.
java.io.
java.swing.
2) Each word of classnames and interface names start with a capital.
Ex. String, DataInputStream, ActionListener.
3)Method names starts with a small letter if there is only the method name itself other wise leaving first each word the method start Read more:Naming
Calling a Method in Java 2008-09-22 12:09:13 Calling a Method in Java : The methods called in java in 2 types
a) Create an object to the class to which the method belongs
syntax:
Classname obj=new Classname();
ForEx : First is a java program
then we can create and object to that class as follows:
First f=new First();
Here ‘f’ is the object of the class [...] Read more:Calling
What is Default Package in Java 2008-09-22 11:59:54 The default package in java is
import java.lang package
Related Posts
No Related Post Read more:Default
Difference between Print() and Println() Methods in Java 2008-09-22 11:57:12 print() : Print
Method displays the result and then keeps the cursor in the same line
println() : Println Method also displays the result and then throws the cursor to the next line.
print() and println() are belongs to the PRINTSTREAM class in Java
Related Posts
No Related Post Read more:Methods
What are Command Line Arguments in Java 2008-09-22 11:50:21 Command Line Arguments :The values passed to the main method are called command line arguements
(String args[]):
This means Java will take the values as String array[].
Related Posts
No Related Post Read more:Command Line
Explain Java Main Method. 2008-09-22 11:43:27 Java Main Method:
public static void method(String args[])
Here:
public: It means that it is available to other programs,methods.
Static: A static method is a method that can be called and executed without using an object, means it can be called using the class name itself.
Void : Without return type
Related Posts
No Related Post
What is API 2008-09-22 11:34:53 API: Application Programing Interface
API is a “.html file” that contains description of all the features of a software/a product (or) technology.
[...]
Explain Java Comments 2008-09-22 11:29:36 # Define Java Comments
?
There are 3 types of comments in JAVA.
a) Single Line Comments:
This Comments start with ‘//’.
For Ex: // This is a single line comment for only one line
b) Multi-Line Comments:
This Comments starts with ‘ /* ‘ and ends with ‘ */ ‘.
For Ex:
/*
—————
—————This is a Multiple line
Creating the Java Class 2008-09-22 11:13:46 # Writing the First Program in Java
/* This is my First Program
To Display the message
Author:……….
Version:…….
Project:……….*/
import java.lang.*;
Class First{
// we initialize variables and methods here.
public static void main(String args[])
//The Java program is executed by JVM by calling the Main Method.
// The JVM starts execution of a java pro Read more:Creating
Difference between errortag and message tag 2008-10-05 05:29:25 Q) What is the difference between errorstag and message tag?
Rep) Errorstag genereates the error
for Ex:
<%@ taglib uri=”/tags/struts-html” prefix=”html” %>
O/P of rs.jsp
</html:errors/>
When the errors tag is evaluated a list of error message will be generated based on the ActionError objects available in ActionError objects available in ActionErrors object
Thread safety of the servlet 2008-10-05 01:05:45 Q) How to ensure the thread safety of the servlet?
Rep)
1) It is better to avoid instance variables & static variables in a servlet class
2) If the instance variable reference to a threadsage object then there will be no problem
3) If all Instance variables refers to an object that is not thread safe then we [...] Read more:Thread
GoTo statement in Java 2008-10-05 00:37:38 Q) GoTo statement
are not available in Java why?
Rep)
1) Goto statement decrease readability of a program.
2) Goto statement may from Infinite loop
3) Goto’s are not part of Structured programming
4) Goto statments make documentation difficult.
A goto statement can cause program control to end upalmost anywhere in the program,for reasons that are often hard to unravel [...]
What is unicode System 2008-10-05 00:19:26 Rep) UNI code is a specification to include the alphabet of all international languages into the character set of ‘Java’
UNI code system use ‘2 bytes’ to represents a single character
why a char need 2 bytes:
–> Sun People are given provision to all the international and classical language. In which java can be written that’s [...] Read more:System
Can we provide a constructor in the servlet class 2008-10-05 00:11:19 Rep) As the Web Container uses newInstance() method for creating the servlet object,If requiered we can provide a zero arguent constructor
Related Posts
No Related Post Read more:class
How the Web Container creates a servlet object 2008-10-05 00:09:36 Rep) Web Container
reads the name of the servlet class from web.xml and uses Class.forName() method to load the servlet class and it calls the newInstance() method to create the servlet Object.
Related Posts
No Related Post
Difference between GET and HEAD request methods 2008-10-05 00:05:05 Rep) When the client sends GET request, As part of the response the server will send initial response line, N no of Header and response Body.
When the client sends HEAD request. As part of the response the server will send initial response line and N no.of header as (i.e the server will not send the [...]
Explain executeQuery Method 2008-10-04 23:39:24 ExecuteUpdate() Mehod :-
executeQuery() method returns a Resultset object(ResultSet is an Interface)
A java application can used to result set object to fetch the data from the database server
Note: When a Result set is opened(created) it will point to ‘Before first Row’
To make the ResultSet point to the first row we can call rs.next() immedetly after [...]
Explain executeUpdate Method 2008-10-04 09:40:58 ExecuteUpdate() Mehod :- ExecuteUpdate returns and integer indicating the number of rows effected(changes)
When stmt.executeUpdate is called, the JDBC Driver sends the SQL Statement(create—) to the database server. The database server parses and execute the SQL statement
Note: Any Business application uses the Database servers to perform the following 4 operations(getting the data for availa
Load Factor 2008-11-05 19:54:18 Ques) What is LoadFactor?
Rep) LoadFactor is useful to determine the point where the capacity of the Hashtable (HashMap) will be doubled For Hashtable initial capacity * loadfactory–>11 * 0.75=8
Therefore afterstarting 8th pair key values, the capacity of the Hashtable will be “Doubled” –>11*2=22.
Hashtable ht=new Hashtable(100);
|__ It is the inital capacity o
Marking or Tagging Interface 2008-11-05 19:48:09 Ques) What is Marking (or) TaggingInterface
?
Rep) It is an interface without any methods it is useful to indicate a special purpose for the objects of a class