Results 1 to 10 of 10
Thread: Interface
- 06-22-2011, 01:39 PM #1
Member
- Join Date
- Jun 2011
- Posts
- 3
- Rep Power
- 0
- 06-22-2011, 02:09 PM #2
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
Interface is basically a fully abstract class. An abstract class can have actual methods as well as abstract. It's generally better to use interfaces. You can implement as many interfaces as you want, but only extend one class.
- 06-22-2011, 02:12 PM #3
Member
- Join Date
- Jun 2011
- Posts
- 3
- Rep Power
- 0
ya i know that ,but we can use abstract class with only abstract methods instead of interface,can you give real time example.
- 06-22-2011, 02:16 PM #4
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
Check the java source files, in java.util.collection you will see classes like "AbstractSet", "AbstractList", etc.
You can also get lots of examples with google.
- 06-22-2011, 02:18 PM #5
Member
- Join Date
- Jun 2011
- Posts
- 3
- Rep Power
- 0
real world example,regarding interface.
- 06-22-2011, 06:21 PM #6
Not quite.Interface is basically a fully abstract class.
You can implement many interfaces
but you can only extend one class.
I look at interfaces as part of the tight typing part of java. It allows you to give another type to a class so the compiler can check when a specific type is required as an arg to a method. There are other uses also. Like Serializable that is a flag that can be checked to see if a class can be processed a certain way.
- 07-15-2011, 12:13 PM #7
Member
- Join Date
- Jul 2011
- Posts
- 3
- Rep Power
- 0
what is abstract
- 07-15-2011, 12:20 PM #8
Member
- Join Date
- Jul 2011
- Posts
- 3
- Rep Power
- 0
why are using abstract in java
- 07-15-2011, 12:21 PM #9
Member
- Join Date
- Jul 2011
- Posts
- 3
- Rep Power
- 0
what is trasient and why are using this
- 07-15-2011, 01:29 PM #10
Similar Threads
-
Is there a GUI interface for...
By smith427 in forum New To JavaReplies: 3Last Post: 12-03-2009, 07:17 AM -
How do I use an Interface for this?
By aaronfsimons in forum New To JavaReplies: 14Last Post: 06-22-2009, 02:19 PM


LinkBack URL
About LinkBacks

Bookmarks