Rohan Kayan

Ranch Hand
+ Follow
since Sep 17, 2004
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rohan Kayan

How to read a '\n; new line character from Sybase DB ? In the table we have some string "\Device\newpath" while reading it using plain prepare statement on the output it is showing "\Deviceewpath" . Is there any way by which we can get the output "\Device\newpath" ?

I was bit curious that , can we unload any Java class explicitly from Memory ?

Thanks in advance.
14 years ago

I am bit confused regarding the Garbage Collection of object instance which reference is hold by some static member. When will that object be collected by GC ?

Thanks in advance.
Thanks to Javaranch forum for all the support during preparation.

14 years ago
Only object pointed by a1 is eligible to GC.

a2.b1 -> b1
a2.b2 ->b2
In Javadocs , I read this line for getInteger() method , "Determines the integer value of the system property with the specified name. " Which makes it clear that if there is no property with the name as "9" it will return null.
Oh got that , I thought second Qs is asking "Q2.How can a thread own the lock of this object? , that is why I thought it should provide more information about the Synchronization block. But now I am clear.

Q1.A java class can be:

1 strictfp and final
2 abstract and final
3 public and abstract
4 protected
5 private

Q2.How can a thread own the lock of an object?

1 When the thread executes a synchronized instance method of that object
2 When the thread executes a synchronized statement block
3 When the thread calls wait() on this object

I wanted to ask , when the Question 1 refers to Java class , do we need to consider inner class too ?
In Question 2 - option 2 don't provide the complete information , so is that a correct ans or not ?
Following is the question from

B)good idea
C)good idea good idea
D)good 0 good 0 1

Correct answer is : A

My doubt is that , as the time/sequence of execution of threads are dependent of the actual JVM and platform , the ans for above question could be any of these five

1. good
2. good 0
3. good 0 1
4. good 0 1 2
5. good 0 1 2 3

Am I correct in my interpretation ??

If I am not wrong. the generic type "String" is creating confusion , we generally use <T> or some other character for generic types , in above code we are using "String" to represent generic type.
Neha , what do you mean by "most closely associated class" ???
Hi, I am trying to run following code from Eclipse

Every time I am getting NullPointerException , what could be the issue ??
I think this one is a better example to understand that Interfaces are compiled as .class files and every classes are itself an Object in Java , that is why Interfaces "IS-A" java.lang.Object
It is still not clear to me ,

In above example String "is-a" an Object that is why the assignment in second line worked. But how can we say that Interface "IS-A" java.lang.Object ?

Why I am getting the output as , false and true ??