Java Naming Conventions are several points to remember about identifiers. All the classes, interfaces, packages, methods and fields of Java are given according to Java naming convention.

Naming Conventions Rule in Java

The most important rule of Naming Convention in Java Programming Language.

Class Name

In class name each first letter start with capital letter and rest words will be in small letter. It should be a noun. It is Use appropriate words, instead of acronyms.

Interface Name

In Interface name each first letter start with capital letter and rest words will be in small letter. It should be an adjective. It is Use appropriate words, instead of acronyms.

Method Name

In method name, first word will be small letters and rest words first letter will be capital and rest letter will be small. It should be a verb.

Variable Name

In variable name, first word will be small letters and rest words first letter will be capital and rest letter will be small. It should not start with the special characters and Avoid using one-character variables.

Package Name

In Pack name should be a lowercase letter. If the name contains multiple words, it should be separate by dots (.).

Constant Name

In Constant name should be in uppercase letters. If the name contains multiple words, it should be separate by an underscore(_). It may contain digits but not as the first letter.

Java Program Syntax

Class name
{ 
  Public static void main ( string arg[])
  {
 	------
        -----
  }
}
Syntax of Java program

Name:- It is class name provided by user . it may be capital, small or mixed letters or by following class naming convention rule.

Public:- main() always be public because accessible outside.

Static:- occupy a memory which is used every time of running the program.

Void:- It is keyword not data type, that returns nothing.

String:- pre-defined class used for string value.

Args:-  it is object of string class that refers command line arguments.

Saving java program

Java program may be saved with class name having extension .java, It is a compulsory.

First Java Program | Hello World

Input Value

public class hello {
        public static void main(String args[]){  
         System.out.println("Hello World");  
        }  
    
}
First Java Program

Let’s Run the code

Input Value

Output Value

Output Value

If you have any queries regarding this article or if I have missed something on this topic, please feel free to add in the comment down below for the audience. See you guys in another article.

To know more about JAVA Wikipedia please click here .

Stay Connected Stay Safe, Thank you


Basic Engineer

Hey Readers! We have more than fifteen years of experience in Software Development, IoT, Telecom, Banking, Finance and Embedded domain. Currently we are actively working on Data Science, ML and AI with multiple market leaders worldwide. Happy Reading. Cheers!

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *