• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

about final and static final.

 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, everyone:
The following code compiles succesfully:

But if i write it as:

It will not compile, i cannot really understand it. Plz help.
Guoqiao
[This message has been edited by Guoqiao Sun (edited August 27, 2001).]
 
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using jdk1.3 where both did not compile. Both said variable j may not have been initialized. Which is true.
 
Guoqiao Sun
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Cameron, i also use JDK1.3. But i use it inside Forte.
Not sure why it gives such result as above.
Guoqiao

Originally posted by Cameron Park:
I am using jdk1.3 where both did not compile. Both said variable j may not have been initialized. Which is true.


 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes,I got the same result when I compiled the code.Why we got the different results between we and Guoqiao?

Originally posted by Cameron Park:
I am using jdk1.3 where both did not compile. Both said variable j may not have been initialized. Which is true.



------------------
Java Lover From Hell!
 
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I got compiler error (expected?) in 1.2.2 for the first code.

T041.java:16:
Blank final variable 'j' may not have been initialized.
It must be assigned a value in an initializer, or in every constructor.
static final int j;
^
1 error
Vanitha.

[This message has been edited by Vanitha Sugumaran (edited August 27, 2001).]
 
Montana has cold dark nights. Perfect for the heat from incandescent light. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic