Oops! Moments That Give Every Java Developer Goosebumps!
SoftwareNovember 29, 2012Written by Steve Graham930 views
Whether you are new to Java or you have been a Java enterprise development pro, and know Java like the back of your hand, there will be moments when you will definitely commit mistakes. To err is human, and guess what? There are several others around, who are making the same errors as you, time and again. Here’s a comprehensive list of some oops moments that every Java developer has to face at least once in his development career.
1. Null Pointers!
Null pointers account for the most common errors committed by Java programmers. And, since they appear at the runtime, the compilers can’t rectify them for you. If you don’t discover it in time, your users certainly will. As and when you try to access some object whose reference is null, the application will encounter a NullPointerException. The reason for initiation of null pointers may vary from program to program, but generally it means that either you have not checked the return value of an object or you have not initialized the object. The only solution to rectify or avoid Null Pointers in your code is to check before you attempt to access a null variable in an array.
2. Forgetting Java’s Zero-Indexed Nature:
If you have been programming with C/C++ for a while, you must be aware with the concept of zero-index value. Arrays in Java are zero-indexed. This means, the value of the very first element of every index is zero. The prime area, where forgetting zero indexing can get you in trouble, is with strings. You can get stuck in some really frustrating situations, especially if you are writing applications that include string processing. You may be working with the wrong character or may get several exceptions at run time. The only way to deal with zero-indexing issue is to refer to your API documentation.
3. Capitalization Errors:
Capitalization is probably amongst the most commonly committed development errors. Often we look at a variable again and again to spot the error, but easily skip the non-capitalized methods or variables, unable to get hold of the problematic part. This error can easily confuse you as you know that the concerned variable or method does exist, but you are not able to spot the lack of capitalization. Though, there isn’t any golden rule to combat this error, keeping in mind the following pointers can help you commit less of these:
a. wherever a new word begins, all member variables and methods use capitalization
b. in Java API, all member variables and methods begin with lowercase letters
4. Using == Instead of .Equals:
Most developers often get perplexed when it comes to using == and .equals in a Java enterprise development program. While writing a Java program, using == means you are comparing two references to see whether they are pointing towards the same object or not. You cannot use == operator for comparing two objects for equality. Instead, to check for equality, you can use .equals method, as it is inherited by all classes present in the Java language.
Java programming is just like a roller-coaster ride- you have your highs and lows. How you tackle the lows, determines how high you will move in your venture.
About the Author
Further Reading
Article
How Do Cloud Migration Consulting Services Control Run Rate?
Overruns come from unmodeled egress, deferred re-architecture, and no FinOps after cutover. Judge migration consulting on the 12-month run rate, not go-live.
September 29, 2026
Website
Software Development Company in the UK
Hidden Brains is a UK-based software development company with over 23 years of experience delivering web application development, mobile app development, and custom software solutions to businesses across the UK.
September 17, 2026
Website
Hrms- Hr Software
Phi EDGE (Phi EDGE HR Tech Pvt. Ltd.) is an ISO/IEC 27001:2022 certified HR technology, consulting, and talent solutions provider headquartered in Pune, Maharashtra, India. The company operates on a "Consulting + Software" model, delivering an integrated ecosystem designed to manage the end-to-end employee lifecycle.
September 16, 2026
Website
GraveiensAi
The human-data partner that de-risks your AI programme.
September 13, 2026