sitaram


{ City }
< Country > india
* Profession *
User No # 72474
Total Questions Posted # 0
Total Answers Posted # 58

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 281
Users Marked my Answers as Wrong # 95
Answers / { sitaram }

Question { HCL, 34554 }

Advantages of Inheritance in java.


Answer

Inheritance: The base class properties into subclass class
is called inheritance.
Inheritance example:Father and child relation. Father
having 10 lakhs property. That property is always avilable
to child. Father is a parent class. child is a subclass.
Advantage: 1.subclasss take the all properties from parent
class.
2.suppose you can add any property in parent class. That
will be effected to subclasses also.

Is This Answer Correct ?    22 Yes 2 No

Question { CTS, 12063 }

What is the difference between RequestDispatcher and
sendRedirect?-


Answer

RequestDispatcher: Serverside redirect with same request
and response objects.
SendRedirect: Client-side redirect with new request and
response objects.

Is This Answer Correct ?    10 Yes 1 No


Question { Mind Tree, 9521 }

how to handle a singleton service locator. when multiple threads
are trying to get the singleton object in same time


Answer

Singleton service means only one service provide at a
time.When multiple threads are trying to get the singleton
object in the same time.we can get an error. because only
one object provide in complete application.

Is This Answer Correct ?    17 Yes 3 No

Question { Wipro, 14156 }

Can we define constructors in Servlet?


Answer

Each every class execute in java. One default constructor or
define constructor must be calling. If you are not any
constructor write in your class. when execute the program ,
JVM automatically create the default constructor.

Is This Answer Correct ?    3 Yes 5 No

Question { Accenture, 19103 }

Can we define constructor in Servlet class?


Answer

in java, we can access any class, first JVM search the any
type(with or with out parameters) constructor. if it their
the same constructor will be calling other wise JVM create
the default constructor for that class.

Is This Answer Correct ?    9 Yes 1 No

Question { Accenture, 8394 }

How exception handling is provided in struts?


Answer

to handle the errors:

in struts project to handle the error objet by using
ActionError object and to handle the errors by using
ActionErrors object.

for suppose

ActionError ae1=new ActionError("err.one");

ActionError ae2=new ActionError("err.two");

Action Errors aes=new ActionErrors();

aes.add(ae1);

aes.add(ae2);

saveErrors(request,aes);//store the errors object in request
object

to handle exception:

1)using try and cach blocks

2)using declarative exception handling technique

to handle the exceptions by using global exceptons tag in
struts-config.xml



type="java.lang.ClassNotFoundException" path="/gen.jsp"/>

whenever that exception will be came it executes the
gen.jsp page.

Is This Answer Correct ?    12 Yes 0 No

Question { IBM, 9468 }

what is the difference between object and class


Answer

Object is a instance of a class.
Class is a template for an object.

Example: suppose we are going to hotel.first we will check
the menu. Menu is a class. we can select the one item from
menu. item is a method or variable. how to select the item.
we can create the object of menu. That is instance of
menu(Object).

Is This Answer Correct ?    4 Yes 3 No

Question { 6205 }

Is it possible to create object with out its default
constructor? if possible how? else not possible? justify


Answer

we can write the without constructor in the class. when
ever class will be loaded, JVM will be creating defalt
constructor for that class.

Is This Answer Correct ?    4 Yes 4 No

Question { 6205 }

Is it possible to create object with out its default
constructor? if possible how? else not possible? justify


Answer

with out default constructor we can't create the object.
suppose we can't write default constructor in the class.
JVM will be creating the default constructor for that class.

Is This Answer Correct ?    9 Yes 1 No

Question { 4337 }

when System.out.println("") is executed what happens in the
back ground?


Answer

When ever System.out.println("") executing JVM doing like
that System is a class, out is object of PrintStream class,
println() is a method in PrintStream class.

Is This Answer Correct ?    11 Yes 0 No

Question { Wipro, 8115 }

Explain the following statement: Java is always pass-by-value.


Answer

The changes made in formal parameters will not reflect to
the actual parameters is called call-by-value. java is
supports to pass-by-value.

Is This Answer Correct ?    1 Yes 0 No

Question { i3 Solutions, 4382 }

what is platform native code


Answer

The Java platform encourages developers to write C code when
truly peak performance is required. we can write the code in
C Language. That code is using as a native code in java.

Is This Answer Correct ?    0 Yes 0 No

Question { HP, 7547 }

What is the difference between the synchronized() & static
synchronized()?


Answer

synchronizing is the process of ensuring the share resources
will be accessing only one thread at a time. There are two
types of synchronizations.
1. static synchronized(Class level)
2.synchronized.(Object Level).

Is This Answer Correct ?    12 Yes 1 No

Question { Wipro, 8215 }

suppose we have an interface & that interface contains five
methods. if a class implements that interface then we have
to bound that to give tha definition of all five methods in
that class. If we declare that class as abstract then can
we call only two methods to give the deinition of that
method & i don't want to give the definition of all the
methods? can it possible


Answer

yes it is possible, just make rest of the method abstract
explicitly.


public interface InterfaceSample {
public void method1();
public void method2();
public void method3();
public void method4();
}

abstract class Abstclass implements InterfaceSample{
public abstract void method1();
public abstract void method2();
public void method3(){
System.out.println(" astract method3 ..............");
}
}
public class Sample extends Abstclass {
public void method1(){
System.out.println("method1 ..............");
}
public void method2(){
System.out.println("method2 ..............");
}
public void method4(){
System.out.println("method4 ..............");
}

public static void main(String[] args) {
Sample s1 = new Sample();
s1.method1();
s1.method2();
s1.method3();
s1.method4();
}

}

Is This Answer Correct ?    0 Yes 2 No

Question { 4172 }

How many types of syncronization?


Answer

There are three type Synchronization.
1.Class level Synchronization:

Class A{

static Syn...(){
}
}

2. Block level Synchronization:

class A{

Synchronized{
}

}

3.Method level Synchronization:

class A{

Synchronize method(){
}
}

Is This Answer Correct ?    5 Yes 1 No

Prev    1   2    [3]   4    Next