Was going through inheritance chapter in Kathy's java6 book..And came across a line that states that :"Its almost impossible to do anything in java without using inheritance "..And when i read "almost".i wonder is it even possible in java to do anything that doesn't uses the concept of inheritance?..since whatever we create in java extends from java.lang.Object
I'm not sure if interfaces are descendants of Object. You can define an interface that specifies a contract for behavior and until there's an implementation of that interface, inheritance mechanisms don't really come into play yet.
It's not a bad thing to want to thoroughly understand what the author is saying but frankly, things like this are not really a practical concern and it kind of makes me wonder whether this is somehow going to end up in a future list of "interview questions" along with a bunch of other annoying and practically irrelevant "trivia" questions about Java. Understand but don't over-analyze.
It depends on what you mean by "Using," and who is doing this using.
You can write procedual programs in Java -- Hello World is a procedual program. Even though the class is an object and there are object-oriented implementation details (and the call to System.out.println may make use of an inheritance hierarchy), the logic shows none of the hallmarks of object-oriented design; you are not even creating an instance of the class executing the code. You can pick that code up and move it to C with minimal effort and no change to the design. Therefore, I cannot say that you are using inheritance in HelloWorld.
More to the point of the book, however, is that when designing programs using Object-oriented principles, inheritance is one of the more important design concepts. Any non-trivial program should make use of inheritance in its design; not doing so results in code that is nearly impossible to maintain as the project grows and matures.
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
If a regular clown is funny, then a larger clown would be funnier. Math. Verified by this tiny ad: