This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

abstract variable  RSS feed

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to All,

Can you please tell me what is the meaning of abstract variable. where is the use and benefit of making a variable abstract??
 
Ranch Hand
Posts: 355
Chrome Java Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here follow 2 meanings of word abstract:
A concept or idea not associated with any specific instance.
A sketchy summary of the main points of an argument or theory.

There is nothing like 'abstract variable' in Java. We have 'abstract classes' and 'abstract methods'. Try to relate the meaning of word 'abstract' with 'abstract classes' and 'abstract methods'.

Hope that helps,
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot have a variable declared as abstract in java. What is your requirement? Why do you need abstract variable? Can you provide more details?
 
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Krithika Srinath:
You cannot have a variable declared as abstract in java. What is your requirement? Why do you need abstract variable? Can you provide more details?



Aloha Krithika,

Think of it this way. Java defines only abstract classes and methods (as far as I've read so far). Abstract implies that the abstract methods within abstract classes must be coded. A variable cannot be coded because it is a primitive or reference that can only be assigned a value.

You cannot do something like this:


It is like trying to fit a square peg in a round hole, or using kitchen utinsels for farming .

Hope this example helps...
Aloha,
Doug
 
Krishna Acharya
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Krithika!
I have read about abstract variable somewhere in Kathy-Book. I was just wondering about this. Now, there is no confusion. You are right.
Thanks.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!