Kate Shaw

Greenhorn
+ Follow
since Oct 05, 2001
Merit badge: grant badges
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 Kate Shaw

Does it mean that the static variables is not included in the the outer class scope?
22 years ago
I see. Thanks!
It is said by SL-275 that: method of a static inner class do not have access to the outer class scope.
Does it mean this one do not compile:
class AAA {
static int i;
static class A{
static void a(){System.out.println(i);}
}
}
But actually, it compiles.
I want to know why. Thanks.
22 years ago
No inner class can have a static member.
But why does this code compile?
public class AAA{
static class A{
static int i=0;
}
}
22 years ago
Finally��I know the answer.
It is a compile-time constant referring to Thinking In Java.
A static final variable means that it is a variable of the whole class and cannot be changed. If it can be assigned in the constructor, it will be changed every time when an instance of the class is created.Am I right?
[This message has been edited by Kate Shaw (edited October 05, 2001).]
22 years ago

Originally posted by ashyabhi:
hi,

actually u r missing some basic of java.
any variable with keyowrd final are once initilize can not change or manupulated.
that's whay ur coad is not compiled...


Thank you very much.
Many people explained the question exactlly as you did.But if so, how to explain the fact that the following code compiles?
public class b{
�� final long y;
�� b(){y=10;}
}
22 years ago
Hi!
Here is my question:
These following codes both compile.

But this one does not:

Does anyone know why it do not compile?
I'm thinking about it for almost one week,and have asked many people. But I still donnot know why. None of the answers are reasonable. Would somebody help me or should I post this message on the forum: Java in General (intermediate)? Thanks.
[This message has been edited by Kate Shaw (edited October 05, 2001).]
[This message has been edited by Cindy Glass (edited October 05, 2001).]
22 years ago