Results 1 to 3 of 3
  1. #1
    vallach is offline Member
    Join Date
    Nov 2012
    Rep Power

    Default Unknown type of an interface field

    Let's say i have an interface with a field "data" which can be each time a different type, one time it can be an integer, string, boolean, array of integers, arrays of booleans, etc..

    how will i define it in my interface?

    Interface SomeName {

    <T> data;


    like this? can someone give me some sort of explanation? and later i need a different class which will implement my interface, one class for integer, one class for boolean, and so on?

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power

    Default Re: Unknown type of an interface field

    Check Google for a Java generics tutorial. All you need to know you will find there, and then some.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power

    Default Re: Unknown type of an interface field

    Why are you giving an interface some data?
    That's usually not a good idea.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Unknown column 'id' in 'field list'
    By peace76 in forum Java Servlet
    Replies: 6
    Last Post: 12-12-2013, 07:23 PM
  2. uses interface as type
    By j2me64 in forum Advanced Java
    Replies: 2
    Last Post: 09-19-2011, 02:31 PM
  3. Replies: 4
    Last Post: 08-01-2011, 10:29 AM
  4. Field type
    By code_worm in forum New To Java
    Replies: 15
    Last Post: 10-21-2009, 03:03 PM
  5. Replies: 2
    Last Post: 04-28-2008, 10:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts