If you write Java code and also like mercy for future you and your teammates then comments matter. Java has three comment styles and each one has a job. Use the right one and your code will look like it has its life together. Use the wrong one and your repo will be a crime scene.
Start with two slashes and keep it short. Single line comments are perfect for tiny notes right above a tricky expression or for flagging a temporary hack that needs cleanup.
// Validate user input before parsing
int parsed = Integer.parseInt(someString)
Wrapped with slash star and star slash these are for multi line context. Use them to explain an algorithm rationale or to group several lines of commentary without repeating slashes.
/*
This algorithm uses a simple heuristic that fails only on extremely rare cases
Use when the why matters more than the what
*/
Javadoc comments start with slash star star and star slash and they fuel generated documentation. Put Javadoc on public classes and methods that other developers or tools will read.
/**
* Add two numbers
* @param a first number
* @param b second number
* @return sum
*/
public int add(int a, int b) { return a + b }
Single line comments for quick hints and warnings near complex logic. Block comments for context heavy explanations that need a few lines to breathe. Javadoc for public APIs method level behavior and expectations so tools and humans both get less confused.
Remember the three comment types single line block and Javadoc Each one has a role Use them wisely and keep your codebase readable and maintainable. And if you ever feel like leaving a passive aggressive note in the code try a GIF in the team chat instead
I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!
This is a dedicated watch page for a single video.