SlideShare a Scribd company logo
JAVA Coding Style & Tips
Meaningful Names
• A good developer is careful to choose meaningful variable names.
Good Writing Not Good Writing
int radius; int r;
String gender; String gen;
Circle myCircle; Circle MyCircle;
int width; int widt;
• JAVA has key
words or reserved
words. An
identifier cannot
be the same as a
key word.
Code writing style
• Good program developers adhere to the following standards.
◦ Always include class documentation.
◦ Class name starts with upper-case letters.
◦ Variables name starts with lower-case letters.
◦ Align { and matching } in same column.
◦ Indent methods and statements.
◦ Use meaningful variable names.
◦ Use camelNotation.
Code Writing Style
• Some people prefer this arrangement of { and }
• It makes debugging and reading easier.
public class HelloWorld
{
public static void main (String[] args)
{
System.out.println(“Hello, World!”);
}
}
Some Remarks About JAVA Datatypes
• For calculations – like in math or physics class – use type double. It is the most accurate type
in JAVA.
• If you need to count things or controls loops use type int. Use long if you need to count a big
number of things.
• The type char basically represents an individual ASCII character.
• Type boolean can take on the values “true” or “false.”
Thank You

More Related Content

PDF
Data types in Java
PPTX
Coding standards and guidelines
PDF
Style & Design Principles 01 - Code Style & Structure
PPTX
Week 2: Getting Your Hands Dirty – Part 2
PPT
Best Practices of Software Development
PPTX
Writing Clean Code (Recommendations by Robert Martin)
PPTX
Coding conventions
PPTX
12.6-12.9.pptx
Data types in Java
Coding standards and guidelines
Style & Design Principles 01 - Code Style & Structure
Week 2: Getting Your Hands Dirty – Part 2
Best Practices of Software Development
Writing Clean Code (Recommendations by Robert Martin)
Coding conventions
12.6-12.9.pptx

Similar to Coding Style & Tips for JAVA (20)

PPTX
flowchart demasdasddasdsadsadsadasoasd.pptx
PPTX
Lec 1.3 Object Oriented Programming
PPTX
c# keywords, identifiers and Naming Conventions
PPTX
L2 datatypes and variables
PPTX
WordPress Coding Standards & WP Hooks
PPTX
Java fundamentals
PDF
L2 C# Programming Comments, Keywords, Identifiers, Variables.pdf
PPTX
C Programming Lecture 3 - Elements of C.pptx
PPT
Codings Standards
PPTX
Lecture-3.pptx and faculty. His research interests include RF sensing,
PPTX
Javascript Programming according to Industry Standards.pptx
PPT
learn JAVA at ASIT with a placement assistance.
PPTX
Note for Java Programming////////////////
PPTX
Clean code
PDF
PROGRAMMING IN C UNIT II.pdfFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
PDF
Game Programming 04 - Style & Design Principles
PPTX
PPTX
CSE 1201: Structured Programming Language
PPT
Md03 - part3
PPT
Csharp
flowchart demasdasddasdsadsadsadasoasd.pptx
Lec 1.3 Object Oriented Programming
c# keywords, identifiers and Naming Conventions
L2 datatypes and variables
WordPress Coding Standards & WP Hooks
Java fundamentals
L2 C# Programming Comments, Keywords, Identifiers, Variables.pdf
C Programming Lecture 3 - Elements of C.pptx
Codings Standards
Lecture-3.pptx and faculty. His research interests include RF sensing,
Javascript Programming according to Industry Standards.pptx
learn JAVA at ASIT with a placement assistance.
Note for Java Programming////////////////
Clean code
PROGRAMMING IN C UNIT II.pdfFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Game Programming 04 - Style & Design Principles
CSE 1201: Structured Programming Language
Md03 - part3
Csharp
Ad

More from SAGARDAVE29 (12)

PPTX
Graphical User Interface (GUI)
PPTX
ArrayList in JAVA
PPTX
Exception Handling
PPTX
JAVA Multithreading
PPTX
Stack & Queue
PPTX
ArrayList in JAVA
PPTX
Threads in JAVA
PPTX
Exception handling
PPTX
More oop in java
PPTX
Some Important Methods in JAVA
PPTX
Recursion
PPTX
Inheritance & Polymorphism
Graphical User Interface (GUI)
ArrayList in JAVA
Exception Handling
JAVA Multithreading
Stack & Queue
ArrayList in JAVA
Threads in JAVA
Exception handling
More oop in java
Some Important Methods in JAVA
Recursion
Inheritance & Polymorphism
Ad

Recently uploaded (20)

PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Classroom Observation Tools for Teachers
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
RMMM.pdf make it easy to upload and study
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Institutional Correction lecture only . . .
PDF
Pre independence Education in Inndia.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Pharma ospi slides which help in ospi learning
PPTX
master seminar digital applications in india
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
VCE English Exam - Section C Student Revision Booklet
Classroom Observation Tools for Teachers
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
TR - Agricultural Crops Production NC III.pdf
Renaissance Architecture: A Journey from Faith to Humanism
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
O7-L3 Supply Chain Operations - ICLT Program
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
RMMM.pdf make it easy to upload and study
Microbial diseases, their pathogenesis and prophylaxis
PPH.pptx obstetrics and gynecology in nursing
Complications of Minimal Access Surgery at WLH
Institutional Correction lecture only . . .
Pre independence Education in Inndia.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
Pharma ospi slides which help in ospi learning
master seminar digital applications in india
2.FourierTransform-ShortQuestionswithAnswers.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025

Coding Style & Tips for JAVA

  • 2. Meaningful Names • A good developer is careful to choose meaningful variable names. Good Writing Not Good Writing int radius; int r; String gender; String gen; Circle myCircle; Circle MyCircle; int width; int widt;
  • 3. • JAVA has key words or reserved words. An identifier cannot be the same as a key word.
  • 4. Code writing style • Good program developers adhere to the following standards. ◦ Always include class documentation. ◦ Class name starts with upper-case letters. ◦ Variables name starts with lower-case letters. ◦ Align { and matching } in same column. ◦ Indent methods and statements. ◦ Use meaningful variable names. ◦ Use camelNotation.
  • 5. Code Writing Style • Some people prefer this arrangement of { and } • It makes debugging and reading easier. public class HelloWorld { public static void main (String[] args) { System.out.println(“Hello, World!”); } }
  • 6. Some Remarks About JAVA Datatypes • For calculations – like in math or physics class – use type double. It is the most accurate type in JAVA. • If you need to count things or controls loops use type int. Use long if you need to count a big number of things. • The type char basically represents an individual ASCII character. • Type boolean can take on the values “true” or “false.”