- 196.8K All Categories
- 2.2K Data
- 238 Big Data Appliance
- 1.9K Data Science
- 450.3K Databases
- 221.7K General Database Discussions
- 31 Multilingual Engine
- 550 MySQL Community Space
- 478 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3K ORDS, SODA & JSON in the Database
- 544 SQLcl
- 4K SQL Developer Data Modeler
- 187K SQL & PL/SQL
- 21.3K SQL Developer
- 295.8K Development
- 17 Developer Projects
- 138 Programming Languages
- 292.5K Development Tools
- 107 DevOps
- 3.1K QA/Testing
- 646K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 155 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.1K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 18 Java Essentials
- 160 Java 8 Questions
- 86K Java Programming
- 80 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 204 Java User Groups
- 437 LiveLabs
- 38 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 171 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 232 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