Java Interview Questions
Java Interview Questions
About In this section we are offering interview questions for core java only. if you need interview questions for any other
java related technologies , please check the relevant sections.
4 Q What is synchronization
Synchronization is the ability to control the access of multiple threads to shared resources. Synchronization stops
A multithreading. With synchronization , at a time only one thread will be able to access a shared resource.
6 Q What is a Vector
A Vector is a grow able array of objects.
12 Q Can we declare an anonymous class as both extending a class and implementing an interface?
A No. An anonymous class can extend a class or implement an interface, but it cannot be declared to do both
13 Q What are the differences between boolean & operator and & operator
When an expression containing the & operator is evaluated, both operands are evaluated. And the & operator is applied to
the operand. When an expression containing && operator is evaluated, the first operand is evaluated. If the first operand
A
returns a value of true then only the second operand is evaluated otherwise the second part will not get executed. && is
also called short cut and.
Home | Interview Questions | Submit a question |Sun Certification | IBM Certification |Articles |Feedback | Privacy policy |About Us|
Home
Certifications Core Java Interview Questions
Interview
Questions
Articles
16 Q what is a the difference between System.err and System.out
Submit an article A We can redirect System.out to another file but we cannot redirect System.err stream
Contact us
17 Q What are the differences between an abstract class and an interface?
About A An abstract class can have concrete method, which is not allowed in an interface. Abstract class can have private or
protected methods and variables and only public methods and variables are allowed in interface. We can implement
more than one interface , but we can extend only one abstract class. Interfaces provides loose coupling where as
abstract class provides tight coupling.
24 Q What must be the order of catch blocks when catching more than one exception?
A The sub classes must come first. Otherwise it will give a compile time error.
25 Q How can we call a method or variable of the super class from child class ?
26 Q If you are overriding equals() method of a class, what other methods you might need to override ?
A hashCode
28 Q What is serialization ?
A Serialization is the process of saving the state of an object.
29 Q What is de-serialization?
A De-serialization is the process of restoring the state of an object.
30 Q What is externalizable ?
A It is an interface that extends Serializable. It is having two different methods writeExternal() and readExternal. This
interface allows us to customize the output.
Home | Interview Questions | Submit a question |Sun Certification | IBM Certification |Articles |Feedback | Privacy policy |About Us|
Home
Certifications Core Java Interview Questions
Interview Questions
Articles 31 QDoes garbage collection guarantee that a program will not run out of memory?
A Garbage collection does not guarantee that a program will not run out of memory. It is also possible for
Submit an article
programs to create objects that are not subject to garbage collection. And there is no guarantee that Garbage
Contact us Collection thread will be executed.
About
32 QWhat is a native method?
A A native method is a method that is implemented in a language other than Java.
36 QHow many times may an object's finalize() method be invoked by the garbage collector?
A Only once.
43 QWhat is the difference between static and non static inner class ?
A A non-static inner class can have an object instances that are associated with instances of the class's outer class.
A static inner class can not have any object instances.
Home | Interview Questions | Submit a question |Sun Certification | IBM Certification |Articles |Feedback | Privacy policy |About Us|
49 Q What is static ?
A static means one per class. static variables are created when the class loads. They are associated with the class. In order
to access a static we don't need objects. We can directly access static methods and variable by calling classname.
variablename.
55 Q What is casting ?
A Casting means converting one type to another. There are mainly two types of casting. Casting between primitive types and
casting between object references. Casting between primitive numeric types is used to convert larger data types to smaller
data types. Casting between object references is used to refer to an object by a compatible class, interface, or array type
reference.
59 Q What are the different ways in which a thread can enter into waiting state?
A There are three ways for a thread to enter into waiting state. By invoking its sleep() method, by blocking on I/O, by
unsuccessfully attempting to acquire an object's lock, or by invoking an object's wait() method.
Home | Interview Questions | Submit a question |Sun Certification | IBM Certification |Articles |Feedback | Privacy policy |About Us|
66 Q What is hashCode?
A The hashcode of a Java Object is simply a number (32-bit signed int) that
allows an object to be managed by a hash-based data structure. A
hashcode should be, equal for equal object (this is mandatory!) , fast to
compute based on all or most of the internal state of an object, use all or
most of the space of 32-bit integers in a fairly uniform way , and likely to
be different even for objects that are very similar. If you are overriding
hashCode you need to override equals method also.
69 Q What is final ?
Home | Interview Questions | Submit a question |Sun Certification | IBM Certification |Articles |Feedback | Privacy policy |About Us|
Home
Certifications Core Java Interview Questions
Interview Questions
WidgetBucks - Trend Watch - WidgetBucks.com
Articles 76 Q What do you mean by immutable ? How to create an immutable object ?
Submit an article A Immutability means an object cannot be modified after it has been initialized. There will not be
any setter methods in an immutable class. And normally these classes will be final.
Contact us
About 77 Q What is class loader in java ?
A A class loader is a class that is responsible for loading the class. All JVM contains one class
WidgetBucks - Trend Watch loader called primordial class loader.
- WidgetBucks.com
78 Q What is a weak reference ?
A A weak reference is the one that does nor prevent the referenced object from being garbage
collected. The weak reference will not keep the object that it refers to alive. A weak reference is
not counted as a reference in garbage collection. This will make the memory use more effective.
83 Q What is a Dictionary?
A Dictionary is a parent class for any class that maps keys to values., In a dictionary every key is
associated with at most one value.
89 Q What is JVM?
A JVM stands for Java Virtual Machine. It is the run time for java programs. All are java programs
are running inside this JVM only. It converts java byte code to OS specific commands. In addition
to governing the execution of an application's
byte codes, the virtual machine handles related tasks such as managing the system's memory,
providing security against malicious code, and managing multiple threads of program execution.
90 Q What is JIT?
A JIT stands for Just In Time compiler. It compiles java byte code to native code.
Home | Interview Questions | Submit a question |Sun Certification | IBM Certification |Articles |Feedback | Privacy policy |About Us|
94 Q What is finalize() ?
A Finalize is a protected method in java. When the garbage
collector is executes , it will first call finalize( ), and on the
next garbage-collection it reclaim the objects memory. So
finalize( ), gives you the chance to perform some cleanup
operation at the time of garbage collection.
95 Q What is multi-threading?
A Multi-threading is the scenario where more than one threads
are running.
96 Q What is deadlock?
A 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.
99 Q What is internationalization?
A Internationalization is the process of designing an
application so that it can be adapted to various languages
and regions without changes.
Home | Interview Questions | Submit a question |Sun Certification | IBM Certification |Articles |
Feedback | Privacy policy |About Us|
117 Q What are the different ways in which a thread can enter
into waiting state?
A There are three ways for a thread to enter into waiting
state. By invoking its sleep() method, by blocking on I/O,
by unsuccessfully attempting to acquire an object's lock, or
by invoking an object's wait() method.
118 Q What are the the different ways for creating a thread?
A A thread can be created by subclassing Thread, or by
implementing the Runnable interface.
Home | Interview Questions | Submit a question |Sun Certification | IBM Certification |Articles |
Feedback | Privacy policy |About Us|
Bootstrap ClassLoaders
Extensive ClassLoaders
System Classpath ClassLoaders
Application ClassLoaders
Home | Interview Questions | Submit a question |Sun Certification | IBM Certification |Articles |
Feedback | Privacy policy |About Us|
Home | Interview Questions | Submit a question |Sun Certification | IBM Certification |Articles |
Feedback | Privacy policy |About Us|
Home | Interview Questions | Submit a question |Sun Certification | IBM Certification |Articles |
Feedback | Privacy policy |About Us|
Home | Interview Questions | Submit a question |Sun Certification | IBM Certification |Articles |
Feedback | Privacy policy |About Us|
Home | Interview Questions | Submit a question |Sun Certification | IBM Certification |Articles |
Feedback | Privacy policy |About Us|
Home | JSP | EJB | JDBC | Java Servlets | WAP | Free JSP Hosting | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML
Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript |
JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
JDO Tutorials
EAI Articles
Struts Tutorials
Java Tutorials
Java Certification
Struts Tutorials
Q: What is Jakarta Struts Framework?
*Stuts TOC A: Jakarta Struts is open source implementation of MVC (Model-View-Controller) pattern for the
*Apache Struts Introduction development of web based applications. Jakarta Struts is robust architecture and can be used for the
* Struts Controller development of application of any size. Struts framework makes it much easier to design scalable, reliable
* Struts Action Class Web applications with Java.
* Struts ActionFrom Class
* Using Struts HTML Tags
*Struts Validator
Framework
*Client Side Address Q: What is ActionServlet?
Validation A: The class org.apache.struts.action.ActionServlet is the called the ActionServlet. In the the Jakarta
*Struts Tiles Struts Framework this class plays the role of controller. All the requests to the server goes through the
*tiles-defs.xml controller. Controller is responsible for handling all the requests.
*Struts DynaActionForm
*Struts File Upload Q: How you will make available any Message Resources Definitions file to the Struts Framework
*Struts DataSource Environment?
*AGGREGATING A: Message Resources Definitions file are simple .properties files and these files contains the messages
that can be used in the struts project. Message Resources Definitions files can be added to the struts-
ACTIONS config.xml file through <message-resources /> tag.
*Internationalization Example:
Struts Resources <message-resources parameter="MessageResources" />
*Struts Books
*Struts Articles Q: What is Action Class?
A: The Action is part of the controller. The purpose of Action Class is to translate the
*Struts Frameworks
HttpServletRequest to the business logic. To use the Action, we need to Subclass and overwrite the
*Struts IDE execute() method. The ActionServlet (commad) passes the parameterized class to Action Form using
*Struts Links the execute() method. There should be no database interactions in the action. The action should receive
*Struts Presentations the request, call business objects (which then handle database, or interface with J2EE, etc) and then
*Struts Projects determine where to go next. Even better, the business objects could be handed to the action at runtime
*Struts Software
(IoC style) thus removing any dependencies on the model. The return type of the execute method is
ActionForward which is used by the Struts Framework to forward the request to the file as per the value
*Other Struts Tutorial of the returned ActionForward object.
Web www.roseindia.net
Google Search
Q. How you will enable front-end validation based on the xml in validation.xml?
A: The <html:javascript> tag to allow front-end validation based on the xml in validation.xml. For
example the code: <html:javascript formName="logonForm" dynamicJavascript="true"
staticJavascript="true" /> generates the client side java script for the form "logonForm" as defined in the
validation.xml file. The <html:javascript> when added in the jsp file generates the client site validation
script.
Current Comments
44 comments so far (post your own) View All Comments Latest 10 Comments:
simply good& easy to understand,remember
Posted by bhaskar on Monday, 07.5.10 @ 23:18pm | #97973
View This Comment Separately
hi
i need java question.plz send me in my Email
Posted by sanjibkumar on Friday, 04.30.10 @ 21:20pm | #96727
file:///C|/Users/Ankur%20Chauhan/Downloads/Java%20interview%20questions/Jakarta%20Struts%20Interview%20Questions.htm (4 of 7) [04-Jan-11 3:11:09 PM]
Jakarta Struts Interview Questions
Home | JSP | EJB | JDBC | Java Servlets | WAP | Free JSP Hosting | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs