GeeCON Prague 2014*
The moose likes Java in General and the fly likes Question with generics Please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Question with generics Please help" Watch "Question with generics Please help" New topic
Author

Question with generics Please help

kartik krishnan
Ranch Hand

Joined: Nov 19, 2006
Posts: 63
Hi,

i am a newbie and and I hope this is not a silly question. I have an implementation class which is in another class file ie there is an another public class. The interface was defined like this.





In the another Java file we have







The error returned is Can not instantiate the type User. I dont know how to resolve this . Can anybody tell me why I get the error? Waiting for a reply.

Thanks,
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30580
    
154

Kartik,
Can you post the class definition ("public class User") and constructor for the user class?

Some reasons I can think of:
- Is User an interface?
- Is User an abstract class?
- Does User lack a public constructor?
- Does User use generics like Foo does?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
kartik krishnan
Ranch Hand

Joined: Nov 19, 2006
Posts: 63
User is a plain bean. It goes like this

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Question with generics Please help