Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: What am i doing wrong? Generics

  1. #1
    Junior Member
    Join Date
    Jan 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question What am i doing wrong? Generics

    Hi,
    I am currently using an abstract class which i am later extending using one called People


    abstract public class MediaContainer <T>{
     
      abstract T DisplayName(T Dispname);}

    which i want to override in here

    public class People <T> extends MediaContainer <T> {
     
     
     
        @Override public T DisplayName(T Person){
            return System.out.println(Person);
        }


  2. #2
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: What am i doing wrong? Generics

    You need to tell us what error you're seeing, but one glaring error is that you can't declare a method to return T and have it return void. In fact you can't ever return void which is what out.println(...) returns.

Similar Threads

  1. Need some help with Generics
    By bankston13 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: October 5th, 2012, 03:06 PM
  2. Generics.
    By Kumarrrr in forum Java Theory & Questions
    Replies: 1
    Last Post: December 6th, 2011, 06:53 PM
  3. Generics
    By Kerr in forum Collections and Generics
    Replies: 2
    Last Post: May 19th, 2011, 06:44 PM
  4. Generics problem
    By ankur.trapasiya in forum Collections and Generics
    Replies: 1
    Last Post: January 22nd, 2011, 02:52 PM
  5. Generics
    By _lithium_ in forum What's Wrong With My Code?
    Replies: 21
    Last Post: December 6th, 2010, 07:08 PM

Tags for this Thread