Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

sharana sharana

Greenhorn
+ Follow
since Mar 14, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sharana sharana

hi Awesome score , well i am planning to take the Architect Exams , would you please recommend which book to follow , what study guidelines are best to finish the exams
do you have any other materials that you feel best for exam
please update us
thanks in advance
sharan
hi Deshmukh book says about <jsp:forward> ,
"If the Output is Buffered it is first cleared and then the request is forwarded to the resource.However , if the output is not buffered and /OR if the response is already commited by the forwarding resource , then java.lang.IllegalstateException is thrown "

the point is not cleared to me is , IF the out put is not buffered it throws IllegalStateException!!! ,
anybody please clear this to me , Y?
thank you ranchers.
sharan
HI ranchers i have question about , servlet intialization method()
it is stated that from specs , servlet.init(servletConfig ) method is called By the Container exactly once when the servlet object is intialized and set for service.once intilization successfull then servlet is ready to service.
lets assume container maintains a five insatnces of a servlet A, then how manytimes init(ServletConfig) is called???
pls clarify this
thanks in Advance
sharan
hi Ranchers
SCWCD books [ hanumanth.. , wrox both ]says that Request attrbutes is Thread Safe???
lets say Container creates a One instance of a servlet and hence there is one copy of service() method and hence all doxxx() methods.
when mutiple threads try to access the above servlet all gets chance to execute same service() method which delegates services to different doxxx() methods based on request method.
in java Object parameter passing is always a shalow copying [i.e. only reference to the Object is passed], in that case how can two threads one executing in a doget() and other thread executing a doPost() method acting on a same set of request attributes can gurantee Thread safety???

any help here please??
since addHeader does not check for already existing headers it will add the header values to the specified header if its valid.so adding a mutiple headers in one single addHeader() or one header value at a time will have the same effect.
Hi ranchers can any body help me in understanding what is the difference between
ServletConfig.getInitParameter(paramname)
ServletConfig.getInitParameterNames()

AND
ServletContext.getInitParameter(paramname)
ServletContext.getInitParameterNames()

for ServletConfig object Init Param-value pairs are specified in Web.xml , likewise is there way to specify param-value pairs for ServletContext object as well ?? How???
Thanks in advance
oops typo!!!in above posting - so reposting it
hi reshma ,
this is is y i think answer 2 is right
As stated in JLS,
If a class does not override method finalize of class Object (or overrides it in only a trivial way)then if instances of such a class become unreachable, they may be discarded immediately rather than made to await a second determination that they have become unreachable.
the finalizable object was reachble only by the thread which invoked finalize() method of the Object.Becuz of exception the finalize() method is abruptly completed and hence BECOMES UNREACHABLE [ since oonly thread which has accessing to it gaveup ]. JVM says finalize() method of an Object will never be invoked more than once in its life time.

If the Java virtual machine detects that a finalized object has become unreachable, it may reclaim the storage occupied by the object because the object will never again become reachable .
hi reshma ,
this is is y i think answer 2 is right
As stated in JLS,
If a class does not override method finalize of class Object (or overrides it in only a trivial way)then if instances of such a class become unreachable, they may be discarded immediately rather than made to await a second determination that they have become unreachable.
the finalizable object was reachble only by the thread which invoked finalize() method of the Object.Becuz of exception the Object is abruptly completed and hence BECOMES UNREACHABLE , as JVM says finalize() method of an Object will never be invoked more than once in its life time.

If the Java virtual machine detects that a finalized object has become unreachable, it may reclaim the storage occupied by the object because the object will never again become reachable .
Hi first of all ur posting has lot of compile time errors please try by urself to compile and then post it , that would help and improve the discussion forum for sure
here is the corrected code

class BaseClass{
static void sayHello(){
System.out.println("Hi pal!!!I am BaseClass");
}
}
public static class SubClass extends BaseClass{
static void sayHello(){
System.out.println("Am In SubClass");
}
public static void main(String args[])
{BaseClass bc=new SubClass();
bc.sayHello();
}
}

First of all SubClass wont compile as top level class cannot be Static
lets assume that SubClass is not declared static then sayHello() in BaseClass is hidden by the sayHello() in SubClass .hence bc.sayHello() will print Hi pal!!!I am BaseClass
sure this helps u
thank you reshma , i appreciate for sharing ur knowledge
HI java ranchers please help me to understand this
k.mughal book says ( p 126 ) ,
" Note that the transient modifier cannot be specified for a static variables , as these do not belong to Objects"
but the Following Test didnt give any compiler error at all , So what exactly meant by the above statement please help .
public class TransientTest {
transient int v1 = 1;
static transient int st1 = 1;
final transient int sf1 = 1;
}
hi val thanks for the link but here my point is as per Question , expressions should prove that obj is instance of B and not instance of A and not instance of C
By proving instance of B and Not instanceof C left does not prove Obj is not instanceof A ,
as stated in answers ,
its True that answer c proves Obj is instaceof B and not instance of C , But it does not prove B is not an instance of A as asked in Question which expressions identifies whether the object referred by obj was created by instantiating class B rather then class A,C and D?
i think expression
(obj instanceof B) && ! ( obj instanceof A || obj instance of C ) can only prove that obj is an instance of B rather than Class A , C and D.
hi its True that answer c proves Obj is instace of B and not instance of C , But it does not prove B is not an instance of A as well as asked in Question which expressions identifies whether the object referred by obj was created by instantiating class B rather then class A,C and D?
i think expression
(obj instanceof B) && ! ( obj instanceof A || obj instance of C ) can only prove that obj is an instance of B rather than Class A , C and D.
hence none of the answers provided are correct