File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Teachers' Lounge and the fly likes Practical example for Abstraction Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Books and Education » Teachers' Lounge
Reply Bookmark "Practical example for Abstraction" Watch "Practical example for Abstraction" New topic
Author

Practical example for Abstraction

rajaraman navaneethan
Ranch Hand

Joined: Feb 26, 2005
Posts: 85
hi friends,
can any one give a practical example of the Abstraction concept in a java program?
i can understand that abstraction means Through the process of abstraction, a programmer hides all but the relevant data aboutan object .
is the following program an example of Abstraction

public class OOP
{
public float cal(float a,float b)
{
return a*b;
}
}
public class XYZ
{
public static void main(String args[])
{
OOP obj=new OOP();
obj.cal(12.3f,10.2f);
}
}

here in the class OOP,the cal method calculates the product of 2 floating point numbers.class XYZ calls the method cal thru the object obj.it does not know the implementation of the cal method,but it gets the o/p.
similarly if we declare a variable int i=10; a 32 bit holder is assisgned to i, which happens behind the scenes.

are the 2 cases above a valid example for abstraction,if not please give a practical example of the concept of abstraction in java

regards,
Raja
 
 
subject: Practical example for Abstraction
 
Threads others viewed
difference b/w encapsulation vs abstraction
Overloading methods,constructors. Can't seem to find the reason for doing this
String object creation
Doubt in Object oriented concept
OOPS Concepts - Redefined(Confirmation required)
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture