Trình biên dịch java cho phép tôi viết định nghĩa Lớp bên trong Giao diện. Có cách sử dụng cụ thể nào về điều này không?Lớp lồng nhau bên trong giao diện
interface ClassInterface {
void returnSomething();
int x = 10;
class SomeClass {
private int y;
private void classDoingSomething() {
}
}
}
Vui lòng giải thích.
có thể trùng lặp: http://stackoverflow.com/questions/594789/practical-side-of-the-ability-to-define-a-class-within-an-interface-in-java –
bản sao có thể có của [ bên trong lớp trong giao diện] (http://stackoverflow.com/questions/2400828/inner-class-within-interface) – aioobe