I don’t think there is something like MISRA C / C ++ best practices for Java, and I think it is also less necessary with a language like Java because it doesn’t have many undefined or unspecified angles like C and C ++. Functions such as the absence of explicit pointers in Java and the fact that the bounds of array indices are always checked by the runtime make Java safer than C or C ++.
There is a common coding standard that most Java developers seem to have: Code conventions for the Java programming language , but this is more a style guide than a best practice guide.
There are several good and well-known tools for analyzing static code in Java: FindBugs and PMD , which checks your code for possible dangerous constructs or bad methods.
If you want to learn about potential traps in Java, it is recommended that you use two books: Effective Java and Java Puzzlers .
source share