File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Question with generics Please help" Watch "Question with generics Please help" New topic

Question with generics Please help

kartik krishnan
Ranch Hand

Joined: Nov 19, 2006
Posts: 63

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.

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33134

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?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, 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

I agree. Here's the link:
subject: Question with generics Please help
It's not a secret anymore!