0% found this document useful (0 votes)
0 views

3.Structure O FJava Program

The document provides an overview of Java program structure and various ways to write the main method. It also outlines naming conventions for variables, class names, method names, interface names, constants, and packages in Java. These conventions are intended to enhance readability and understanding of programming concepts.

Uploaded by

G.Chandra Shekar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

3.Structure O FJava Program

The document provides an overview of Java program structure and various ways to write the main method. It also outlines naming conventions for variables, class names, method names, interface names, constants, and packages in Java. These conventions are intended to enhance readability and understanding of programming concepts.

Uploaded by

G.Chandra Shekar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

SSSIT Computer Education

Besides R.S.Brothers Show Room


KPHB-Hyderabad. Java Online Training
Java
Structure of Java Program
[package <packagename>]
[import <packagename>]
[modifiers] <class> <ClassName>
{
public static void main(String args[ ])
{ statement(s); }
}

Alternative ways for writing main method :


public static void main(String [ ]args)
{ statement(s); }

public static void main(String[ ] args)


{ statement(s); }

public static void main(String shashi[ ])


{ statement(s); }

public static void main(String...x)


{ statement(s); } ... [Varargs]

static public void main(String args[ ])


{ statement(s); }

public static final void main(String args[ ])


{ statement(s); }

public static synchronized void main(String args[ ])


{ statement(s); }

public static final synchronized


void main(String args[]) { statement(s); }

1|Page
SSSIT Computer Education
Besides R.S.Brothers Show Room
KPHB-Hyderabad. Java Online Training
Java
Naming Convention of Java Language :
Actually we can write any identifiers in our own style by following identifiers rules,But
SUN Micro system given some naming conventions for understanding programming
concepts easy.
For Variables :
These are suggested to write with nouns
These are suggested to write in lower case letters
Eg: int sno; String sname,city;

For Class Names :


These are suggested to write with noun related words, The Starting Letter of each word
should be written in Capital Letters
Eg: Employee,
EmployeeSalaryInfomation
For Method Names :
These are suggested to write with verb related words, The starting letter should be
lowercase,If the names are having more the one word length starting letter of each word
from the second should be capital
Eg: start( ), stop( ), sleep( ), setMaxAge( ),getMaxAge( )….

For Interface Names:


These are suggested to write with Adjectives, The starting letter of each word should be
capital
Eg: Cloneable, Serializable,Runnable….
For Constants:
These are suggested to write with Noun related words , These are suggested to write in
capital letters, if it is having more than one word length then they should be separated
with an under scroll
Eg: PI, E, MAX_PRIORITY,MIN_PRIORITY…
For Packages are suggested to write with lowercase letters
2|Page

You might also like