In java, it has to be a class in a package. Packages are sane enough. That isnt the point.

That is the point, packages the Java programming language feature for the CS concept of modules.

https://en.wikipedia.org/wiki/Modular_programming

> Languages that formally support the module concept include Ada, ALGOL, BlitzMax, C++, C#, Clojure, COBOL, Common Lisp, D, Dart, eC, Erlang, Elixir, Elm, F, F#, Fortran, Go, Haskell, IBM/360 Assembler, IBM System/38 and AS/400 Control Language (CL), IBM RPG, Java, Julia, MATLAB, ML, Modula, Modula-2, Modula-3, Morpho, NEWP, Oberon, Oberon-2, Objective-C, OCaml, several Pascal derivatives (Component Pascal, Object Pascal, Turbo Pascal, UCSD Pascal), Perl, PHP, PL/I, PureBasic, Python, R, Ruby,[4] Rust, JavaScript,[5] Visual Basic (.NET) and WebDNA.

If the whole complaint is that you cannot have a bare bones function outside of a class, Java is not alone.

Predating Java by several decades, Smalltalk, StrongTalk, SELF, Eiffel, Sather, BETA.

And naturally lets not forget C#, that came after Java.