interface Main { public static void main(String[] args) { System.out.println("Inside main"); int a = 4 , b = 6 ; System.out.println(a+b); } }
There is no defined class in the above code, but the program still executes. But, as far as I know, there can be no static method inside the interface. And each program must contain at least one core function.
Because you are using Java version 8.
Starting with Java 8, you can have static methods inside the interface.
And main () also runs from interfaces (even from enumerations) if you keep the correct signature.
Source: https://habr.com/ru/post/1693841/More articles:Unlink after force скачать не работает Codeigniter - phpLearning level in excess of 0.001 leads to an error - pythonWhy does a State object exist in React? - javascriptWhy should you implement IDisposable to clean up unmanaged resources? - c #Порядок загрузки частичных файлов JavaScript отличается от того, что находится в коде - javascripthttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1693842/displaying-similar-bars-together-in-ggplot&usg=ALkJrhhoqGwjLrKjHZtLTqGBtFWEFE0pzQfind nearest rows between data frames with positive timedelta - pythonElm NetworkError upon receipt of the request, but the console says that this is normal - httpHow to sort recyclerView - javaElm http request returns NetworkError for successful requests - httpAll Articles