Results 1 to 3 of 3
Thread: Generic Interface
- 05-26-2011, 08:51 PM #1
Member
- Join Date
- May 2011
- Posts
- 12
- Rep Power
- 0
Generic Interface
Hello!
Trying to write a interface for a vector class i have to implement,getting some errors tho,and dont know what i´m doing wrong.
Hope some1 can point me in the right direction!
the error i´m getting is "T cannot be resolved to a type"Java Code:public interface IVector <T> { void add(T elem); void add(T elem, int pos); int capacity(); void clear(); boolean contains(Object elem); int indexOf(T elem); boolean isEmpty(); boolean remove(int pos); boolean remove(Object elem); T elementAt(int pos); void insertElemenAt(T elem, int pos); void setElementAt(T elem, int pos); int size(); }
- 05-26-2011, 09:19 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,427
- Blog Entries
- 7
- Rep Power
- 17
Which line is causing that error? It compiles fine for me. Are you using Java 1.5 or later?
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 05-26-2011, 09:24 PM #3
Member
- Join Date
- May 2011
- Posts
- 12
- Rep Power
- 0
Similar Threads
-
comparable interface, generic types
By dylandrop in forum New To JavaReplies: 3Last Post: 04-16-2011, 07:45 PM -
Can generic types implement an interface?
By jdgallag in forum New To JavaReplies: 3Last Post: 10-30-2008, 04:07 AM -
A generic interface example
By Java Tip in forum java.langReplies: 0Last Post: 04-17-2008, 07:42 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks