SlideShare a Scribd company logo
IT ANDROID APP
JAVA SYNTAX AND
GRAMMARS
YOUR FIRST PROGRAM
BASIC GRAMMARS
About Java programs, it is very important to keep in mind
the following points.
 Case Sensitivity- Java is a case-sensitive
language, which means that the upper or lower case of
letters in your Java programs matter.
CASE SENSITIVITY
 Case sensitivity enforces capital or lower case in the
text. For example, suppose you have created three
variables called "endLoop", "Endloop", and "EndLoop".
Even though these variables are composed of the
exact same letters in the same exact order, Java does
not consider them equal. It will treat them all differently.
JAVA RESERVED WORD
LIST
RESERVED WORD LIST
Reserved words are words that cannot be
used as object or variable names in
a Java program because they're already used
by the syntax of the Java programming
language.
LIST OF RESERVED JAVA
KEYWORDS
abstract assert boolean break byte case
catch char class const continue default
double do else enum extends false
final finally float for goto if
implements import instanceof int interface long
native new null package private protected
public return short static strictfp super
switch synchroniz
ed
this throw throws transient
true try void volatile while
EXAMPLE:
JAVA NAMING
CONVENTIONS
JAVA NAMING CONVENTIONS
 A naming convention is a rule to follow as you decide
what to name your identifiers (e.g. class, package,
variable, method, etc.).
 Why Use Naming Conventions?
 Different java programmers can have different styles and
approaches to the way they program. By using standard Java
naming conventions they make their code easier to read for
themselves and for other programmers. Readability of Java
code is important because it means less time is spent trying to
figure out what the code does, leaving more time to fix or
modify it.
IDENTIFIERS
A Java identifier is a name given to a
package, class, interface, method, or
variable. It allows a programmer to refer
to the item from other places in the
program.
BASIC GRAMMARS
About Java programs, it is very important to keep in mind the
following points.
 Class Names − For all class names the first letter should
be in Upper Case. If several words are used to form a name
of the class, each inner word's first letter should be in Upper
Case.
 Class representing the name of a Java class. This class is
unable to changed, and can therefore be safely used by
multiple threads.
Example: class MyFirstJavaClass
CLASS NAME
BASIC GRAMMARS
About Java programs, it is very important to keep in mind
the following points.
 Method Names − All method names should start with
a Lower Case letter. If several words are used to form
the name of the method, then each inner word's first
letter should be in Upper Case.
Example: public void myMethodName()
METHOD NAME
WHAT ARE METHODS?
A method is a set of code which is referred to
by name and can be invoked at any point in a
program simply by utilizing the method's
name.
THERE ARE TWO BASIC TYPES OF
METHODS
Built-in: Build-in methods are part of the compiler
package, such as
System.out.println( ) and System.exit(0).
User-defined: User-defined methods are created by you,
the programmer. These methods take-on names that you
assign to them and perform tasks that you create.
BASIC GRAMMARS
About Java programs, it is very important to keep in mind
the following points.
 public static void main(String args[]) − Java
program processing starts from the main() method
which is a mandatory part of every Java program.
EXAMPLE:
JAVA IDENTIFIERS
IDENTIFIERS
A Java identifier is a name given to a
package, class, interface, method, or
variable. It allows a programmer to refer
to the item from other places in the
program.
Packages: in java it is a mechanism to
encapsulate a group of classes, sub
packages and interfaces
Classes: is a user-defined blueprint or prototype
from which objects are created. It represents the set
of properties or methods that are common to all
objects of one type. In general, class declarations can
include these components
 Interfaces: An interface is a completely "abstract
class" that is used to group related methods with
empty bodies:
 Methods: is a block of code which only runs when it is
called. You can pass data, known as parameters, into
a method. Methods are used to perform certain
actions, and they are also known as functions. Why
use methods? To reuse code: define the code once,
and use it many times.
PACKAGE
 Package in java is a mechanism to encapsulate a
group of classes, sub packages and interfaces
TYPES OF PACKAGES
 Built-in Packages
These packages consist of a large number of classes which
are a part of Java API.Some of the commonly used built-in
packages are
1) java.lang: Contains language support classes(e.g classed
which defines primitive data types, math operations). This
package is automatically imported.
2) java.io: Contains classed for supporting input / output
operations.
3) java.util: Contains utility classes which implement data
structures like Linked List, Dictionary and support ; for Date /
Time operations.
EXAMPLE OF JAVA.LANG
JAVA.IO
JAVA.UTIL
 User-defined packages
These are the packages that are defined by the user.
First we create a directory myPackage (name should
be same as the name of the package). Then create
the MyClass inside the directory with the first
statement being the package names.
CLASSES
 CLASS: A class is a user-defined blueprint or prototype from
which objects are created. It represents the set of properties or
methods that are common to all objects of one type. In general,
class declarations can include these components, in order:
Modifiers : A class can
be public or has default
access.
Class name: The name
should begin with a initial
letter
Body: The class
body surrounded by
braces, { }.
MODIFIERS
CLASS NAME
BODY
IT ANDROID APP

More Related Content

What's hot

5.interface and packages
5.interface and packages5.interface and packages
5.interface and packagesDeepak Sharma
 
The Go Programing Language 1
The Go Programing Language 1The Go Programing Language 1
The Go Programing Language 1
İbrahim Kürce
 
packages and interfaces
packages and interfacespackages and interfaces
packages and interfaces
madhavi patil
 
Java program structure
Java program structureJava program structure
Java program structure
shalinikarunakaran1
 
JAVA PROGRAMMING – Packages - Stream based I/O
JAVA PROGRAMMING – Packages - Stream based I/O JAVA PROGRAMMING – Packages - Stream based I/O
JAVA PROGRAMMING – Packages - Stream based I/O
Jyothishmathi Institute of Technology and Science Karimnagar
 
Class notes(week 7) on packages
Class notes(week 7) on packagesClass notes(week 7) on packages
Class notes(week 7) on packages
Kuntal Bhowmick
 
Java packages
Java packagesJava packages
Java packages
Jeffrey Quevedo
 
java interface and packages
java interface and packagesjava interface and packages
java interface and packages
VINOTH R
 
Object+oriented+programming+in+java
Object+oriented+programming+in+javaObject+oriented+programming+in+java
Object+oriented+programming+in+java
Ye Win
 
Packages and Interfaces
Packages and InterfacesPackages and Interfaces
Packages and Interfaces
AkashDas112
 
Polymorphism in java
Polymorphism in javaPolymorphism in java
Polymorphism in java
Elizabeth alexander
 
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar SinghInterface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singh
dheeraj_cse
 
Cs8392 oops 5 units notes
Cs8392 oops 5 units notes Cs8392 oops 5 units notes
Cs8392 oops 5 units notes
Narayanan sockalinganathan
 
Towards Improving Interface Modularity in Legacy Java Software Through Automa...
Towards Improving Interface Modularity in Legacy Java Software Through Automa...Towards Improving Interface Modularity in Legacy Java Software Through Automa...
Towards Improving Interface Modularity in Legacy Java Software Through Automa...
New York City College of Technology Computer Systems Technology Colloquium
 
Basics of java 2
Basics of java 2Basics of java 2
Basics of java 2Raghu nath
 

What's hot (20)

OOP java
OOP javaOOP java
OOP java
 
5.interface and packages
5.interface and packages5.interface and packages
5.interface and packages
 
The Go Programing Language 1
The Go Programing Language 1The Go Programing Language 1
The Go Programing Language 1
 
packages and interfaces
packages and interfacespackages and interfaces
packages and interfaces
 
Packages
PackagesPackages
Packages
 
Java program structure
Java program structureJava program structure
Java program structure
 
JAVA PROGRAMMING – Packages - Stream based I/O
JAVA PROGRAMMING – Packages - Stream based I/O JAVA PROGRAMMING – Packages - Stream based I/O
JAVA PROGRAMMING – Packages - Stream based I/O
 
Class notes(week 7) on packages
Class notes(week 7) on packagesClass notes(week 7) on packages
Class notes(week 7) on packages
 
Java packages
Java packagesJava packages
Java packages
 
Java packages
Java packagesJava packages
Java packages
 
java interface and packages
java interface and packagesjava interface and packages
java interface and packages
 
Object+oriented+programming+in+java
Object+oriented+programming+in+javaObject+oriented+programming+in+java
Object+oriented+programming+in+java
 
Packages and Interfaces
Packages and InterfacesPackages and Interfaces
Packages and Interfaces
 
Polymorphism in java
Polymorphism in javaPolymorphism in java
Polymorphism in java
 
Packages and interfaces
Packages and interfacesPackages and interfaces
Packages and interfaces
 
Suga java training_with_footer
Suga java training_with_footerSuga java training_with_footer
Suga java training_with_footer
 
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar SinghInterface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singh
 
Cs8392 oops 5 units notes
Cs8392 oops 5 units notes Cs8392 oops 5 units notes
Cs8392 oops 5 units notes
 
Towards Improving Interface Modularity in Legacy Java Software Through Automa...
Towards Improving Interface Modularity in Legacy Java Software Through Automa...Towards Improving Interface Modularity in Legacy Java Software Through Automa...
Towards Improving Interface Modularity in Legacy Java Software Through Automa...
 
Basics of java 2
Basics of java 2Basics of java 2
Basics of java 2
 

Similar to Java syntax-and-grammars-oct8

Basics of java 1
Basics of java 1Basics of java 1
Basics of java 1
Vijay Kankane
 
Basic syntax
Basic syntaxBasic syntax
Basic syntax
Ducat India
 
Java notes
Java notesJava notes
Java notes
Upasana Talukdar
 
Introduction
IntroductionIntroduction
Introduction
richsoden
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objects
vmadan89
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java Programming
Math-Circle
 
Java features
Java featuresJava features
Java features
Prashant Gajendra
 
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
OCA Java SE 8 Exam Chapter 1 Java Building BlocksOCA Java SE 8 Exam Chapter 1 Java Building Blocks
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
İbrahim Kürce
 
Java for Mainframers
Java for MainframersJava for Mainframers
Java for Mainframers
Rich Helton
 
Intro Java Rev010
Intro Java Rev010Intro Java Rev010
Intro Java Rev010Rich Helton
 
Chapter1pp
Chapter1ppChapter1pp
Chapter1ppJ. C.
 
Java programming basics
Java programming basicsJava programming basics
Java programming basics
Hamid Ghorbani
 
Java basics
Java basicsJava basics
Java basics
Ayshwarya Baburam
 
Core java
Core javaCore java
Java_presesntation.ppt
Java_presesntation.pptJava_presesntation.ppt
Java_presesntation.ppt
VGaneshKarthikeyan
 
FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Mod...
FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Mod...FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Mod...
FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Mod...
AnkurSingh340457
 

Similar to Java syntax-and-grammars-oct8 (20)

Basics of java 1
Basics of java 1Basics of java 1
Basics of java 1
 
Java basics
Java basicsJava basics
Java basics
 
Basic syntax
Basic syntaxBasic syntax
Basic syntax
 
Java notes
Java notesJava notes
Java notes
 
Introduction
IntroductionIntroduction
Introduction
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objects
 
01slide
01slide01slide
01slide
 
01slide
01slide01slide
01slide
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java Programming
 
Java features
Java featuresJava features
Java features
 
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
OCA Java SE 8 Exam Chapter 1 Java Building BlocksOCA Java SE 8 Exam Chapter 1 Java Building Blocks
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
 
Java for Mainframers
Java for MainframersJava for Mainframers
Java for Mainframers
 
Intro Java Rev010
Intro Java Rev010Intro Java Rev010
Intro Java Rev010
 
Chapter1pp
Chapter1ppChapter1pp
Chapter1pp
 
java
java java
java
 
Java programming basics
Java programming basicsJava programming basics
Java programming basics
 
Java basics
Java basicsJava basics
Java basics
 
Core java
Core javaCore java
Core java
 
Java_presesntation.ppt
Java_presesntation.pptJava_presesntation.ppt
Java_presesntation.ppt
 
FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Mod...
FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Mod...FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Mod...
FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Mod...
 

Recently uploaded

Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 

Recently uploaded (20)

Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 

Java syntax-and-grammars-oct8

  • 4. BASIC GRAMMARS About Java programs, it is very important to keep in mind the following points.  Case Sensitivity- Java is a case-sensitive language, which means that the upper or lower case of letters in your Java programs matter.
  • 5. CASE SENSITIVITY  Case sensitivity enforces capital or lower case in the text. For example, suppose you have created three variables called "endLoop", "Endloop", and "EndLoop". Even though these variables are composed of the exact same letters in the same exact order, Java does not consider them equal. It will treat them all differently.
  • 7. RESERVED WORD LIST Reserved words are words that cannot be used as object or variable names in a Java program because they're already used by the syntax of the Java programming language.
  • 8. LIST OF RESERVED JAVA KEYWORDS abstract assert boolean break byte case catch char class const continue default double do else enum extends false final finally float for goto if implements import instanceof int interface long native new null package private protected public return short static strictfp super switch synchroniz ed this throw throws transient true try void volatile while
  • 11. JAVA NAMING CONVENTIONS  A naming convention is a rule to follow as you decide what to name your identifiers (e.g. class, package, variable, method, etc.).  Why Use Naming Conventions?  Different java programmers can have different styles and approaches to the way they program. By using standard Java naming conventions they make their code easier to read for themselves and for other programmers. Readability of Java code is important because it means less time is spent trying to figure out what the code does, leaving more time to fix or modify it.
  • 12. IDENTIFIERS A Java identifier is a name given to a package, class, interface, method, or variable. It allows a programmer to refer to the item from other places in the program.
  • 13. BASIC GRAMMARS About Java programs, it is very important to keep in mind the following points.  Class Names − For all class names the first letter should be in Upper Case. If several words are used to form a name of the class, each inner word's first letter should be in Upper Case.  Class representing the name of a Java class. This class is unable to changed, and can therefore be safely used by multiple threads. Example: class MyFirstJavaClass
  • 15. BASIC GRAMMARS About Java programs, it is very important to keep in mind the following points.  Method Names − All method names should start with a Lower Case letter. If several words are used to form the name of the method, then each inner word's first letter should be in Upper Case. Example: public void myMethodName()
  • 17. WHAT ARE METHODS? A method is a set of code which is referred to by name and can be invoked at any point in a program simply by utilizing the method's name.
  • 18. THERE ARE TWO BASIC TYPES OF METHODS Built-in: Build-in methods are part of the compiler package, such as System.out.println( ) and System.exit(0). User-defined: User-defined methods are created by you, the programmer. These methods take-on names that you assign to them and perform tasks that you create.
  • 19. BASIC GRAMMARS About Java programs, it is very important to keep in mind the following points.  public static void main(String args[]) − Java program processing starts from the main() method which is a mandatory part of every Java program.
  • 22. IDENTIFIERS A Java identifier is a name given to a package, class, interface, method, or variable. It allows a programmer to refer to the item from other places in the program.
  • 23. Packages: in java it is a mechanism to encapsulate a group of classes, sub packages and interfaces Classes: is a user-defined blueprint or prototype from which objects are created. It represents the set of properties or methods that are common to all objects of one type. In general, class declarations can include these components
  • 24.  Interfaces: An interface is a completely "abstract class" that is used to group related methods with empty bodies:  Methods: is a block of code which only runs when it is called. You can pass data, known as parameters, into a method. Methods are used to perform certain actions, and they are also known as functions. Why use methods? To reuse code: define the code once, and use it many times.
  • 26.  Package in java is a mechanism to encapsulate a group of classes, sub packages and interfaces
  • 28.  Built-in Packages These packages consist of a large number of classes which are a part of Java API.Some of the commonly used built-in packages are 1) java.lang: Contains language support classes(e.g classed which defines primitive data types, math operations). This package is automatically imported. 2) java.io: Contains classed for supporting input / output operations. 3) java.util: Contains utility classes which implement data structures like Linked List, Dictionary and support ; for Date / Time operations.
  • 32.  User-defined packages These are the packages that are defined by the user. First we create a directory myPackage (name should be same as the name of the package). Then create the MyClass inside the directory with the first statement being the package names.
  • 34.  CLASS: A class is a user-defined blueprint or prototype from which objects are created. It represents the set of properties or methods that are common to all objects of one type. In general, class declarations can include these components, in order: Modifiers : A class can be public or has default access. Class name: The name should begin with a initial letter Body: The class body surrounded by braces, { }.
  • 37. BODY

Editor's Notes

  1. To illustrate the point it's worth mentioning that most software companies will have a document that outlines the naming conventions they want their programmers to follow. A new programmer who becomes familiar with those rules will be able to understand code written by a programmer who might have left the company many years beforehand.