Roja Rani

+ Follow
since Sep 28, 2005
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 Roja Rani

Hi Bryan,

Best wishes for your birthday afterwards..

Thank you for all your efforts associated to HFSJ..


Originally posted by vjdev vjdev:
<html:form action="/upload" enctype="multipart/form-data">

Make sure the enctype="---" occurs before the post="---" in the form

Spent hours figuring this out.


Thank you for the suggestion.. It solved my problem.

15 years ago
Hi All,

Thank you for the replies. I understood that we need not count the copy variables passed to a method (even though it is static) while searching for the reference variables that are having references to the object in GC process. This is because, those variables are part of stack and will not exist once the method is completed. Please correct me if I am wrong.

I have another doubt regarding garbage collection which I came across in one of the mock tests. How many objects are eligible for GC when the control returned from this method?

public void method{
for(int i=0;i<=10;i++){
String tmp=Integer.toString(i);

I have given answer 11 because, String tmp is local to the for loop and 11 objects are created in the for loop. once the controller comes out of the method, tmp is out of scope and the string referenced by this would be unreachable which makes the object referred by tmp eligible for GC.

But the answer given in the mock test is 10, the explanation given is "There is one reference tmp for the last object created, which makes that object not eligible for GC".

Please explain how it counts the reference variable that is not existing. When will the object referenced by tmp will be eligible for GC?
Hi All,

I have doubt regarding garbage Collection.

public static void main(String args[]){
X x=new X();
X x2=m1(x);
X x3=new X();

x=x2; //Line 1


static X m1(X x1){
x1=new X();
return x1;

After completing Line 1, how many objects are eligible for garbage collection. My doubt is whether object first referred by x (which is passed as argument to a static method) will be eligible for garbage collection or not.

Hi Henry,

Thank you for the reply. I understood that in jdk 1.4, there is using special case for -3 to 10 while converting to toString() of wrapper classes and that special case is not there in Jdk 1.5.
Hi All,

If I run the following sample code in main method, It is printing "false".

Byte myByte=new Byte("111");
if(myByte.toString() == myByte.toString()){
}else {

If I change the above code as follows (creating byte with 10),

Byte myByte=new Byte("10");
if(myByte.toString() == myByte.toString()){
}else {
Then it is printing "True".

Anybody please explain the concept behind this.

The exact question is as follows:

Question 43.

Which of the follwing is true about static modifier.

A.static can be applied to : instance variables, methods,
code Segments and classes.

B.a static method cannot be overridden.

C.inner classes can be both static & private.

D.a static reference cannot be made through non static
method or code block.

E.abstract & static both can be applied together to a

Ans: B,C,D.

My doubt is regarding 'D'. How could it be true? Please clarify.
Hi All,

I found the following in valiveru's mock exam.

a static reference cannot be made through non static method or code block.

Is this true or false?

I answered as False because we can access static variables from non static methods. But the answer given is True.

Anybody please clarify how this is true.
It is compiling with option d also.
Following is from API

public final void join(long millis)
throws InterruptedException
Waits at most millis milliseconds for this thread to die. A timeout of 0 means to wait forever.

I have written finalize method that is throwing checked exception, I am not getting any compiler error.
Hi Junilu,

I understood that char is also integral type. Thank you for the reply.
Hi All,

I have come across the following question in mock exam.

You have been asked to create a scheduling system for a hotel and catering organsiation.

You have been given the following information and asked to create a set of classes to represent


On the catering side of the organsiation they have

Head Chefs
Apprentice Chefs

The system needs to store an employeeid, salary and the holiday entitlement

How would you best represent this information in Javae been given the following information and

asked to create a set of classes to represent it.

How would you best represent this information in Java

1) Create classes for Head Chef, Chef, Apprentice Chef and store the other values in fields
2) Create an employee class and derive sub classes for Head Chef, Chef, Apprentice Chef and store

the other values in fields.
3) Create and employee class with fields for Job title and fields for the other values.
4) Create classes for all of the items mentioned and create a container class to represent employees

I answered this with option 2 as all are employees and there may be different responsibilities to HeadChef, Chef and Apprentice and those could be written as methods in respective classes.

But the answer is 3. Anybody please explain how the 3rd option is better than 2nd?

Is the following statement True/False?

All the Java integral types are signed numbers

I expected True but the answer is false. I thought byte, short, int, long are integral types of Java and all these are signed numbers.

Anybody please explain how the above statement is False?

I have seen the given thread. The explanation is real good.
I am having some confusion regarding (byte)((byte)-15>>>4).

How it is giving the result -1? >>> is unsigned shift and I am calculating this shift as follows.

-15: 1111 0001
>>>4: 0000 1111

1111 is decimal 15 and is having its left most bit 0, which makes it positive. Thus I expected the answer 15.

Please clarify how it is giving -1?