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 interfaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "interfaces" Watch "interfaces" New topic


Vinnie Jenks
Ranch Hand

Joined: Apr 26, 2004
Posts: 207
I'm a long-time C# cat trying to translate my skills over to Java.

In C#, when I create an interface I can use it as a means of declaring a type in an abstract manner, like so:

Does it work this way in Java? I'm using Eclipse and it's telling me it can't find my interfaces as this just an Eclipse issue?

I tried this:

If this is a Java "gotcha", are abstract classes the same?

Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24195

Your example Java code is exactly right; the devil is in the details, though, so perhaps some detail is wrong in your real code. Maybe it's a package thing? Make sure the package containing the interface is imported when you compile your other code (assuming everything's not in one package.)

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: interfaces
It's not a secret anymore!