Re: what is abstraction ?
Thanks for the mail.
but still i am not clear with your explanation.
you have showed a method which return x*3 when you pass x as a
argument to it.
so, x could be anything x=1,2,4,5, etc ......do you mean as this
method is reusable for any value of x and it will return the
mutiplicative output all the time.....its an example of
abstraction.........is this what you wanted to mean ?
i dont get the idea what you wanted to mean by those example.....how
abstraction is related with that.
However from google search i found "A view of a problem that extracts
the essential information relevant to a particular purpose and ignores
the remainder of the information."
still, its very difficult to percept how and where we use this concept
in programming......i
cant beleve yet that abstract classes are examples of the abstraction
of a class ? is it true ?
Stefan Ram wrote:
"gk" <srcjnu@gmail.com> writes:
what is abstraction ?
It means to leave out something.
For example, in Java, abstracting "3" from the expression
2 * 3
gives the method
public static int twice( final int x ){ return x * 3; }
So now, the "2" has been abstracted out of the ... abstraction.
And the abstraction has been "named" (often "abstraction" is
a shorthand for the term "named abstraction").
By naming an abstraction one is lead to the creation of a new concept.
For example, abstracting even the =BB3=AB
public static int product( final int x, final int x1 ){ return x * x1; }
yields the concept of multiplication.
Applying an abstraction to arguments yields or expresses something
as in =BBproduct( 2, 3 )=AB.
The abstraction is a means do dissect a text into chunks
so that they can be reused. We abstract the parts that restrict
reuse of something within another context and thus we obtain
a reusable entity, namely the abstraction.
An unnamed abstraction would be the lambda-expression
\x.x=B73
where "lambda" was written as "\", but just forget this example,
if you do not know lambda-calculus or read more about it at
Google or Wikipedia.
and also does abstraction has any relation with abstract class ?
The bodies of the methods have been abstracted from such a class.