Balamurugan Kandasamy

Greenhorn
+ Follow
since Dec 03, 2000
Merit badge: grant badges
For More
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 Balamurugan Kandasamy

Hi,
Would HttpSessions method
public boolean isNew()
useful to determine if the client supports cookie or not. Pls clarify...
Thanks
MKBala.
23 years ago
Hi,
Needless to say im new to servlets. Presently going thru API's.
Where can this containsheader be used. API tells the definition but i am not able to get when it would be generally used in real projects.
Thanks
MKBala...
23 years ago
Hi,
I am a newbie to servlets. I hear there are lots of app servers
like Tomcat, IBM Websphere, IIS by different companies which have their own way of structure and features. I am just curious about which one is widely ( as of today) used across industries and is more preferred or efficient(in aspects like connectivity, security and DB connection point of view or volume of transaction or cost or whatever :-) )
Thanks
MKBala...
23 years ago
Hi Randall,
This again would return array of cookies which are already stored on the client side. But say this is the first time my server has been accessed by the client then whats the solution as this method would return null though Cookies may be supported.
Hope i am right in my question.
Thanks
MKBala.
23 years ago
Hi Randall,
This again would return array of cookies which are already stored on the client side. But say this is the first time my server has been accessed by the client then whats the solution as this method would return null though Cookies may be supported.
Hope i am right in my question.
Thanks
MKBala.
23 years ago
Hi,
I think in the above case only option E is fine. When you
initialize during declaration, the compiler accepts only when the number of elements in the RHS is blank.
So it would be right to say
int [ ] arr = new int[] {1, 2, 3, 4, 5} but not
int [ ] arr = new int[5] {1, 2, 3, 4, 5};
Same holds good for D also. Pls correct me if I am wrong.
I tried the above with JDK1.2.2
Thanks
MKBala...
To Whomsoever it may concern !!
Pls come up with solid justifications as it really causes turmoil.
Thanks
MKBala...
Oops!!! Sorry about point B.
There is no guarantee that all objects need to be GC'ed.
So I too go with C and D.
MKBala...
A. Objects are deleted when they can no longer be accessed through any reference
False

Reason : They are eligible for deletion would have been true.
B. The finanalize() method will eventually be called on every object
True

Reason : The objects finalize method would be implicitly called
(if not overidden) just before GC and for that matter all objects are eventually GCed at one point.
C. The finalize() method will never be called more than once on an object
True

Reason : As said above finalize would be called just before GCing the object. And an object would be GC'ed only once. And also note that even if there is an interruption during finalize() method execution , it wont be called again.
D. An object will not get garbage collected as long as it is possible for an active part of the program to access it through a reference.
True

Reason : Y disturb something that is useful :-). Well the compiler feels so !!!
E. The garbage collector will use a mark and sweep algorithm.

false

Reason : Not necessarily. Depends on JVM . This is again system dependent similar to time-slicing/ pre-emptive scheduling of threads.
Bill pls let know if something looks odd.
MKBala...
Thanks Lahcen. That makes sense and it cleared my doubt.
MKBala...
Hi Ajith,
I think I am not comfortable yet. The point that you need an instance of outer class for instantiating the inner class is fine. So in that case my code below should compile fine right ???
import java.lang.*;
public class A {
class B {} // note than static is removed.
}
class C extends A.B {
public static void main(String args[])
{
A a = new A(); // instantiated the outer class
A.B ab = a.new B(); // instantiating the inner class through
// outer instance.
}
}
But my doubt is ,if my problem is due to inheritance, bcos for the same above code when i say extends A instead of A.B it is fine.
So does that mean that the inner non-static class B cannot be inherited without the whole class A being extended.
Thanks
MKBala...
The following compiles.
import java.lang.*;
public class A {
static class B {}
}
class C extends A.B {
public static void main(String args[])
{
A.B ab = new A().new B();
}
}
But when I remove static for class B which is as below , it says
no enclosing instance of type A in scope.
import java.lang.*;
public class A {
class B {} // note than static is removed.
}
class C extends A.B {
public static void main(String args[])
{
A.B ab = new A().new B();
}
}

However if i dont extend A.B then it is not a problem.
import java.lang.*;
public class A {
static class B {}
}
class D {
public static void main(String args[])
{
A.B ab = new A().new B();
}
}
Think im not clear in this funda. Pls throw some light.
Thanks
MKBala...
Hi Vadiraj,
If you could revisit the starting of the same paragraph in the page you have given, you can find that the author has specified for invoking instance method on an object which means it is not for static.
MKBala...
Think the above post is not structurally well formed ::
Option B is right.
Option A need not be right as the default encoding may vary depending on system settings.
MKBala...

I think option B would be the right one as in option A we dont specify the encoding method and hence depending on the default setting it could vary.
MKBala...