Two bad practices you must avoid in java

Akshitha Shetty
Jun 19, 2021

Recently i was scanning code using coverity, was amazed to see few bad practices will impact performance of your application.If you never heard or used coverity, will write my article on “How to install and use coverity”.

  1. Stop using + operator and start using concat() method while concatenating string. you must be thinking why should i do that,I’m very much comfortable using + operator. concat() method is better than + operator because it creates a new object only when the string length is greater than zero, so it uses less amount of memory.
  2. Stop returning data in method and start using void in method if returned data is not required. It happens that many time we write a method with return value and returned value not required this will impact performance of application.

Thank you

Akshitha H

--

--

Akshitha Shetty

Software developer, feminist,exploring new technologies