viyer

Greenhorn
+ Follow
since Oct 05, 2000
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 viyer

Khalid's book states:Pg126
Transient modifier should not be specified for static variables as these do not belong to objects
But later in the problem 4.26 Pg 130
Is this legal declaration?
final transient static private double PI = 3.141592
The answer is true.
Can someone please explain?
thanks
veena
"Implicit narrowing primitive conversions on assignment can occur in cases where the source is an INT constant expression whose value can be determined to be in the range of the destination type at compile time; the destination type is either byte, short or char type." In your example the assignment of a final would be a constant expression.
NOTE this is true for only int. For all other conversions u have to explicitly cast.

Originally posted by mohit joshi:
Going by Moons observation, the following code doesnt compile
class Test22 {
public static void main(String []args)
{
final double d = 100.0;
float f = d;
System.out.println("value of f : " + f);
}
}