1

I was looking at some code and came across something similar to below:

import javax.validation.groups.Default;
public class TestClass  {

    public interface Interface1 extends Default{}
}

I am not able to understand this? What does this line mean:

public interface Interface1 extends Default{}

Before this I have never encountered code like this. Could anyone help me understand this.

EDIT:

I am not asking why to include interface within class, my doubt is on this statement:

public interface Interface1 extends Default{}

Please don't rush to make this as duplicate of altogether a different question.

CuriousMind
  • 8,301
  • 22
  • 65
  • 134
  • 1
    @alfasin, he is not talking about interface inside a class, but he is talking about line. – yash Sep 07 '16 at 17:59
  • @yash: Thanks for reading my question properly. – CuriousMind Sep 07 '16 at 18:02
  • 1
    But that's what that lines *does*. It declares an interface within a class. What part about it isn't clear to you? – resueman Sep 07 '16 at 18:04
  • meaning of Interface1 extends Default {} . That is the doubt. – CuriousMind Sep 07 '16 at 18:05
  • 2
    The line declares a new _interface_. The new interface is named `Interface1`, and it _extends_ an interface named `Default`. The `Default` interface is declared in the _package_ `javax.validation.groups`. The new interface does not add any _method declarations_ of its own: It only _inherits_ the methods that are declared by the `Default` interface. The new interface is a _member_ of the `TestClass` class. If that doesn't clear it up for you, then you probably need to read an introductory book or take an introductory class on the Java language. We can't teach you Java here. – Solomon Slow Sep 07 '16 at 18:22
  • Thanks for clarifying. My bad – CuriousMind Sep 20 '16 at 10:49

0 Answers0