1.First Interview:
10-10-2009
1)How many ways are there to create an object?
i) Using ‘new’ operator:
Test s=new Test();
ii) Factory method:
Thread
t=Thread.currentThread();
iii) newInstance():
Class c=Class.forName(“Test”);
Object
obj=c.newInstance(); àcreates
Test class Object.
Test t=(Test)obj;
iv) clone():
Test t1=new
Test(10,20);
Test
t2=t1.clone();
v) Deserialization:
FileInputStream fis=new FileInputStream(“Test.txt”);
ObjectInputStream ois=new
ObjectInputStream(fis);
UserDefSerCls uds=new UserDefSerCls(,” ”,);
Ois.readObject(uds);
Ois.close();
2) What are the
differences b/w HashMap and HashSet?
HashMap
|
HashSet
|
It stores the data in key,value format.
It allows duplicate elements as values.
It implements Map
It allows only
one NULL key.
|
It stores
grouped data .
It does not
allow any duplicates.
It implements Set.
It does not allow
NULL .
|
3) What is the
difference b/w wait(-), sleep(-)& wait(-),yield()?
Wait(-)
|
Sleep(-)
|
Running
to Waiting/
Sleeping/Block.
It makes the current thread to sleep up to the given seconds and it could sleep less than the
given seconds if it receives notify()/notifyAll() call.
In this case, the locks
will be released before going into
waiting state so that the other threads that are waiting on that object will use it.
Causes current thread to wait until either another
thread invokes the
notify()
method or the notifyAll()
method for this object, or a specified amount of time has elapsed. |
Do
It makes the current thread to sleep for exactly the given seconds.
In case of
sleep(), once the thread is entered
into
synchronized block/method, no other
thread will be able to enter into that
method/block.
|
Yield()à when a task invokes
yield(), it changes from Running state
to Runnable state.
*4) Can we create a userdefined immutable class?
Yes.
i)
Make the
class as final and
ii)
make the data
members as private and final.
*5) What are the differences b/w String and
StringBuffer?
String
|
StringBuffer
|
It is immutable.
It won’t
give any additional space.
|
It is mutable.
gives 16
additional characters memory space.
|
6) Which “Collections F/W” classes did you use in your project?
List, ArrayList, LinkedList—add()
Set, TreeSet,
HashSet--
HashMap—put(),
get(), entrySet(), keyset()
Map.Entry
Iterator----hasMoreElements(),
next()
ListIterator.
7) Can you write the simple code for HashMap?
HashMap<String,String> hm=new
HashMap<String,String>();
hm.put(“key1”,”value1”);
hm.put(“key2”,”value2”);
hm.put(“key3”,”value3”);
Set
set=hm.keySet(); // gives
keys Set i.e., {key1,key2,key3}
Iterator<string>
itr=set.iterator();
while(itr.hasNext()){
//true….false
String empkeys=itr.next();
//for keys
String empvalnames=hm.get(empkeys); //gives values
by taking keys.
System.out.println(“empname”+empvalnames+”empid”+empkeys);
}
8) What are thread
states?
i) Start: Thread thread=new Thread();
ii) Runnable:
looking for its turn to be picked for
execution by the Thread Schedular based
on thead priorities.
(setPriority())
iii) Running: The Processor
is actively executing the thread code. It runs until it becomes
blocked, or voluntarily gives up its turn with Thread.yield().
Because
of Context Switching overhead, yield()
should not be used very
frequently.
iv) Waiting: A
thread is in a blocked state while it
waits for some external processing such
as file I/O to finish.
Sleepingàsleep(): Java threads are forcibly put to sleep (suspended) with this overloaded method.
Thread.sleep(milliseconds);
Thread.sleep(milliseconds,nanoseconds);
Blocking
on I/O: Will move to runnable after I/O condition like reading bytes of
data etc changes.
Blocked on Synchronization: will move to
Runnable when a Lock is acquired.
v) Dead: The thread
is finished working.
How to avoid Deadlock:
1) Avoid
a thread holding multiple locks----
If no thread attempts to hold more than one
lock ,then no deadlock occurs.
2) Reordering lock acquisition:--
If we require threads to always
acquire locks in a particular order, then no
deadlock occurs.
2.Oracle
Corporation:- 15-11-2009
9) What are differences b/w concrete,abstract
classes and interface & they are given?
Concrete class: A class of
only Concrete methods is
called Concrete Class.
For this, object instantiation is possible directly.
A class can extends one class and implements many interfaces.
Abstract class:
|
Interface:
|
*A class of only
Concrete or only Abstract or both.
*Any java class can extend only one abstract class.
*It won’t force
the programmer to implement/override
all its methods.
*It takes less
execution time than interface.
* It allows constructor.
This class can’t be
instantiated directly.
A class must be abstract when it
consist at least one abstract method.
It gives less scope
than an Interface.
It allows both
variable & constants
declaration.
It allows methods
definitions or declarations
whenever we want.
It gives reusability
hence it can’t be declared as
“final”.
|
only abstract methods.
A class can implements any no. of interfaces
(this gives multiple
interface inheritance )
It forces the
programmer to implement all its
methods
Interface takes more
execution time due to its complex
hierarchy.
* It
won’t allow any constructor.
It can’t be instantiated but it can refer to its subclass objects.
It gives more scope
than an abstract class.
By default, methodsàpublic
abstract
variablesàpublic
static final.
It allows methods
declarations whenever we want . But it
involves complexity.
Since they give reusability hence they must not be declared as “final”.
|
10) Can
you create a userdefined immutable class like String?
Yes, by making the class as final and its data
members as private, final.
11) Name some struts supplied tags?
a) struts_html.tld
b) struts_bean.tld
c) struts_logic.tld d) struts_nested.tld
d) struts_template.tld e) struts_tiles.tld.
12) How to retieve the objects from an
ArrayList?
List list=new
ArrayList(); // List<String> list=new
ArrayList<String>();
list.add(“element1”); list.add(“element1”);
list.add(“element2”);
list.add(“element2”);
list.add(“element3”);
list.add(“element3”);
// Iterator<String>
iterator=list.iterator();
for(String str:list)
s.o.p(str); }
Iterator iterator=list.iterator();
while(iterator.hasNext()){
String str=(String)itr.next();
S.o.p(string);
}
}
13) What are versions of your current project
technologies?
Java 5.0; Servlets 2.4, Jsp 2.0;
struts 1.3.4 ; spring 2.0; Hibernate 3.2, Oracle 9i. weblogic 8.5.
14) What is “Quality”?
It is a Measure of excellence.
15) Can I take a class as “private”?
Yes, but it is declare to inner class, not
to outer class.
If we are declaring "private"
to outer class nothing can be
accessed from that outer class to inner
class.
16) How can you clone an object?
A a1=new ();
B a11=a1.clone();
17) What methods are there in Cloneable
interface?
Since
Cloneable is a Marker/Tag interface, no methods present.
When a class
implements this interface that class obtains some special behavior and that
will be
realized by the JVM.
18) What is the struts latest version?
Struts 2.0
19) How are you using “Statement” like
interface methods even without knowing their
implementations classes in JDBC?
20) Which JSP methods can be overridden?
jspInit() & jspDestroy().
21) Explain the JSP life-cycle methods?
1. Page translation: The page is parsed & a Java file containing the
corresponding servlet is
created.
2. Page compilation: The Java file is compiled.
3. Load class: The compiled class is loaded.
4 .Create instance: An instance of the servlet is created.
5. Call jspInit(): This method is called before any other
method to allow initialization.
6. Call _jspService(): This method is called for each request. (can’t be overridden)
7. Call jspDestroy(): The container calls this when it decides take the instance out of service.
2. Page compilation: The Java file is compiled.
3. Load class: The compiled class is loaded.
4 .Create instance: An instance of the servlet is created.
5. Call jspInit(): This method is called before any other
method to allow initialization.
6. Call _jspService(): This method is called for each request. (can’t be overridden)
7. Call jspDestroy(): The container calls this when it decides take the instance out of service.
It is the last method
called n the servlet instance.
3.Date:17-11-2009- Telephonic
22) What
Design Patterns are you using in your project?
i) MVCàseparates
roles using different technologies,
ii) Singleton Java classàTo
satisfy the Servlet Specification, a servlet must be a Single
Instance multiple thread
component.
iii)
Front Controllerà A Servlet developed as FrontController can traps only the requests.
iv) D.T.O/ V.OàData Transfer
Object/Value object is there to send
huge amount of data
from one lalyer to another layer.
It avoids
Network Round trips.
v) IOC/Dependency Injectionà
F/w s/w or container can automatically instantiates the
objects implicitly and
injects the dependent data to
that object.
vi) Factory methodà
It won’t allows object instantiation from out-side of the calss.
vii) View Helperà
It is there to develop a JSP without Java code so that readability,
re-usability will become easy.
23) What is Singleton Java class & its
importance?
A Java class that allows to create only one object per JVM is called
Singleton Java class.
Ex: In Struts f/w, the ActionServlet is a Singleton Java class.
Use: Instead of creating multiple objects
for a Java class having same data, it is recommended
to create only one object &
use it for multiple no. of times.
24) What are the differences b/w perform() &
execute()?
perform() is an deprecated method.
25) What are the drawbacks of Struts? Is it
MVC-I or II? Struts is MVC-II
1)
Struts 1.x components are API
dependent. Because Action &
FormBean classes must
extend from the Struts 1.x APIs pre-defined classes.
2) Since applications are API dependent hence their “Unit testing” becomes complex.
3)
Struts allows only JSP technology
in developing View-layer components.
4)
Struts application Debugging
is quite complex.
5)
Struts gives no built-in AJAX
support. (for asynchronous communication)
Note: In
Struts 1.x, the form that comes on the Browser-Window can be displayed
under no control of F/W s/w & Action class.
26) What are the differences b/w struts, spring
and hibernate?
Struts: allows to develop only webapplications and
it can’t support POJO/POJI model programming.
Spring: is useful in developing all types of Java applications and
support POJO/POJI model
programming.
Hibernate: is used to develop DB
independent persistence logic
It also supports POJO/POJI
model programming.
27) What are differences b/w Servlets & Jsp?
Servlets:
i) It
requires Recompilation and
Reloading when we do modifications in a Servlet.(some servers)
ii) Every Servlet must be configured in
“web.xml”.
iii) It is providing
less amount of implicit objects support.
iv) Since it
consists both HTML & B.logic hence modification in one logic may disturbs
the other
logic.
v) No implicit
Exception Handling support.
vi) Since it
requires strong Java knowledge hence non-java programmers shows no interest.
vii) Keeping HTML
code in Servlets is quite complex.
JSP:
i) No
need of Recompilation & Reloading when we do modifications in a
JSP page.
ii) We need
not to Configure a JSP in a “web.xml”.
iii) It is providing huge amount of Implicit Objects support.
iv) Since Html & Java code are separated
hence no disturbance while changing
logic.
v) It is providing implicit XML Exception
Handling support.
vi) It is easy to learn & implement since it
is tags based.
vii) It allows to develop custom tags.
viii) It gives JSTL support.
(JSP Standard Tag LibraryàIt provides more tags
that will help to develop a JSP
without
using Java code).
ix) It gives all
benefits of Servlets.
28) What is the difference b/w ActionServlet
& Servlet?
ActionServlet: It is a predefined Singleton Java class and it
traps all the requests
coming to
Server. It acts as a Front-Controller in Struts 1.x.
Servlet: a Java class that extends HttpServlet/GenericServlet or implements Servlet
interface and is a Server side
technology to develop dynamic web pages.
It is a Single instance multiple thread component.
It need not be a Singleton Java class.
29) What are Access Specifiers & modifiers?
i) public- à Universal
access specifier.
--can be used along with: class, innerclass, Interface, variable, constructor, method.
ii) protectd à Inherited
access specifier.
--can be used along
with: innerclass, variable, method, constructor.
iii)
default à Package
access specifier(with in the package).
--can be used along with: class, innerclass, interface, variable, constructor, method.
iv)
private à Native access specifier.
-- can be used
along with: innerclass, variable,
constructor, method.
à Some other access modifiers:
i)
static------------innerclass,variable,block,method.
ii) abstract—----- class,method.
iii)
final--------------class,variable,method.
iv) synchronized---block,method.
v) transient---------variable.
vi) native-------------method.
vii) volatile-----------variable
viii) strict
fp-----------variable
30) Which JSP tag
is used to display error validation?
In Source page:
<%@page
errorPage=”error-page-name.jsp”>
In Error page:
<%@page
isErrorPage=”true”>
31) What are the
roles of EJBContainer ?
- An EJB container is the world in which an EJB bean lives.
- The container services requests from the EJB, forwards requests from the client to the EJB, and interacts with the EJB server.
- The container provider must provide transaction support, security and persistence to beans.
- It is also responsible for running the beans and for ensuring that the beans are protected from the outside world.
32)
If double is added to String then what is the result?
Double + String=String
4.CrimsonLogic-Murugeshpalya-kemfort- 18-11-2009
33) What is Ant? What is its use
Ant is a tool that is
used to build war, compilation, deploy.
34) What is log4j?
What is its functionality?
Log4j is a tool used to display logger
messages on a file/console.
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<
appender name="FILE" class="org.apache.log4j.FileAppender">
logger.debug("Hi");
logger.info("Test
Log");
logger.error()
Logger logger =
Logger.getLogger(SampleLogtest.class);
35) What are the
functions of service()?
protected void service(HttpServletRequest req,HttpServletResponse resp)
throws ServletException, java.io.IOException
Receives standard HTTP requests from the publicservice
method and dispatches them to thedo
XXX methods defined in this class. This method is an HTTP-specific version of the
public void service(ServletRequest req, ServletResponse res)
throws ServletException, java.io.IOException
Dispatches client requests to the protected
service
method.
There's no need to override this method.
36) How do we get the container related
information?
By using “ServletContext” object.
37) What is a
Singleton Pattern?
is a design pattern that is used to restrict instantiation of a class to one object.
class Single{
private
static Single s=null;
private
Single(){
------}
public static
Single Factory(){
if(s==null)
return( new Single());
}
}
38) What are the
functions of a Filter Servlet?
It traps all the requests &
responses.
Container
creates the Filter object when the web application is deployed.
39) How to compile a JSP page?
Jasper tool-tomcat;
Jspc tool--weblogic
40) What is Hidden
variable and give its snipplet HTML code?
<input type="hidden" id="age" name="age" value="23" />
<input type="hidden" id="DOB" name="DOB" value="01/01/70" />
<input type="hidden" id="admin" name="admin" value="1" />
41) How do you
forward Servlet1 request to Servlet2?
ServletContext sc=getServletContext();
RequestDispatcher rd =sc.getRequestDispatcher(“/s2url”); //” or html file name”
rd.forward(req,resp);
(or)
rd.include(req,resp);
5. Telephonic
Interview: 23-11-2009.. MindTree
42) differences b/w a Vector & a ArrayList?
ArrayList
|
Vector
|
1. One dimensional data structure
2. New Collections F/w class
3. Non-synchronized
4. Serialized
|
Do
Legacy Collection F/W class
Synchronized
Non-serialized
|
43) try{ ----code for calling a not existed file---}
catch(Exception){--------}
catch(FileNotFoundException){-------}// for catch blocks no order
significance.
Which “catch” block will be executed?
Compile time Error comes.
44) types of Action classes?
Actionàconsists
b.logic or logic that is there to communicate with other Model like EJB,
Spring..
DispatchActionàan
Action class used to group similar action classes having different methods.
The name of the method will be coming in the
request.
45) How do you print
the missed salaries of employees?
User table Salary
table
user_id user_id;
user_name user-salary;
print user-id,user-name,user-sal;
select user-id, user-name, user-sal from User us, Salary sal where us.user-id=sal.user-id.
46) What is “IN”, “OUT”, “INOUT” parameters?
in, out, inout are the modes
of the variables in PL/SQl.
“ in” is input
variable mode.
“out” is
output variable mode.
“inout” is
in-out variable mode.
6. Date: 12-12-2009
Venue: NIIT
technology, Silk Board, Begur Hobli, Hosur Main Road.
Bus:from RRNagar to BanShankari---225c.
Banshankari to SilkBoard—5001c
TECHNICAL ROUND:
time: 1.30 pm to 2.45 pm
47) How can you
achieve Concurrence in Java?
Using Multithreading
48) How to implement Synchronization? Can we use
synchronized with variables?
using the synchronized modifier along with the method or block.
We cant synchronized a variable.
49) What classes are
there in Spring Environment?
Spring config.xml. spring bean class,
spring bean interface.
50) What are the
common files when 5 or more projects are developed using Hibernate ?
Configuration file
51) What are the
differences b/w Struts 1.x & Struts 2.x?
7. Date: 18-12-2009. Time: 12.40 pm to 1.40 pm
Consultancy: ABC
Consultancy
Bus: from majestic to Richmond Circle—335e)
Landmark: Near Cash Pharmacy
Bus: from majestic to Richmond Circle—335e)
Landmark: Near Cash Pharmacy
52) What are oop
principles?
Abstraction, polymorphism, inheritance, encapsulation
53) While overriding a exception throwing method,
does it mandatory that subclass must
also throw the same exception? No
54) In an application, one task has to be done for every 15 minutes. How can
you do it?
55) How do you
sort on one property(field) of a class?
Using Comparable Interface by
overriding compareTo() method.
8. Date:19-12-2009 Company:
HCL
Technologies Ltd
56) If my class is having 5 abstract methods
then can I make it as an interface?
Yes
57) What is Log4j? Can I override the logger
class?
58) Can I display logging messages on the console?
Yes
59) Which cvs tool are you using? What are the
methods that are there?
Commit().
Update()
60) When I don’t want to commit the ResultSet obj
content, what to do?
Con.setAutoCommit(“false”);
61) Can I call a procedure from a HB? How?
Yes
62) Can I use a big query in HB?
63) Difference b/w Checked & Unchecked
Exception?
Checked Exceptions deal compile time
exception regarding the existence of
classes/interfaces
But not syntax
errors.
Ex: ClassNotFoundException---when use a
NULL referenced variable to call any
method/variable.
InterruptedException,---when two or more
threads try to share same Resource(wait() and join())
NoSuchFieldException
---when we access the undeclared variable
NoSuchMethodException---when
we invoke the undeclared method.
InstantiationException---when
we try to create object for a abstract/interface
Unchecked Exceptions
deal runtime errors.
Ex:
ArithmeticException,
ArrayOutOfBoundsException,
NullPointerException
64) Differenc b/w Exception & Error?
Date: 08-01-2010. Magna consultancy.
65) What is polymorphism?
Poymorphism is the capability of an action/method to do
different things
based on an object that it is acting upon. One form, many implementations.
66) What is
overloading and overriding? Give one example?
Overloading
is the process of re-defining a method for multiple times
with different Signature.
Overriding is a process of re-defining
a super class original version
in its various derived classes through
inheritance.
67) What is encapsulation & abstraction?
Encapsulation is, a technique, used to encapsulate
the properties & behaviors of
an object.
It focuses on inside-view and solves
problems at “implementation side”.
Abstraction
refers to the act of representing
essential features
without including
the background details
68) What is final
?
class, method, variable.
69) How can you
invoke a current class constructor from a method ?
Using “this”.
70) How can you
invoke a super class constructor from derived class?
Using “super()”
71) What is
“static”?
method,
variable, block, static nested class
72) What is
“instanceOf”?
The operator that checks whether given
instance is belongs to the given class or not.
73) There are
class A & class B. How can I get the members of class A & B?
74) Can I create
an interface without methods, constants declarations?
Yes
75) Can I place
try & catch blocks in finally block?
Yes
76) What are the
clone types?
77) How can you
make an ArrayList as Synchronized list?
List lobj=Collections.synchronizedArrayList(new
ArrayLsit());
Map m=Collections.synchronizedMap(new HashMap());
78) What is
Serialization?
Writing the state of an object in to Streams.
79) How can you
made the fields of a class to not serialized?
Using
the modifier called “transient”
80) What is the
use with Generics?
It avoids explicit type casting.
81) What is
“Reflection”?
It allows to do Mirror image operations
on classes/interfaces to get the internal details.
82) How do you
maintain versions in your project?
Using SVN.
83) What is Junit?
A tool for unit testing.
84) What is
logging messages?
SQL
85) What is the
difference b/w “order by” and “group by”?
“order by”à
used to arrange the data either in ascending or descending order.
“group by”à
allows aggregation operations on a column .(having condition also).
86) What are the
relations?
One
to one
One to many
Many to one
Many to many.
87) What are the
joins?
Cursors,
views, stored procedures….
Hibernate
88) Tell me few Hibernate interfaces?
i) Configuration(c),
ii) SessionFactory,
iii)
Session,
iv) Transaction,
v) Query
89) How do you
create “Criteria”?(to do select operations.)
Criteria criteria=session.createCriteria(EmpBean.class);
// select * from Employee where eid between 100 and 200 and firstname in (“raja”,”ramana”));
Condition: 1
criteria=criteria.add(Expression.between(“no”,new Integer(100)),new
Integer(200));
Condition:
2
criteria=criteria.add(Expression.in(“fname”,new
String []{“raja”,”ramana”} )));
List l=ct.list(); // retrieves more selected records
for(int
x=0;x<l.size();x++){
EmpBean
emp=(EmpBean) l.get(x);
S.o.p(emp.getNo()+”\t”+emp.getFname()+”\t”+emp.getLname()+”\t”+emp.getEmail());
90) What is Hibernate configuration file?
HB dialect, DB Driver class, Driver class URL, Username, Password.
91) Why the
people using frameworks?
92) What is POJO
& POJI model programming?
The programming with no api dependent
classes/interfaces
93) What is
“Catching “ mechanism?
To minimize n/w round trips.
“Session” is default and
“SessionFactory’ explicitly
configured.
94) Do you know
“restriction” and “expression”?
Expression.between()
Expression.in()
95) Do you know algorithms
like increment , sequence, hilo….?
96) What are the
different Scopes in JSP?
request, page, session, application
97) How to
disable “Cache” ?
<% resp.setHeader(“cache-control”, ”no-cache”);%>
(<meta
http-equiv=”cache-control” content=”no-cache”>
<%resp.setHeader(“pragma”,”no-cache”);%>
//http1.0
OR
<meta
http-equiv=”pragma” content=”no-cache”>)
98) What is
default Scope in JSP?
page
99) How to
configure a JavaBean in JSP?
<jsp:useBean>
100) Do you know
UML?
101) Which tools
do you used in design documents?
102) What is XML parser, SAX, DOM parsers?
103) Design diagrams?
104) How to configure LOG4J?
105) What are the “validator” files?
In Struts, validations will be done using validator
framework.
Validation.xml – validation will be
configured.
validator-rules.xml---validation
rulues will be configured.
106) What is “useBean”?
JSP standard tag to configure a Java Bean in
JSP.
107) Differences
b/w Statement and PreparedStatement apart from performance issue?
Q: What are Statements types?
1) Statement: It is used
to execute a “query” only for one time in the entire application execution.
2) PreparedStatement: It is
used to execute same “query” for multiple no. of times with the
same/different values. It
works with compiled query &
allows place holders.
3) CallableStatement: It is
used to execute PL/SQL Procedures/functions from the Java appl.
108) How do you
configured Spring DAO?
In contextApplication.xml
109) How to
configure “counter” to know no. of users
visited the website?
110) How to invoke
stored procedures from a Java application?
Using CallableStatement
& prepareStatement();
Date: 23-01-2010. Saturday. CSC India pvt ltd. Domlur
Flyover.(333 from majestic)
111)How Java is Platform
Independent?
.class file—byte code
112) What is Association and Composition?
113) How can I
achieve multiple inheritance in Java without using inheritance?
By using Interfaces.
114) Write the
code for a class which implements the Runnable interface?
Public class RunClass implement Runnable{
-------------
-------------
public void run(){
---------
}
Runnable r=new RunClass();
Thread thr=new Thread(r);
thr.start();
115)
There are m1(), m2() methods and t1,t2 threads.
How can t1 execute m1() and t2 executes
m2()?
MyThread t=new MyThread();
MyThread t1=new MyThread();
t.method1();
t1.method2();
116) What is
“join()”?
When
a current thread wants to finish its complete execution and allow the second
thread to do
its execution then first thread must
invoke this join();
116) How do you
make the variables applicable to the whole application in JSP?
To write the variables, instance methods,
static variables, static methods in jsp declarations.
<%!
Int a;
Public void method(){}
%>
117) How do you
configure “one to many” association in Hibernate?
<set> and <key> and
<one-to-many>
<set name="address">
// child (address table)
<key
column="emp_id"/> //primary key of address table
<one-to-many class="EmpAddress"/>
//pojo class
</set>
118) What are
types of Beans in EJB?
Session Bean---Stateless, Statefull
Entity Bean
MessageDriven Bean
119) Explain the
life cycle of EJB?
120) Draw a class
diagram for a class?
Class: SampleDemo
|
Variables: int a,
b,c;
|
Methods: sum(),
substract().
|
Societe Generale: 30-01-2010---Old Madras Road,Benniganhalli
----305 from majestic---
1.00 hour
121) class
A{ class B extends A{ class
D{
i=10; i=20 ;
p s v m(){
printText(){ printText(){
A a=new B();
s.o.p(“from
A”); s.o.p(“from B”);
}
a.printText(); // from B
} s.o.p( +a.i); } // i=10
122) What is
InterruptedException?
When two or more threads try to access same
object simultaneously, then this exception
occurs. Join(), wait(), notify() ,notifyAll() throws
InterruptedException.
123) What Design
patterns do you know?
MVC, Singleton class, Factory , FrontController,
DAO class, D.T.O/V.O
124) What an
Interface allows in its inside?
Abstract methods, constants, interface.
125) Can I define
a class inside an Interface?
Yes
126) What is HB?
What are its files.
It is an ORM tool that is there to develop DB
independent persistence logic.
Hibernate-config.xml, Hibernate-mapping.xml, pojo class
127) How to
integrate HB with Spring?
The DAO implementation class of spring
must extends HibernateDAOSupport and
implements DAO interface.
128) How to
integrate Struts with Spring?
ContextLoaderServlet and
applicationContext.xml configured in struts-config.xml that
is there in web.xml
129) What are the
differences b/w BeanFactory and ApplicationContext?
BeanFactory
(I) container
|
ApplicationContext (I)
|
to develop spring
core applications.
|
It is an advanced
& extended for BeanFactory.
It gives full
fledged spring features support like;
i) Bean
property values can be collected from
“outside properties file”.
ii) gives support
for Pre-Initialization of Beans.
iii) text messages can be collected from
outside
property files to give support for i18n.
iv) allows to work with EventHandling
through Listeners.
|
Pre-initialization: creating Bean class objects & performing
Dependency Injection on
Bean properties at the time of container
activation.
130) What is the interface implemented by HashMap
and Hashtable?
Map (i)
131) Can you
unit test a “private method”?
132) What are
ServletListeners?
Source obj
|
Event
|
Listener
|
EventHandling methods (public void
|
ServletRequest
ServletContext
HttpSession
|
ServletRequestEvent(sre)
ServletContextEvent(sce)
HttpSessionEvent (hse)
|
ServletRequestListener
ServletContextListener
HttpSessionListener
|
requestInitialized(sre)
requestDestroyed(sre)
contextInitialized(sce)
contextDestroyed(sce)
sessionCreated(hse)
sessionDestroyed(hse)
|
From Servlet
2.4 onwards, EventHandling is
allowed on special objects of
webapplication
like
ServletContext, ServletRequest, HttpSession objects.
ServletRequest:
By doing EventHandling on ServletRequest
object, we can keep track of
each
“request” object creation time & destruction time. Based
on this, we can
find out “request
processing time”.
HttpSession:
By performing EventHandling
on HttpSession object, we can find out
“session” object creation time &
destruction time. Based on this, we can
know the time taken by the each
user to work with “session”.
Procedure to configure Listeners with
webapplication
1) Develop a Java class implementing
appropriate “Listener”
& place it in WEB-INF/classes
folder.
2) Configure that Listener class name in web.xml
by using <listener-class>
Dell Perot
Systems-----iGATE,WhiteField,Industrial Area
133) What is a Session?
Session: It is a set of related
& continuous requests given by a
client to a web application.
Ex: SignIn to SignOut in any Mail Systems Application like Gmail, Ymail etc…
134) How do
you maintain client data at client side?
Cookies
135) What are
the methods with Serializable interface?
No methods
are there in Serializable Interface as a Marker/Tagged Interface.
Ex: Serializable, Cloneable, Remote,
SingleThreadModel
136) What are
the sorting methods are there in Java?
compareTo() and compare()
137) Write the
code for them?
If(Object1.compareTo(object2))
138) What are the
Http request methods?
GET,POST
139) Difference
b/w GET and POST methods?
GET
|
POST
|
1) It is a default Http
request method
2) Query string is
visible in Browser
address bar
hence no data Secrecy.
3) It allows to send limited
amount of
data(1kb)
4) It is not suitable for File uploading.
5) It is not suitable for sending Enscripted
data.
6) It shows Idempotent behaviour.
7) Use either doGet(-,-)
or service(-,-)
to process this.
|
Not a default
method.
It gives data
Secrecy.
Unlimited amount
of data.
Suitable for
File uploading.
Suitable.
Non-Idempotent.
Use either
doPost(-,-) or service(-,-)
|
140) What is
Idempotent behavior?
It is the behavior
like processing the multiple same
requests from the same web page.
141) How the POST
is not having Idempotent behavoiur?
142) How the JSP
code is converting into Servlet code?
JSP parser/Engine/compiler
143) What is
Servlet life-cycle?
1.
If an instance of the servlet does not exist, the Web
container
3. If the container needs to
remove the servlet, it finalizes the servlet by calling
the servlet's
destroy
method.
144) Can I
Implement Serializable when I don’t want to save the object in persistence
stores?
If
NetWork is there then YES else NO.
145) What is “reflection api”?
import java.lang.reflection;
Reflection API based applications:
are capable of gathering “internal details about a Java class/
interface
by performing Mirror Image Operations on that class/interface.
146) What are the SessionTracking Techniques?
Session Tracking: It is a technique by which the client data can be remembered across
the multiple requests given
by a client during a Session.
1)
Hidden Form Fields
2)
Http Cookies
3)
HttpSession with Cookies
4)
HttpSession with URL-rewriting.(best)
147)
How to handle multiple submit buttons in a HTML form?
<input type=”submit” name=”s1” value=”add”>
</th>
<input
type=”submit” name=”s1” value=”delete”>
</th>
<input
type=”submit” name=”s1” value=”modify”>
</th>
Code for accessing the above data in
Servlet.
String cap=request.getParameter(“s1”);
if(cap.equals(“add”)) {
---------- }
elseif(cap.equals(“delete”)) {
------------- }
else(cap.equals(“modify”)) {
------------ }
HoneyWell---from Banshankari 500L, Intel
Stop, Dhevarabesinahalli---2.00pm—15 mints
1) What you write to open a window?
Window.open(); in Javascript
<a href="javascript:;" onClick="mm_openbrwindow('Mypage.html','','width=800, height=600, scrollbars=no')">MyPage</a>
newwindow=window.open(url,'name','height=500,width=400,left=100,
top=100,resizable=yes,scrollbars=yes,toolbar=yes,status=yes');
148) Do you
know CSS? What can I do with
CSS?
CSS
is a style language that defines layout of HTML documents. For example, CSS
covers fonts, colours, margins, lines, height, width, background images,
advanced positions and many other things
149)What is the difference between CSS and
HTML?
HTML is used to structure content. CSS is used for formatting structured
content.
150) What
are the uses with Hibernate?
i) It allows to develop DB independent
query language like HQL.
ii) It supports POJO/POJI model programming.
iii) Any Java/J2EE can access HB persistence logic.
iv) It
supports to call all Procedures & Functions of PL/SQL
programming.
v) The result
after “SELECT” operation, by default, is “Serializable”.
151)
What are the differences b/w Servlet and JSP?
For every time
we modifing the servlet , we should re-deploy the servlet.
Its very big headache.
Manually written servlets are somewhat faster than JSPs.
JSP:
i) No need of Recompilation & Reloading
when we do modifications in a JSP page.
ii) We need not to Configure a JSP in a “web.xml”.
iii) It is providing huge amount of Implicit Objects support.
iv) Since Html & Java code are separated
hence no disturbance while changing
logic.
v) It is providing implicit XML Exception Handling support.
152) How to connect with DB?
Class.forName(“oracle.jdbc.driver.OracleDriver”);
Connection con=DriverManager.getConnection(“jdbc:oracle:thin:@localhost:1506”,
”logicalDBname”,”username”,”password”);
Statement st=con.createStatement();
// ResultSet rs=st.execute(“select
query”); (or)
// int x=st.executeUpdate(“Non-select query”);
153) Code for DataSource?
Context ct=new InitialContext();
Object
obj=ct.lookUp(“ JNDI name of dataSource reference”);
DataSource
ds=(DataSource)obj;
Connecton
con=ds.getConnection();
Statement
st=con.createStatement();
--------------------
con.close();
154)
What is the return type of “executeUpdate()” ?
It is used to execute “Non-Select
queries” and
whose return
type is “int”.
155) What is “OUTER join”?
It gives both
matching and non-matching rows.
INNER JOIN:it gives only matching
values.(equal and non-equal).
156) What is an Application Server?
i) It allows to deploy all types of Java applications like web,
distributed,enterpraise
applications.
ii) It contains
both web and ejb containers.
iii) It gives
more implicit middleware support
like Tx management, Security, Connection
pooling..
Adea Technologies
Pvt Ltd, BommanaHalli; Hosur Road; majestic---356;06-02-2010
157) How to know the no. of dynamically generated
objects of a class?
Take a Static
count variable, pass this to a” Parameterized
Constructor” and keep the
increment
operation inside it.
158) Can you write the flow for ATM ?
start
|
Enter PIN
|
Valid PIN
|
||||
Not Valid
|
||||
Check Bal
|
||||
available Bal
|
Not available
|
Withdraw
process
|
stop
|
159) What
is Synchronization?
The process of allowing only one thread
among n no. of threads into a Sharable Resource
to perform “Read”
& “Write” operations.
160) What are the primitives?
byte, int, short, long, float,
double, char, booleanàlocal variables.
161) What happens when we store primitives to
Collections?
162) What are the Wrapper class objects?
The primitives are not allowed to
store inside the collections. So, they will be converted into
Wrapper class
objects using their respective wrapper classes.
163) What is the difference between “Apache
Server” & “Tomcat Server”?
Apache/ Apache
HTTP Server, is an established standard in the online distribution of
website services, which gave the initial boost for the expansion of the W.W.W.
. It is an open-source web server platform, which
guarantees the online availability of the majority of the websites active
today.
The server is
aimed at serving a great deal of widely popular modern web platforms/operating
systems such as Unix, Windows, Linux, Solaris, Novell NetWare, FreeBSD, Mac OS
X, Microsoft Windows, OS/2, etc.
164) What is an ApplicationServer?
165) Why do we require Application Server
instead of Web Server?
166) An application is having “images”. Which Server
is preferable?
167) What is Autoboxing?
Autoboxing
is an implicit automatic conversion from Primitives to Wrapper class
objects.
Ex: float p_float=0.5f;------à
Float 0_float=new Float(p_float); will done implicitely.
Unboxing
is an implicit automatic conversion from Wrapper class objects to
Primitives.
Ex: Float o_float=0.2f;----à float p_float=o_float;
Tech Mahendra,
opposite to Christ University, Hosur main Road.06-02-2010
168)What are new
features of jdk1.5?
Generics, Enhanced For loop,
Autoboxing/Unboxing, Static import, Annotations.
169) Write the code for “Enhanced for loop”?
int[] integers={1,2,3,4,5};
for(int item:integers){
S.o.p(item);
}
170) What is an Annotation in JDK1.5?
Sun has
recently released Annotation Processing
Tool (apt) along with beta2 of
JDK1.5.
This tool
greatly helps in using the annotations feature that is introduced in JDK1.5
Annotations can be at package level, class level, field level,
method level and even at
local variable level.
171) I have a HashMap. I want to get the keys
& values in a set. Can you write the code?
HashMap<Integer,String> hm=new
HashMap<String,String>();
hm.put(1,”ram”);
hm.put(2,”sri”);
Set
s=hm.keySet();
for(Integer keys:s){
for(String values:hm.get(s)){
S.o.p(values+”
”+keys);
}
172) Which algorithm is used by JVM while running
Garbage Collection?
Mark-in-sweep.
173) Can an
application has multiple Struts-config.xml?
Yes…one for each module
174)Where do you configure Struts-config.xml in
an application?
Web.xml
175) How do you Unit test in Spring environment?
176) How do you disable all the JavaScripts of
pages in an application?
177) Why there are Directive and Action tags in
JSP?
Directive tags: perform Global operations on a page like
i) importing packages,
ii) working with tag-library
iii) including other JSPs content and etc.,.
ex:
page, include, taglib
Action tags:
are there to perform actions during
request-processing/execution phase of JSP.
Ex: include, forward,useBean, setProperty,
getProperty, param, plugin.
178) What does Tomcat Support?
War file
179) What is dialect?
Using dialect, Hibernate knows the
type of DB & its version to which it will connected.
180) How do you map HB Pojo class with Table?
<hibernate-mapping
default-cascade="none" default-access="property" default-lazy="true"
auto-import="true">
<class
name="CustomerOrder" table="CustomerOrder" mutable="true" polymorphism="implicit" dynamic-update="false" dynamic-insert="false" select-before-update="false" optimistic-lock="version">
<composite-id name="orderId" class="OrderId" mapped="false" unsaved-value="undefined">
<key-property
name="customerId" column="customer_id" />
<key-property name="orderTime" column="order_time" />
</composite-id>
<property
name="orderDescription" unique="false" optimistic-lock="true" lazy="false" generated="never" />
</class>
</hibernate-mapping>
181) In HashMap, how can I locate a particular
key?
Hm.containsKey(“3”);
Hm.containsValue(“key”);
182) Difference b/w SVN(Sub VersioN) & VSS
(Visual Source Safe--microsoft)?
Usually team members do all of their work separately, in
their own working copies and need to share their work. This is done via a Subversion repository. Syncro SVN Client supports the versions
1.3, 1.4, 1.5 and 1.6 of the SVN repository format
- Expansion. The number of programmers doubled and we didn't want to fork out for the extra VSS licenses
- Bugs. VSS is good at maintaining the latest version of a file, but histories often got corrupted.
- More bugs. The checking/recovery tools were useless as they started crashing when the database got very large.
183) What is Servlet Chaining?
Servlet
Chaining is a method of processing the request using
multiple servlets as a chain.
184) What is the use of DyanaActionForm?
It allows Declarative data population that avoids
recompilation.
185) prototype of
execute(-,-,-,-)?
public ActionForward
execute(ActionMapping am,
ActionForm af,
HttpServletRequest req,
HttpServletResponse resp)
186) Difference b/w ActionForm, DynaActionForm and
DynaValidatorForm?
All
three are JavaBean Classes that can maintain
the session state for web application.
The
ActionForm object is automatically
populated on the server side with data
entered
from a form on the client side.
An
ActionForm/DynaValidateForm can have
getter(),Setter(), reset() and the
validate() methods that can be defined in our ActionForm or in Action class
itself.
* If any changes are made to the properties,
code need to be recompiled.
Here
comes the DynaActionForm to rescue. It allows properites to be specified in
Struts-cofig.xml file there by avoiding the recompilation of the code.
Also
there is no need to have a Form Bean for every page that had getter and
setter
method for each of the field on the page.
This
is how it can be declared in struts
config file:
<form-beans>
<form-bean
name="employeeForm"
type="org.apache.struts.action.DynaActionForm">
<form-property
name="fname" type="java.lang.String"/>
</form-bean>
</form-beans>
187) How the DispatchAction knows, when it is pointed by multiple JSPs,
which jsp request execute which DispatchAction method to process the
request by
executing the B.logic?
JSP sends the “method name” along with the request
as
additional
request parameter to DispatchAction.
function=insert, update, delete.(methods
in OurAction)
Take
a “parameter” attribute that
represents all the methods of DispathAction
class that
configured
in Stuts-Config.xml using <action-mappings>.
Take
the different JSP forms where property=”parameter
value” and value=”method-name”
under the hidden tag.(<input name=””
type=”” value=” ”>)
<action-mappings>
<action path=”/controller1”
name=bean
type=”OurAction” //name of the
DispathAction
parameter=function scope=”request”/>
Add.jsp: <html: hidden property=”function”
value=”insert”>
Modify.jsp:
<html: hidden property=”function”
value=”update”>
Delete.jsp: <html: hidden property=”function”
value=”delete”>
188) Types of Action classes in Struts?(8)
Actionà to execute B.logic by keeping in execute() or to
place request processing logic.
ForwardActionà
It is there to forward/transfer
the control from one web resource to
another
through
the controller.(i.e.,according to
MVC principle, any two JSPs
should not
communicate directly. Use ForwardAction that will configured in
Struts-config.xml)
IncludeActionà
It is there to include response of
JSP to another through controller.
DispatchActionà
It groups the related Action
classes into single “Action” class and allows
multiple user defined methods as execute() to differentiate the B.logic.
(so that
multiple JSPs giving request to single DispatchAction, can be linked
with
different methods available.)
MappingDispatchActionà
LookupActionà
SwitchActionà
LocaleActionà
189) ACID Operations
Atomicity:
The process of combining
invisible & individual operations
into a single unit.
Consistency:
It is a process where the
rules applied on DB may be violated during Tx
but no
rule is violated at the end of a
Tx.
Ex: Account table—balance field –no negative bal
Isolation:
The
process of applying locks on a DB table at various levels to avoid data corruption
when multiple users are allowed
concurrently/simultaneously.
Durability:
The
process of bringing the DB s/w original state using the log & back up files
when it was crashed/corrupted.
Keane India Ltd,
Basavanagudi, South End Circle.
Banshankari---
190) What is Expression tag in JSP?
It is used to
i)
evaluate a Java expression & sends that result to Browser-window. <%=a+b;%>
ii)
display the variable values on the
Browser-window. <% int a=10;%> <% =a %>
iii)
call both pre-defined & user-defined methods.
<%=sum(10,20)%> , <%=”raja”.length()%>
iv)
instantiates java classes & to display
the default data of the object.
date and time is:<%=new java.util.Date();%>
192) What
is “isThreadSafe=true” in JSP?
It
makes the equivalent servlet as thread safe.
The “JSP
equivalent Servlet” will implement SingleTreadModel(I) implicitely.
193) Why there is Object class?
To provides the default, common
implemented code for every java class/interface.
Methods available in Object class are:
int hashCode(),
boolean equals(Object
obj),
void finalize()
throws Throwable,
String toString(),
Object clone()
throws CloneNotSupportedException,
final Class getClass()
final void wait()throws
InterruptedException
final void notify()throws
InterruptedException
final void notifyAll()throws
InterruptedException
194) Why hashcode(),equals()…are there in Object
class?
195) What is Self Join? A table joins with
itself.
196) sum(): select sum(salarycolumn)
from tablename group by
salarycolumn;--groups the same
salaries into different groups.
select sum(salarycolumn) from tablename;-à gives total sum of salary column
197) What is Setter and Constructor injection?
à Setter Injection:
It is a process of injecting/assigning
the dependent values to the Bean properties
by the spring container using Bean class setXXX(-) methods.
Note: In Spring
Config.xml:
<property
name=”age ”>
<value>
20</value>
</property>
à
Constructor Injection:
It is a
process of assigning/injecting the dependent values to the Bean properties
by the spring
container using “parameterized
Constructors”.
Note: In
Spring config.xml:
<constructor-arg>
<value>ramu</value>
</constructor-arg>
198) Can we use Setter Injection when we use
private Constructor?
No
199) What is the problem with Autoboxing ?
200) Serializable code?
FileOutputStream fos=new FileOutputStream(“file name”); ---file opened
ObjectOutputStream oos=new Object OutputStream(fos); --Object takes file ref
UserDefSerCls uds=new UserDefSerCls(,” ”,);
Oos.writeObject(uds);
Oos.close();
201) What is “inverse=true” in hbm file?
The Association is
bi-directional.
202) What is an Nested class?
The class defined in another class.
Nested class Types:
i)
static nested class
ii) non-static nested class (inner class)
Nested
class Use :
i) They
can lead to more readable & maintainable code.
ii) It
increases encapsulation.
iii) It is a
way of logically grouping classes that
are only used in one place.
Inner-class object
creation:
OuterClass.InnerClass
innerObject=outerObject.new InnerClass().
Anonymous Class: a name-less local class .
When to use:
i) when a class
has a short body.
ii) only one
instance of the class is needed.
203) How to establish many to many association?
Declare one
column as primary key in the Parent table.
Declare one column as primary key in the child table.
Take
another table where above two primary
keys will be declared as foreign
keys.
204) Can I develop a spring application without
hbm file.
Yes, by using “Annotation”
205) Can I develop a spring application without
spring config.xml?
Yes, by using Properties file.
206) What is distributed transaction?
The transaction where two databases are used for a project.
207) Differences b/w procedure & function?
Procedure
|
Function
|
1) may or may not
return value.
2) may returns one
or many
values(max.1024)
3) result is
gathered only through OUT
parameters.
|
must returns a value.
Must return exactly
one value
through OUT parameters & return value.
|
208) Difference b/w Primary and Unique key?
Primary key:
Only one Primary key constraint can be applied
to a table.
Primary key
column won’t allow duplicates.
Primary key column won’t allow NULL.
Unique key: one
or many Unique key constraint can be applied to one table.
It allows duplicates.
It allows NULL.
209) Is the Servlet thread-Safe by default?
No,
the servlet by default is not
Thread safe. To achieve this, the servlet must implements
SingleThreadModel interface OR
synchronize the service().
210) Explain Joins?
Purpose : to bind data together, across tables, without repeating all of the
data in every table.
JOIN: Return rows
when there is at least one match in both tables
LEFT OUTER JOIN: Return all rows from the left table, even if
there are no matches in the right table
RIGHT OUTER JOIN: Return all rows from the
right table, even if there are no matches in the left table
FULL OUTER JOIN: Return rows when there is a match in one of
the tables
SELF JOIN :
EQUI/INNER JOIN:
211) How do
you maintain bug tracking in your project?
Using JIIRA tool.
212) What tool
are you using to write hundreds of fields for your project?
213) What
code styles are you following in IDE?
214) Procedure
to work with PreparedStatement in a Java application.
1). Prepare a query having “positional/place”
holders/”in parameters”.ie.(?,?,?)
2).
Send the query to DB s/w, make
the query as “pre-compiled query” & represent
it through “PreparedStatement”.
3).
Set the values for place-holders using “setXXX(-,-)”.
4).
Execute the query.
5). To
execute the same query for multiple no. of times with same/different values,
repeat steps 3 & 4 for multiple
times.
6).
Close PreparedStatement object.
à
Pre-compiled query: a query that
goes to DB & becomes
compiled-query
without values, and also resides on DB.
It reduces “Network traffic” b/w
Java appl & DB s/w.
215) How to display data from
the table in HB?
SessionFactory
sf = new Configuration().configure().buildSessionFactory();
Session
session = sf.openSession();
Transaction
t = session.beginTransaction();
Student st = new Student(); //pojo
//Displaying data from Student table using HQL
Query qry = session.createQuery("from Student");
List lst = qry.list();
// data saves into List with no
restrictions
//Restrcting data based on age
condition
Criteria ct = session.createCriteria(Student.class);
ct.add(Restrictions.ge("studentAge",
20));
List lt =
ct.list();
Iterator<Student> itr =
lt.iterator(); // displays all records
System.out.println("Student no: \t Name : \t Age");
while
(itr.hasNext()) {
Student student =
itr.next();
System.out.println(student.getStudentId()+"\t"+
student.getStudentName()+"\t"+student.getStudentAge());
}
216) How to insert one record into a Table (single row insertion)
student.setStudentName("sridhar");
student.setStudentAge(28);
session.save(student);
217) How to update existing a table record?
student.setStudentId(5); //primary
key val
student.setStudentName("sridhar");
student.setStudentAge(28);
session.saveOrUpdate(st);
218) How to delete a table record from HB session
obj?
session.load(student, new Integer(1)); // load(Student.class, primarykey)
session.delete(student);
219) What are the Escape characters in JSP?
220) How many ways are there to invoke a Servlet
object.
221) What is the difference b/w Filter and
Servlet?
222) What is syntax for doFilter()?
Public void
doFilter(servletRequest request,ServletResponse response,FilterChain fc){
doFilter.chain();
}
223) How to convert list into HashMap?
Converting List to Set :List
l=new ArrayList();
Set
s=new HashSet(l);
224) Give me one example for Detached state of an
object in HB?
225) What is Collection use?
They allow to store heterogeneous
objects.
226) What is the implementation class of SessionFactory?
LocalSessionFactoryBean
227) How do you configure one to many and many to
many for an single Hb application?
226) What is Bi-directional and Uni-directional
in HB?
inverse=”true”-àmeans
bi-directional association.
Inverse=”false”àmeans uni -directional assoiciation
227) What is custom Servlet?
The servlet that extending
pre-defined Servlet (ie HttpServlet/GenericServlet/Servlet)
228) How do you get key when value is available
from HashMap?
HashMap<Integer,String> hm=new
HashMap<Integer,String>();
hm.put(1,”ram”);
hm.put(2,”sri”);
hm.put(3,”mano”);
Set<Entry<Integer,String>>
set=hm.entrySet();
for(Map.Entry<Integer,String>
me:set){
if(me.getValue()==”ram”)
s.o.p(“the key value is:”+key):}
OR
Set
s=hm.entrySet();
Iterator itr=s.iterator();
while(itr.hasNext()){
Object mobj=itr.next();
Map.Entry me=(Map.Entry)mobj;
if(me.getValue()=="anu")
System.out.println("key
is:"+me.getKey() );}
229) How to do Pagination?
230) Write the code for displaying the data from
DB in Struts?
231) Signature of “validate()”?
Public ActionErrors validator(ActionMapping
am, HttpServletRequest req)
234) Write the code for CallableStatement?
No comments:
Post a Comment