suresh mulagala

Ranch Hand
+ Follow
since Feb 18, 2003
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 suresh mulagala

Ducking is passing exceptions up the stack and not handling them. This should give you a clear idea...

what if m2 is setting q1 to null ? by the time it gets to the sytem.out, all of them would have been de-referenced and eligible to GC so in that case will not be holding on to any...

Another case: if there were static fields in the class and m2 is setting them to static fields none of them will be eligible to GC as they all have living references.....am i right?
If you are referencing to a new object the old object will be eligible for GC.

Unless the old object is static i guess ....?
what does m2 do? im m2 if q1 reference is passed on and not de-referenced anywhere, they all wont be eligible for GC isint it? any other thoughts?

Originally posted by Adam Schaible:
De-compile your code, the compiler adds the throws clause.



I was trying to test this...


Leave alone de-compiling..the above code doesnt comile in the first place..so whats this thing adding to the main method meant???
protected variable x can be access in the same package or subclasses of the class in which they are declared isint it? Since Amir and Anand are in the same package....

New1 has access to x and all instantiations of New1 will provide this value i guess....correct me if im wrong...
[ October 04, 2007: Message edited by: suresh mulagala ]

Originally posted by Adam Schaible:
Essentially the JVM catches your uncaught exceptions, and terminates. Exceptions will "bubble" up the call stack until it's either caught by calling code, or is caught by the jvm.

When you compile:

public static void main(String[] args...){
}

The compiler changes it to:

public static void main(String[] args...) throws Exception {
}

Your calling code then throws the exception to the JVM, it's caught by the JVM, flushed to the error stream, and exits.



How do you know what the compiler appends? checking in a de-compiler? Just curious...
IllegalStateException is subclass of RuntimeException and are usually bugs of improper us of the API. Such as tying to call a method on a null object such as :

List getSomeList(){
return null;
}
int lst = getSomeList().size(); // will throw a null pointer exception

These are not meant to be caught but fixed. But having said that it can still be caught and handled programatically.
sorry overlooked !
Swathi try this...

why have you got brackets after inner class declaration?

public class MyInner() <--
[ October 03, 2007: Message edited by: suresh mulagala ]
Because a3 is being converted to a max of A[3][2][1] when you are doing



so the utmost you can do is a3[2][1][0]
You are accessing E2 in a static way and instantiating a static inner class...
i guess foo[1] is initialized and an instance but foo[] may not be one...
a1 is the superclass and you are overriding m1, so d1.m1(a1) is valid and prints "a" and so on and so forth...

here it is evaluating to A's method because you are passing in an instance of A().