Akash Roy

Greenhorn
+ Follow
since Jan 08, 2005
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 Akash Roy

yeah i guess i got it completely wrong.I am really very sorry about that.
this is the right code....


The value printed here is 0.
Can anyone explain? if the i variable is shared ???and whether changes made by 1 thread are reflected in others???
Hi,
I am totally confused about the variables handling by different threads.
can anyone shed light on this for example



In the above example will all the threads share the same copy of i??? and hence ll changes made by one thread reflected in other???
Regards,
hi,
Yeah i am thinking that since () has a higher precedence than && and || all the assignment (a=),(b=),(c=) should get evaluated and then the JVM should proceed with the && ,|| operations. Which is obviously not seen here. So please explain why isnt it so???

Regards,
hi,
but doesnt () have a higher precedence than || and &&.
Regards
Hi,

During == operator implicit widening takes place. Hence the Integer on the right side gets promoted to double.

Regards,
Hi,
just want to clear a basic doubt..
Consider the following code:

the values printed are true false false

But since Conditional And && has higher priority than Conditional OR || shouldnt the && expression get evaluated first??? Thanking in advance,

Regards
Hi,

Can Anyone please explain with an example how an anonymous class is defined in static context??? Thanking in advance,
Regards,
Hi,
I think you are partially correct. RuntimeExceptions and Error class are unchecked Exceptions. Hence they need not be enclosed in try-catch block.
All the rest throwables including Exception are checked Exceptions. Hence they need to be enclosed in try-catch Block.Hence 4 is the correct answer.

But option 2 sounds a bit confusing....
Regards,

Hi,
The above code compiles with a warning "Finally clause cannot complete normally". But when i execute the code i get the ourput as 1.
So in this case who handles the Exception thrown
The return value from the finally clause overides any previous return values.
Does it overrides the Exceptions also???
Thanks a lot Renaud.
Hi,
Can a labelled break statement be used to transfer control out of if {} Block. According to Khalid Mughal book it cannot.. However when i compile the following code

int i =10;
int j=0;
b1:if(j<10)
{
j++;
System.out.println(j);

break b1;
System.out.println(j); //line 63
}

It gives me error stating unreachable statement marked line 63.

Also when i use unlabelled break statement

int i =10;
int j=0;
if(j<10)
{
j++;
System.out.println(j);

break ;
System.out.println(j);
}
It says label outside switch or loop.Can anyone shed light on this topic.Thanking in advance,

Regards,
Vallabh
Hi,
Suppose i define a class public class Test{} in a package abc. But do not define any constructor. So in this case an implicit default constructor Test() will be provided by Java. But then how can the class be instantiated from outside the package abc. Since the constuctor Test() will have a default scope. Thanking in Advance.

Regards,
Vallabh
HI,
Why cant static variables be defined in methods In Java like C++, which could be a note of the no of times the method was called???
Thanking in Advance,

Regards,
Hi,

In the same context i would like to know what if the methods are being overloaded..
thanking in Advance,

Regards,
Hi,
The Object Class ie the supermost class defines a mthod toString() which returns
'the name of the class to which the object belongs to '+'@'+"hexadecimal hashcode of the object'.

This method may be overridden in other classes as per requirements.
Like it is overriden in String class to return the String value.....
Regards