- 382.3K All Categories
- 2.1K Data
- 208 Big Data Appliance
- 1.9K Data Science
- 447.9K Databases
- 220.9K General Database Discussions
- 25 Multilingual Engine
- 522 MySQL Community Space
- 465 NoSQL Database
- 7.8K Oracle Database Express Edition (XE)
- 2.9K ORDS, SODA & JSON in the Database
- 490 SQLcl
- 3.9K SQL Developer Data Modeler
- 186.1K SQL & PL/SQL
- 21K SQL Developer
- 293.2K Development
- 7 Developer Projects
- 128 Programming Languages
- 289.9K Development Tools
- 96 DevOps
- 3K QA/Testing
- 645.6K Java
- 24 Java Learning Subscription
- 36.9K Database Connectivity
- 150 Java Community Process
- 104 Java 25
- 22.1K Java APIs
- 137.9K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 16 Java Essentials
- 144 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
- 198 Java User Groups
- 260 LiveLabs
- 36 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