SlideShare a Scribd company logo
1 of 6
Download to read offline
NAMING CONVENTIONS
COURCE CODE#CSC241
ASSIGNMENT#3
SUBMITTED TO: SIR SHAFIQ AHMED
SUBMITTED BY: NADEEM AHMED
Roll No# SP19-MCS-016
NAMING CONVENTIONS
1 | P a g e
Contents
❖ Java Naming conventions .....................................................................................................................2
➢ Advantages of naming conventions in java ..........................................................................................2
1. Class .............................................................................................................................................2
Example: -.................................................................................................................................................2
2. Interface.......................................................................................................................................3
Example: -.................................................................................................................................................3
3. Method .........................................................................................................................................3
Example:-..................................................................................................................................................3
4. Variable........................................................................................................................................4
Example:-..................................................................................................................................................4
5. Package ........................................................................................................................................4
Example:-..................................................................................................................................................4
6. Constant.......................................................................................................................................5
Example:-..................................................................................................................................................5
❖ Camel-Case in java naming conventions..............................................................................................5
NAMING CONVENTIONS
2 | P a g e
❖ Java Naming conventions
In java naming convention are rules to follow and define the name of your identifiers such as
(class, package, variable, constant, method, etc.)
In above all the identifiers of Java programming language are given according to the Java
naming convention.
➢Advantages of naming conventions in java
By using Java naming conventions, you make your code easy to readable for yourself and
other programmers. Readability of Java program is very important.
There are following the key rules that must be followed by every identifier:
• The name must start with alphabets.
• The name should not start with special characters like & dollar ($), underscore ( _ )
Now the rules that must be followed by identifiers are as follows:
1.Class
• A class start with the uppercase letter.
• It should be a noun such as Student, Button, System, Thread, etc.
• Use appropriate words, instead of acronyms.
Example: -
1. public class Student
2. {
3. //code
4. }
NAMING CONVENTIONS
3 | P a g e
2.Interface
• It should start with the uppercase letter.
• It should be an adjective such as Runnable, Remote, and Action Listener.
• Use appropriate words, instead of acronyms.
Example: -
1. interface Printable
2. {
3. //code
4. }
3.Method
• It should start with lowercase letter.
• In java method are as main(), print(), println().
• If the name contains multiple words, starts it with a lowercase letter followed by an
uppercase letter such as action Performed ().
Example:-
1. class Human
2. {
3. //method
4. void draw()
5. {
6. //code
7. }
8. }
NAMING CONVENTIONS
4 | P a g e
4.Variable
• A variable must start with a lowercase letter such as id, name.
• It should not start with the special characters like & (ampersand), $ (dollar), _
(underscore).
• If the name contains multiple words, start it with the lowercase letter followed by an
uppercase letter such as first Name, last-named.
Example:-
1. Class Animal
2. {
3. //variable
4. int id;
5. //code
6. }
5.Package
1. It should be a lowercase letter such as java, Lang.
2. If the name contains multiple words, it should be separated by dots (.) such as
java.util, java. Lang.
Example:-
package javatpoint.com; //package
1. class Employee
2. {
3. //code
4. }
NAMING CONVENTIONS
5 | P a g e
6.Constant
• It should be in uppercase letters such as BLUE, GREEN.
• When the name consist of two or more parts than it should be separated by an underscore
( _ ) such as FIRST_NAME.
• First letter not be a letter.
Example:-
1. class Employee
2. {
3. //constant
4. static int MIN_AGE = 21;
5. //code
6. }
❖ Camel-Case in java naming conventions
Java also follows Camel-Case syntax for naming the identifiers. If the name is combination of
two words, the second word will start with uppercase letter always such as First-Name, Second-
Name etc.

More Related Content

Similar to JAVA Naming Conventions By NADEEM AHMED FROM DEPALPUR

Similar to JAVA Naming Conventions By NADEEM AHMED FROM DEPALPUR (12)

Naming standards and basic rules in .net coding
Naming standards and basic rules in .net codingNaming standards and basic rules in .net coding
Naming standards and basic rules in .net coding
 
Coding standard
Coding standardCoding standard
Coding standard
 
Clean Code Principles
Clean Code PrinciplesClean Code Principles
Clean Code Principles
 
Features of java technology
Features of java technologyFeatures of java technology
Features of java technology
 
Coding standards php
Coding standards phpCoding standards php
Coding standards php
 
Android course session 3 ( OOP ) part 1
Android course session 3 ( OOP ) part 1Android course session 3 ( OOP ) part 1
Android course session 3 ( OOP ) part 1
 
Standard coding practices
Standard coding practicesStandard coding practices
Standard coding practices
 
SYSTEM DEVELOPMENT
SYSTEM DEVELOPMENTSYSTEM DEVELOPMENT
SYSTEM DEVELOPMENT
 
Coding guideline
Coding guidelineCoding guideline
Coding guideline
 
Coding standard
Coding standardCoding standard
Coding standard
 
Computer programming 2 chapter 1
Computer programming 2  chapter 1Computer programming 2  chapter 1
Computer programming 2 chapter 1
 
OOPSCA1.pptx
OOPSCA1.pptxOOPSCA1.pptx
OOPSCA1.pptx
 

More from NA000000

More from NA000000 (17)

Jumps in Assembly Language.
Jumps in Assembly Language.Jumps in Assembly Language.
Jumps in Assembly Language.
 
Line Of Code(LOC) In Software Engineering By NADEEM AHMED FROM DEPALPUR
Line Of Code(LOC) In Software Engineering By NADEEM AHMED FROM DEPALPURLine Of Code(LOC) In Software Engineering By NADEEM AHMED FROM DEPALPUR
Line Of Code(LOC) In Software Engineering By NADEEM AHMED FROM DEPALPUR
 
Critical Path Method In Software Engineering By NADEEM AHMED
Critical Path Method In Software Engineering By NADEEM AHMED Critical Path Method In Software Engineering By NADEEM AHMED
Critical Path Method In Software Engineering By NADEEM AHMED
 
COCOMO Modal In Software Engineering By NADEEM AHMED
COCOMO Modal In Software Engineering By NADEEM AHMED COCOMO Modal In Software Engineering By NADEEM AHMED
COCOMO Modal In Software Engineering By NADEEM AHMED
 
LEGACY SYSTEM In Software Engineering By NADEEM AHMED
LEGACY SYSTEM In Software Engineering By NADEEM AHMED LEGACY SYSTEM In Software Engineering By NADEEM AHMED
LEGACY SYSTEM In Software Engineering By NADEEM AHMED
 
Modal Driven Architecture In Software Engineering By NADEEM AHMED
Modal Driven Architecture In Software Engineering By NADEEM AHMED Modal Driven Architecture In Software Engineering By NADEEM AHMED
Modal Driven Architecture In Software Engineering By NADEEM AHMED
 
Software Testing By NADEEM AHMED FROM DEPALPUR
Software Testing By NADEEM AHMED FROM DEPALPURSoftware Testing By NADEEM AHMED FROM DEPALPUR
Software Testing By NADEEM AHMED FROM DEPALPUR
 
Software Inspection By NADEEM AHMED FROM DEPALPUR
Software Inspection By NADEEM AHMED FROM DEPALPURSoftware Inspection By NADEEM AHMED FROM DEPALPUR
Software Inspection By NADEEM AHMED FROM DEPALPUR
 
Cleanroom Software Engineering By NADEEM AHMED FROM DEPALPUR
Cleanroom Software Engineering By NADEEM AHMED FROM DEPALPURCleanroom Software Engineering By NADEEM AHMED FROM DEPALPUR
Cleanroom Software Engineering By NADEEM AHMED FROM DEPALPUR
 
UML Diagrams By NADEEM AHMED FROM DEPALPUR
UML Diagrams By NADEEM AHMED FROM DEPALPURUML Diagrams By NADEEM AHMED FROM DEPALPUR
UML Diagrams By NADEEM AHMED FROM DEPALPUR
 
Biometrics
BiometricsBiometrics
Biometrics
 
Computer Networks By NADEEM AHMED
Computer Networks By NADEEM AHMED Computer Networks By NADEEM AHMED
Computer Networks By NADEEM AHMED
 
Cloud computing by NADEEM AHMED
Cloud computing by NADEEM AHMEDCloud computing by NADEEM AHMED
Cloud computing by NADEEM AHMED
 
Iot proposal by nadeem ahmed
Iot proposal by nadeem ahmedIot proposal by nadeem ahmed
Iot proposal by nadeem ahmed
 
Biomatric
BiomatricBiomatric
Biomatric
 
Assignment#1
Assignment#1Assignment#1
Assignment#1
 
Project proposal oop
Project proposal oopProject proposal oop
Project proposal oop
 

Recently uploaded

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Recently uploaded (20)

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 

JAVA Naming Conventions By NADEEM AHMED FROM DEPALPUR

  • 1. NAMING CONVENTIONS COURCE CODE#CSC241 ASSIGNMENT#3 SUBMITTED TO: SIR SHAFIQ AHMED SUBMITTED BY: NADEEM AHMED Roll No# SP19-MCS-016
  • 2. NAMING CONVENTIONS 1 | P a g e Contents ❖ Java Naming conventions .....................................................................................................................2 ➢ Advantages of naming conventions in java ..........................................................................................2 1. Class .............................................................................................................................................2 Example: -.................................................................................................................................................2 2. Interface.......................................................................................................................................3 Example: -.................................................................................................................................................3 3. Method .........................................................................................................................................3 Example:-..................................................................................................................................................3 4. Variable........................................................................................................................................4 Example:-..................................................................................................................................................4 5. Package ........................................................................................................................................4 Example:-..................................................................................................................................................4 6. Constant.......................................................................................................................................5 Example:-..................................................................................................................................................5 ❖ Camel-Case in java naming conventions..............................................................................................5
  • 3. NAMING CONVENTIONS 2 | P a g e ❖ Java Naming conventions In java naming convention are rules to follow and define the name of your identifiers such as (class, package, variable, constant, method, etc.) In above all the identifiers of Java programming language are given according to the Java naming convention. ➢Advantages of naming conventions in java By using Java naming conventions, you make your code easy to readable for yourself and other programmers. Readability of Java program is very important. There are following the key rules that must be followed by every identifier: • The name must start with alphabets. • The name should not start with special characters like & dollar ($), underscore ( _ ) Now the rules that must be followed by identifiers are as follows: 1.Class • A class start with the uppercase letter. • It should be a noun such as Student, Button, System, Thread, etc. • Use appropriate words, instead of acronyms. Example: - 1. public class Student 2. { 3. //code 4. }
  • 4. NAMING CONVENTIONS 3 | P a g e 2.Interface • It should start with the uppercase letter. • It should be an adjective such as Runnable, Remote, and Action Listener. • Use appropriate words, instead of acronyms. Example: - 1. interface Printable 2. { 3. //code 4. } 3.Method • It should start with lowercase letter. • In java method are as main(), print(), println(). • If the name contains multiple words, starts it with a lowercase letter followed by an uppercase letter such as action Performed (). Example:- 1. class Human 2. { 3. //method 4. void draw() 5. { 6. //code 7. } 8. }
  • 5. NAMING CONVENTIONS 4 | P a g e 4.Variable • A variable must start with a lowercase letter such as id, name. • It should not start with the special characters like & (ampersand), $ (dollar), _ (underscore). • If the name contains multiple words, start it with the lowercase letter followed by an uppercase letter such as first Name, last-named. Example:- 1. Class Animal 2. { 3. //variable 4. int id; 5. //code 6. } 5.Package 1. It should be a lowercase letter such as java, Lang. 2. If the name contains multiple words, it should be separated by dots (.) such as java.util, java. Lang. Example:- package javatpoint.com; //package 1. class Employee 2. { 3. //code 4. }
  • 6. NAMING CONVENTIONS 5 | P a g e 6.Constant • It should be in uppercase letters such as BLUE, GREEN. • When the name consist of two or more parts than it should be separated by an underscore ( _ ) such as FIRST_NAME. • First letter not be a letter. Example:- 1. class Employee 2. { 3. //constant 4. static int MIN_AGE = 21; 5. //code 6. } ❖ Camel-Case in java naming conventions Java also follows Camel-Case syntax for naming the identifiers. If the name is combination of two words, the second word will start with uppercase letter always such as First-Name, Second- Name etc.