0

I have an assignment to create a game in Java, so right now I'm making the stub implementations for classes. I want to make them as rigorously as possible, so that's why I'm asking:

What is the difference between an Interface declared in a class and an Interface declared as a file? Let's say, I have the following 2 pieces of code:

public class Test {

private int firstNumber;
private int secondNumber;

public void testMethod() {}

**public interface Interface1{
// some methods
}**

and

public Interface Interface2 {
// some methods 
}

Can I do something more ( i.e. access ) with Interface1 that I cannot do with Interface2 or vice versa?

P.S.: Started OOP a couple of weeks ago, take me easy :-)!

I made a class in which I declared an interface and an interface as a file and they seem to have the same functionalities, but maybe I'm missing something important here.

0xKnR
  • 1
  • 1

0 Answers0