This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android forum!

Nikhil Bansal

Greenhorn
+ Follow
since Mar 21, 2006
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 Nikhil Bansal

Hi Vardhan,

The 2nd answer is correct.Anonymous class is always declared and instantiated on the fly.The 1st option is that of a normal object creation.

Regards

Nikhil
Hi All,

class Level1Exception extends Exception {}
class Level2Exception extends Level1Exception {}
class Level3Exception extends Level2Exception {}
class Purple {
public static void main(String args[]) {
int a,b,c,d,f,g,x;
a = b = c = d = f = g = 0;
x = 1;
try {
throw new Level1Exception();
try {
switch (x) {
case 1: throw new Level1Exception();
case 2: throw new Level2Exception();
case 3: throw new Level3Exception();
} a++; }
catch (Level2Exception e) {b++;}
finally {c++;}
}
catch (Level1Exception e) { d++;}
catch (Exception e) {f++;}
finally {g++;}
System.out.print(a+","+b+","+c+","+d+","+f+","+g);
}}

Plz provide me what is exactly wrong with the above code.

Regards

Nikhil
Hi All,

Why is single thread model deprecated in the latest versions on Servlet API.

Regards

Nikhil
15 years ago
Hi All,

If in a servlet you are calling init method and passing the ServletConfig object then why is mandatory to call the init method of the superclass.

eg:

public void init ( ServletConfig config ) throws ServletException
{
super.init ( config ); // why is it mandatory
}


Regards

Nikhil
15 years ago
Hi All

What is the diff b/w ArrayList and Vector (apart from Vector being Synchronized).
Also plz explain in brief what is LinkedList

Regards

Nikhil
Hi All

What is the diff between throw and throws.

Regards

Nikhil
Hi Nivi,

Checked exceptions are actually checked by the compiler.These are conditions which need to be dealt with compulsarily by the part of the code implementing these conditions.

For example, if a method is using some File Operation then it needs either to deal with the exception directly or pass these exceptions to the caller method.

Unchecked exceptions are genuine defects or logical errors in the code.They are not checked at compile time but at runtime. eg ArthmeticException,ArrayIndexOutOfBoundsException.

Hope the explaination helps.

Nikhil
Hi Rajeswar,

Consider the foll. class

class VariableTest
{
static int i; // class variable (belongs to class and not to any instance)
int y; // instance variable

public void sum(int z1,int z2) // local variable
{
// do some operation
}
}


Hope it helps.

Regards

Nikhil
Hi All,

Is it mandatory to initialize local variables.

Regards

Nikhil
Thanks a lot rajeswar.

Regards

Nikhil
But how is it different from Serializable.

Nikhil
What is Externalizable in java

Regards

Nikhil
The protected members of a superclass can certainly be inherited by the subclass instance.

Nikhil
Hi All,

I have read about String being interned in java i.e. the String objects with the same contents are maintained as a single object in the pool.

Now my ques is why doesn't java apply the same concept to other objects eg. Wrapper classes.

eg: Integer i1 = new Integer(10);
Integer i2 = new Integer(10);

Will i1 and i2 be interned.

Also what are the advantages of interning.

Regards

Nikhil Bansal
Thanks a lot Keith.Your answers have cleared my doubts.

Regards

Nikhil Bansal