- 196K All Categories
- 2.1K Data
- 209 Big Data Appliance
- 1.9K Data Science
- 447.4K Databases
- 220.8K General Database Discussions
- 23 Multilingual Engine
- 516 MySQL Community Space
- 463 NoSQL Database
- 7.8K Oracle Database Express Edition (XE)
- 2.9K ORDS, SODA & JSON in the Database
- 469 SQLcl
- 3.9K SQL Developer Data Modeler
- 185.9K SQL & PL/SQL
- 20.9K SQL Developer
- 292.6K Development
- 7 Developer Projects
- 124 Programming Languages
- 289.4K Development Tools
- 95 DevOps
- 3K QA/Testing
- 645.5K Java
- 23 Java Learning Subscription
- 36.9K Database Connectivity
- 150 Java Community Process
- 104 Java 25
- 22.1K Java APIs
- 137.8K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 15 Java Essentials
- 143 Java 8 Questions
- 85.9K Java Programming
- 79 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.2K Java SE
- 13.8K Java Security
- 197 Java User Groups
- 239 LiveLabs
- 35 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.8K Other Languages
- 2.3K Chinese
- 166 Deutsche Oracle Community
- 1.2K Español
- 1.9K Japanese
- 225 Portuguese
Abstraction in java
I am just a beginner in java and have some queries on abstraction in java
1 :- Suppose I have created an interface CalArea which have abstract area function mentioned in it.
Now I have created two classes Square and Circle both implements CalArea interface and overrides the method area to calculate the area of shape and the code is working fine.
My question is If I remove interface or instead of implementing an interface I am calculating the area of Square and Circle using area method which is not overrided.
Will it still be called an abstraction ?
Because in both cases we are using concrete class object to call area function as we couldn't create objects of interface. And we are only providing the essential detail to user that is method name instead of method implementation.
2. In my opinion interface only force us to implement some methods which are common to all class to lie in particular category.
For example : If Ferrari needs to be car it should implement some features which are common to all cars . Just the implementation could me different with some extra features added on it.
How can interface provide 100% abstraction just because it doesn't have concrete methods. At last user will use the object of class which implements interface to access the method. so if user is only using method name then even without interface we are achieving 100% abstraction.
As per my knowledge abstraction means just allowing user to use method name to perform his/her task rather than method implementation details. Which we even do without interface and abstract class.
Please correct me if I am wrong