views:

36

answers:

2

Hi,

I'm new to Java (C++ guy myself) and am trying to compile a simple program (testing different random number algorithms) in Java. I have an interface that I want to use to implement another class with, both of these items are in the same package.

So I have two files right now in my "Random" package directory--"RandomInterface.java" and "RandomTest1.java" (which implements RandomInterface). I can use javac to compile RandomInterface.java just fine, but I get the following error when I then try to compile RandomTest1:

RandomTest1.java:3: cannot find symbol
symbol: class RandomInterface
public class RandomTest1 implements RandomInterface
                                 ^
1 error

I declare both files to be part of the same package (Random) as the first line of each file. What do I need to do to include the RandomInterface class into the compile command for RandomTest1?

Thanks!

+1  A: 

Your text says RandomInterface but your code says RandomClass. Is this just a simple oversight, or am I missing something?

Carl Smotricz
+1 - hehehe :) you got him!
Webbisshh
I'd originally started with the interface as an abstract class instead--I guess I'd copied the error message from before I'd switched the it to an interface. I'll update my post with the proper current error message--still the same thing though.
DashRantic
A: 

In java we use extends keyword for extending class and implements for interface and where as you are using wrong keyword for wrong type. If this is class then you should extends it.

Aizaz
It's an interface
DashRantic