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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

variable declaration

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
can anyone tell me what all method declaration are valid amongs t the follpw ing
abstract int i;
a) abstract int i;
b] final int i;
c] final volatile int i;
d] public transient final i;
e] protected static final int i;
I think none is right b'coz when we declare final we need t o
intialize the variable there only
but why cant the variable be declared as abstract
???
 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I dont think a variable can declared as abstract. That is only for Methods and classes. The final variables have to be instanciated when created. I think thats right, correct me if I am wrong.

[This message has been edited by Faisal Dosani (edited May 08, 2001).]
 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
final variables don't have to be initialized with a value when instantiated, but since they don't take a default value, they have to be explicitly initialized before they are first referenced
 
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi, I'm closing this thread. See an earlier duplicate post http://www.javaranch.com/ubb/Forum24/HTML/009682.html for answers.
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
 
    Bookmark Topic Watch Topic
  • New Topic