Coding Standards

1) Explain Java Coding Standards for classes or Java coding conventions for classes?

Sun has created Java Coding standards or Java Coding Conventions . It is recommended highly to follow java coding standards.

Classnames should start with uppercase letter. Classnames names should be nouns. If Class name is of multiple words then the first letter of inner word must be capital letter. Ex : Employee, EmployeeDetails, ArrayList, TreeSet, HashSet

2) Explain Java Coding standards for interfaces?

  1. Interface should start with uppercase letters
  2. Interfaces names should be adjectives Example : Runnable, Serializable, Marker, Cloneable

3) Explain Java Coding standards for Methods?

  1. Method names should start with small letters.
  2. Method names are usually verbs
  3. If method contains multiple words, every inner word should start with uppercase letter. Ex : toString()
  4. Method name must be combination of verb and noun Ex : getCarName(),getCarNumber()

4) Explain Java Coding Standards for variables ?

  1. Variable names should start with small letters.
  2. Variable names should be nouns
  3. Short meaningful names are recommended.
  4. If there are multiple words every innerword should start with Uppecase character. Ex : string,value,empName,empSalary

5) Explain Java Coding Standards for Constants?

Constants in java are created using static and final keywords.

  1. Constants contains only uppercase letters.
  2. If constant name is combination of two words it should be separated by underscore.
  3. Constant names are usually nouns. Ex:MAX_VALUE, MIN_VALUE, MAX_PRIORITY, MIN_PRIORITY

6) What does null mean in java?

When a reference variable doesn’t point to any value it is assigned null. Example : Employee employee;

In the above example employee object is not instantiate so it is pointed no where

Advanced

1) What is the role of Security Manager in JVM?

The Security Manager is a component of JVM that is responsible for enforcing the security policies of a Java program. It can be used to restrict access to system resources, such as the file system, network connections, and other sensitive areas of the system.

2) What is the role of Bootstrap ClassLoader in JVM?

The Bootstrap ClassLoader is the parent of all ClassLoaders in JVM. It is responsible for loading the core classes of the Java API, such as java.lang, java.util, and java.io. These classes are loaded from the rt.jar file, which is located in the JRE’s lib directory.

3) How does JVM handle the memory management?

JVM handles memory management through a combination of techniques such as Garbage Collection, stack and heap memory allocation. It automatically manages the allocation and de-allocation of memory for objects and ensures that the program does not run out of memory.

4) What is the role of PermGen in JVM?

PermGen (Permanent Generation) is a memory space in JVM that is used to store class and method level structure of a program. It stores the class level structure, method level structure, and constant pool of the class.

5) What is the role of CodeCache in JVM?

CodeCache is a memory space in JVM that is used to store the native machine code generated by the JIT compiler. The JIT compiler generates native machine code at runtime and stores it in the CodeCache. Subsequent executions of the same code can then use the native machine code instead of interpreting the bytecode, which improves performance.

Questions? : Reach Out