I didn't know that inner classes could be defined in the [Java] interface

I think that only method definitions and constant definitions can be defined in the interface It was different, so it was just a memo

Hoge.java


public interface Hoge{

  public int A = 10; //Definition of constants
  
  public void hoge(); //Method definition

  public class InnerClass{  //Inner class definition
  }
}

I didn't know that an inner class could be defined.

reference

http://yuroyoro.hatenablog.com/entry/20080707/1215431467 https://teratail.com/questions/36600 http://www.atmarkit.co.jp/ait/articles/1007/27/news103.html

Recommended Posts

I didn't know that inner classes could be defined in the [Java] interface
The story that the Servlet could not be loaded in the Java Web application
The case that @Autowired could not be used in JUnit5
How to batch initialize arrays in Java that I didn't know when I was a beginner
Access the network interface in Java
I tried to solve the past 10 questions that should be solved after registering with AtCoder in Java
The case that "apt-get update" defined in "Dockerfile" could not be done at the time of "docker-compose build"
A program (Java) that outputs the sum of odd and even numbers in an array
Sample program that returns the hash value of a file in Java
The story that the Servlet could not be loaded in the Java Web application
I didn't know that inner classes could be defined in the [Java] interface
About the case that ("b" .. "aa") could not be used in Ruby Range
The story that I could not build after installing multiple Java on Windows
About the idea of anonymous classes in Java
[Java] [javaSliver] The interface and abstract classes are complicated, so I will summarize them.
The story that the variable initialization method called in the Java constructor should not be overridden
Basic functional interface that can be understood in 3 minutes
Write a class that can be ordered in Java
Java classes and instances to understand in the figure
I tried to implement the Euclidean algorithm in Java
The story that the forced update could not be implemented
The story that .java is also built in Unity 2018
[Java] Coverage report could not be created with the combination of default method of Cobertura + interface
[Java] It seems that `0 <hoge <10` cannot be written in the conditional expression of the ʻif` statement.
I made a program in Java that solves the traveling salesman problem with a genetic algorithm
Callable Interface in Java
I translated [Clone method for Java arrays] as the Clone method in Java arrays.
I didn't understand the behavior of Java Scanner and .nextLine ().
[Java] ArrayList → Should I specify the size in array conversion?
I want to set the conditions to be displayed in collection_check_boxes
Identify threads in the Java process that are wasting CPU
Java 14 new features that could be used to write code
I touched the devise controller that I felt in the black box
[Java] I thought about the merits and uses of "interface"
I want to simplify the conditional if-else statement in Java
When I was worried about static methods in java interface, I arrived in the order of name interpretation