Win a copy of Spring Boot in Practice this week in the Spring forum!
    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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

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
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic