Skip to main content

Coding Standards In Java

 Coding Standards for Components: It is recommended to write components name by its purpose. This approach improves the readability and maintainability of code.

Coding Standards for Classes: Usually class name should be noun starting with uppercase letter. If it contains multiple word than every inner word should start with uppercase.

Eg: String, StringBuffer, Dog

Coding Standards for Interface: Usually interface name should be adjective starting with uppercase letter. If it contains multiple word than every inner word should start with uppercase.

Eg: Runnable, Serializable, Comparable

Coding Standards for Methods: Usually method name should either be verb or verb noun combination starting with lower letter. If it contains multiple word than every inner word should start with uppercase.

Eg: print(), sleep(), setSalary()

Coding Standards for Variables: Usually variable name should be noun starting with lowercase letter. If it contains multiple word than every inner word should start with uppercase.

Eg: name, age. mobileNumber

Coding Standards for Constants: Usually constant name should be noun. It should contain only uppercase If it contains multiple word than words are separated with ( _ ) underscore symbol. Usually we declare constants with public static and final modifiers.

Java Bean Coding Standards: A Java Bean is a simple java class with private properties and public getter and setter methods

Getter Methods:

It should be public method

Method name should be prefixed with “get”

It should not take any argument

Setter Methods:

It should be public method

Return Type should be void

Method name should be prefixed with “set”

It should take some argument

public class StudentBean{

private String name;

public void setName(String name){

this.name=name;

}

public String getName(){

return name;

}

}

Note: For boolean properties getter method can be prefixed with “get” or “is”

Comments

Popular posts from this blog

How I Cracked 3 Job Offers as a Java Developer – My Journey & Key Strategies

 Job hunting can be overwhelming, especially when you’re aiming for a great opportunity that matches your experience and skills. As a Java developer with nearly six years of experience, I recently went through multiple interview processes and ended up receiving six job offers. It wasn’t luck—it was a mix of strategy, preparation, and the right mindset. In this blog, I’ll share my approach, preparation techniques, and lessons learned to help you navigate your job search and ace your interviews. 1. The Turning Point: Why I Started Looking for a Change Like many professionals, I reached a phase where I wanted career growth, better compensation, and challenging projects. While my experience was strong, I realized that just having skills wasn’t enough—I needed to present them effectively in interviews. 2. Building the Right Mindset for Job Hunting Before diving into job applications, I focused on three key aspects: Confidence: Believing in my experience and technical expertise. Clarity:...

The Mysterious Journey of Astronaut Sunita Villms: A Struggle Between Earth and the Unknown

 Astronaut Sunita Williams and her colleague, Barry "Butch" Wilmore, recently returned to Earth after an unexpected nine-month mission aboard the International Space Station (ISS). Originally scheduled for a brief eight-day stay, their mission was extended due to technical issues with the Boeing Starliner spacecraft, leading to a prolonged 286-day duration in space.  Mission Extension and Challenges The mission's extension was primarily due to propulsion problems with the Starliner craft, necessitating their continued presence on the ISS. This unforeseen prolongation presented both physical and psychological challenges for the astronauts. Prolonged exposure to microgravity can lead to muscle atrophy, bone density loss, and other health concerns. To mitigate these effects, astronauts adhere to rigorous exercise regimens while aboard the station.  Health Observations Upon Return Upon their return, noticeable physical changes were observed, particularly with Sunita Williams,...

Ace Your Java Interview: Top 50 Java Interview Questions & Answers (2025)

  Introduction Java continues to be a top programming language in 2025 , widely used in enterprise applications, microservices, cloud computing, and AI-based systems . If you're preparing for a Java developer interview , you must be well-versed in Core Java, Java 8-21 features, Spring Boot, Microservices, and Cloud technologies . This guide covers the top 50 Java interview questions for freshers and experienced professionals , ensuring you are ready for your next interview! Table of Contents Core Java Interview Questions Java 8, Java 11, and Java 21 Features OOP and Design Patterns Multithreading and Concurrency JVM, Garbage Collection & Memory Management Collections Framework Spring Boot & Microservices Cloud Technologies (AWS, Azure, GCP) Real-World Java Interview Scenarios 1. Core Java Interview Questions Q1: What are the key features of Java? Answer: Platform Independence – Java runs on JVM , making it OS-independent. Object-Oriented – Java follows...