DEV Community

Cover image for Is Java a verbose programming language?
Maurizio Turatti
Maurizio Turatti

Posted on

Is Java a verbose programming language?

Short answer: Most complaints about Java’s verbosity are based on Java 8-era Java. Since 2014, the language has evolved significantly, and many of those criticisms no longer hold.

Why the “Java is verbose” criticism is outdated

People usually mean three things by “verbose,” all of which were largely true in Java 8:

  • Boilerplate-heavy data modeling
  • Clumsy control flow
  • Ceremonial program structure

The real issue

Most people forming opinions about Java today are:

  • using Java 8 at work
  • reading Java 8-era tutorials
  • comparing Java 8 code to modern Kotlin / Python / Go

That’s like judging JavaScript today based on ES5.

The uncomfortable truth

Modern Java is:

  • still explicit
  • still strongly typed
  • still conservative

…but it is no longer excessively verbose relative to other mainstream, production-grade languages.

The criticism persists mainly because:

  • enterprises stayed on Java 8 for years
  • cultural perception lagged behind language evolution
  • Java optimizes for long-lived systems, not hype cycles

Below a compact example of new Java features:

record User(String name, int age) {}

void main() {
    var user = new User("Alice", 32);

    String category = switch (user) {
        case User(_, int age) when age < 18 -> "minor";
        case User(_, int age) when age < 65 -> "adult";
        case User(_, _)                     -> "senior";
    };

    System.out.println("""
        User info
        ---------
        Name: %s
        Age: %d
        Category: %s
        """.formatted(user.name(), user.age(), category));
}
Enter fullscreen mode Exit fullscreen mode

Why this example is interesting

  • No class declaration Java finally supports script-like programs without sacrificing type safety.
  • record Immutable data carrier, perfect for domain objects and DTOs.
  • Pattern matching in switch No getters, no casts, no if-else chains.
  • Text blocks Cleaner multiline output without escaping noise.
  • Still 100% Java This is not a toy language mode.

Compile & run

Copy and Save the above code into a file, say Main.java. To compile and run:

~ javac Main.java
~ java Main
User info
---------
Name: Alice
Age: 32
Category: adult
Enter fullscreen mode Exit fullscreen mode

Bottom line

If someone says “Java is verbose” and hasn’t seriously looked at Java post-17, they’re not making a technical argument, they’re repeating a historical one.

Top comments (0)