What I don’t like in JAVA !

Hrishikesh Raskar
3 min readApr 28, 2020

In the last interview I was asked what are the things that you don’t like about java ? Actually before this question I had never thought about it . May be due to mentality that how can I question anything which was written by world’s one of the top most developers and engineers. In that interview I tried to remember what features other languages have and java doesn’t have , and tried to answer. And I didn’t have much experience with other languages so couldn’t answer or give justifications as well.

After the interview only I started thinking about what I don’t like in java , or how I would have liked java more. I have searched and read many articles regarding why java is not good or what you don’t like java ? Most of the answers were like JAVA is slow. performance is slow, Java doesn’t handle multi-threading properly ,We like pure functional programming and interpreted language, and so on.

But as a developers concern I never experienced any performance issue. I never wanted features like erasure of languages like javascript or multiple inheritance of C++ in java.. And these were requirements of JVM changes and implementations of java. These were not in my domain as a normal java developer .

So here are the list of things that I don’t like much but will want improvements in them.

  1. As a beginner every one starts with System.out.print(“ Hello World”) . We use it most of the times as well. I would have liked it more if a static print() method existed in Object.class only so that I can call print() method directly from all classes like any other languages instead of writing such a long syntax for it.
  2. java.lang package have all the types of classes present in it. As java.lang is imported automatically , so all the necessary classes are present in java.lang package without proper packaging . Boxed classes, exceptions, Errors, System, enums, so many different classes are present in same package. I would have liked it more if there were arranged properly , as it is the most imported package.
  3. This packaging issue took my attention to another thing related to importing , and i.e is import com.xyz.* this will only import only classes present in the given package. It won’t automatically import all the sub-packages and their classes for me.
  4. One more thing I don’t like about java is converting one data type into others. Ex. from float to int → int a = (int) 3.14;
    from String to int → int a = Integer.parseInt(“3”);
    from BigDecimal to int → int a = new BigDecimal(“3.14”).intValue();
    and so on. I would have liked it more if java had only some common method like p.toIntValue() .
  5. One more main thing I really hated about java is that , we can write
    Object a = new String (“abc”) , but for generics typecasting we can’t write it the same. Ex we can’t write ArrayList<Object> arr = new ArrayList<String>(); Compiler won’t allow me to go ahead, even though I and compiler both know all string are objects.
  6. When lambda operator got introduced in java, I was really excited and eager to use it and learn it . But After some time I came to know that debugging is quite hard in lambda. I tried to put debugger in .filter() or .foreach() , etc. Even though these things were getting called multiple times I was getting much difficulties to set proper debugger point in java IDE.

These are the some things I didn’t like much about Java as a developers point of view. But at the end I will always be great fan of java and java technologies.

Feel free to comment if you also feel the same of these points.

--

--