Sarbani Mookherji

+ Follow
since Feb 25, 2003
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 Sarbani Mookherji

Corey, it would be of great help if you would please explain this line once more.

2) The run() method that the thread is executing ends.

Thank you,
Hello everyone,
That was really a very productive discussion.Thanks to all.
What I undertood from the whole discussion I am writing down in short. Please correct me if I am wrong anywhere:
In a tightly encapsulated class the instance variables should be declared private and can only be accessed through instance methods which may not necessarily be the getter and setter methods.
Friends have I understood correct?! Please enlighten.
Yes Pallavi, Corey is right.For non-negative numbers >> and >>> yields the same result.It is only for negetive numbers that they work differently.
Incase of the unsigned right-shift(>>> the new bits are set to zero always.Whereas in the case of the signed right-shift(>> operator,the new bit takes the value of the most significant bit before the shift.
Hello Pallavi,
So, here we are passing a copy of the refernce v into the method another.
I was not sure of what: v.i = vh.i = 10 is doing. Because we changed v.i to 20 and then v.i to 10 again.So, can you explain why we are again making a copy for the above code when we already got a copy of v into the method another(v.i = 20).

In the line v = vh we only make the reference v point to the reference vh.Here v is just a copy of the original reference.The new reference vh has the original value of i which is 10, which again will be the same(i.e,10) for every new instance of the class ValHold created.
When v->vh then i in v get the value 10 as it is 10 in vh.
I think changing v.1 to 20 and then to 10 again is just a trick to test our knwoledge on the topic and nothing more.
I hope I am right the way I am thinking and could help you.
Best Wishes,
Can any please give an explanation to the answer of this question:
class Black {
public static void main (String args[]) {
int i = 0;
int j = 0;
while (i++<5) {
for (; {
do {
System.out.print(i + j);
switch (i+j++) {
case 0: continue label3;
case 1: continue label2;
case 2: continue label1;
case 3: break;
case 4: break label3;
case 5: break label2;
case 6: break label1;
default: break label1;
} while (++j<5);

What is the result of attempting to compile and run the above program?
a. Prints: 12457
b. Prints: 02357
c. Prints: 02356
d. Prints: 1357
e. Prints: 1356
f. Runtime Exception
g. Compiler Error
h. None of the Above
Answer given is a.
Hello everyone,
I am confused about this question.
Which variables can an inner class access from the class which encapsulates it?
A.All static variables
B.All final variables
C.All instance variables
D.Only final instance variables
E.Only final static variables
Select all correct answers.

This is question from John Hunts mock test and the answer given is A,B,C.
In Khalid's book it is mentioned that non-static nested classes are called inner class and inner classes can only access the static final variables whose value can be determined at compile time.(Of couse it can access other variables of the top level class as well).
Do the term inner class refer to all nested classes i.e both static and non-static?
Pls help.
Thankx so much.That was great.
Love ...Sarbani
Thanks Sunita and Saharana,
Its clear.I got just confused.Actually staic methods can't be overridden to be non-static.I should have thought of it.
The code must have had compiler errors,I am very sorry.Will be more careful next time.
Thankx to both of u.
Love .....Sarbani.
Hello everyone,
Some one please tell me something about the assert keyword and assertion or let me know of some good link.
Love ...Sarbani
Hello Friends ..
Today I did Valiveru's mock test and have some doubts.Have anyone done that test?
In one question it states:
class BaseClass{
statis void sayHello(){
System.out.println("Hi pal!!!I am BaseClass" }}
public static SubClass extends BaseClass{
static void sayHello(){
System.out.println("Am In SubClass");}
public static void main(String args[])
{BaseClass bc=new SubClass();
The answer says it will print "Hi Pal!!!I am in BaseClass".Is it correct? I thought sayHello() is being overridden while it is a static class.
Please help.
The statement : Static variables can be applied to instance variables,methods,code fragments and classes is TRUE or False.
Again one question goes like this:
If you want to create java GUI application using AWT,you constructed a frame calling
Frame f=new Frame();
What methods you need to call on the frame to make it visible?
A. f.setVisible(true;
B. f.setsize(true);
C. Both A & B
It says Answer C.But is B correct???
Anotherdoubt: Is there any method called Interrupted() in Thread Class??
Anotherdoubt: Is ths TRUE or FALSE :
Overridden methods return different return types and will be in different classes.
Please help friends.
Love Sarbani.
Thanks friends,
That was great help.Its all clear now.I was looking at it from a different angle.
Thanks again.
I will be appearing for the SCJP1.2 on 25thMarch.Getting around 85-90%in the mock tests!Will that help ??? Felling nervous....
Thanks to all.
Love ...Sarbani
Hello everyone,
I will be appearing for the SCJP1.2 exam very soon.I have doubts with two questions:
1.For the code:
m = 0;
while( m++ < 2 )
System.out.println( m );
Which of the following are printed to standard output? 0,1,2
This is a question from MindQ's test and the answer 1,2.Is is correct?
2.How many objects are eligible for garbage collection once execution has reached the line labeled Line A?
String name;
String newName = "Nick";
newName = "Jason";
name = "Frieda";
String newestName = name;
name = null;
//Line A
The answer given is 1. But I am confused why 'name' will be elegible for garbage collection when 'newestname' refers to it.Pls expalin.
Looking forward to your help.