This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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.
 
The human mind is a dangerous plaything. This tiny ad is pretty safe:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!