SlideShare a Scribd company logo
3
Most read
7
Most read
8
Most read
Java object has a State and Behavior
State (Variables)
Variable or Field is nothing but the property of the class
class “computer” may have property like :
– Model
– mem_size
– hd_size
– os_type etc
Class Name
first letter should be
in Upper Case
If several words are used to form a name of the class each inner
words first letter should be in Upper Case.
Ex: MyFirstJavaExample
Behavior (Methods)
Method is nothing but the operation that an object can perform
It tells How an object can interact with outside world
Method Name
All method names should
start with a Lower Case letter.
Ex:
public void myMethodName( )
Java Application
is a Java class having main method
main method
should be public
– Class loader need to access this method
should be static
– method would be executed without an object
HelloWorld.java
● Compile the code
– javac HelloWorld.java
● Run the code
– java HelloWorld
Java is Case Sensitive
● Both the compiler (javac) and launcher (java) are case-
sensitive.
● Type all code, commands, and file names exactly as shown.
– HelloWorld is not the same as helloworld
Program File Name
Name of the program file should exactly match the class
name.
When saving the file you should save it using the class name
and append ‘.java’ to the end of the name.
Example :
class ‘HelloWorld’ should be saved in file ‘HelloWorld.java’
Java Identifiers
All java components require names.
Names used for classes, variables and methods
are called identifiers.
Java Keywords
These are reserved words and may not be used as
constant or variable or any other identifier names.
Examples:
abstract, boolean, break, byte, class, package etc.
Comments in Java
Java supports single line and multi-line comments very similar
to c and c++.
All characters available inside any comment are ignored by
Java compiler.
Using Blank Lines
A line containing only whitespace is known as a blank line,
and Java ignores it.

More Related Content

What's hot (19)

PDF
JAVA PROGRAMMING – Packages - Stream based I/O
Jyothishmathi Institute of Technology and Science Karimnagar
 
PDF
Access specifiers (Public Private Protected) C++
vivekkumar2938
 
PPT
Inner Classes
parag
 
DOC
Java classes and objects interview questions
Dhivyashree Selvarajtnkpm
 
PPTX
More oop in java
SAGARDAVE29
 
PPTX
Java Inheritance - sub class constructors - Method overriding
NithyaN19
 
PPTX
Introducing classes
Riaz Ahmed
 
PPTX
Access specifier
zindadili
 
DOCX
Final Class in Java - By JavaGoal
JavaGoal
 
PPTX
Inheritance and Polymorphism
KartikKapgate
 
PPTX
C# Access modifiers
Prem Kumar Badri
 
DOCX
Class notes(week 7) on packages
Kuntal Bhowmick
 
PPT
Learn Java language fundamentals with Unit nexus
Unit Nexus Pvt. Ltd.
 
PDF
Java packages
Jeffrey Quevedo
 
PPTX
Java tutorial for beginners-tibacademy.in
TIB Academy
 
PPTX
object oriented programming using c++
fasalsial1fasalsial1
 
DOC
116824015 java-j2 ee
homeworkping9
 
PPT
java tutorial 4
Tushar Desarda
 
PPTX
Java
Ashiqure Rahman
 
JAVA PROGRAMMING – Packages - Stream based I/O
Jyothishmathi Institute of Technology and Science Karimnagar
 
Access specifiers (Public Private Protected) C++
vivekkumar2938
 
Inner Classes
parag
 
Java classes and objects interview questions
Dhivyashree Selvarajtnkpm
 
More oop in java
SAGARDAVE29
 
Java Inheritance - sub class constructors - Method overriding
NithyaN19
 
Introducing classes
Riaz Ahmed
 
Access specifier
zindadili
 
Final Class in Java - By JavaGoal
JavaGoal
 
Inheritance and Polymorphism
KartikKapgate
 
C# Access modifiers
Prem Kumar Badri
 
Class notes(week 7) on packages
Kuntal Bhowmick
 
Learn Java language fundamentals with Unit nexus
Unit Nexus Pvt. Ltd.
 
Java packages
Jeffrey Quevedo
 
Java tutorial for beginners-tibacademy.in
TIB Academy
 
object oriented programming using c++
fasalsial1fasalsial1
 
116824015 java-j2 ee
homeworkping9
 
java tutorial 4
Tushar Desarda
 

Viewers also liked (20)

PDF
Java basic data types
javaicon
 
ODP
JAVA Data Types - Part 1
Ashok Asn
 
PPT
1 java - data type
vinay arora
 
PPT
Java basic introduction
Ideal Eyes Business College
 
PPT
3 java - variable type
vinay arora
 
PPT
Wynberg girls high-Jade Gibson-maths-grade9-statistics analysing data
Wynberg Girls High
 
PPTX
Variables statistics
Khushbu :-)
 
PPTX
MD Paediatrics (Part 1) - Overview of Basic Statistics
Bernard Deepal W. Jayamanne
 
PPTX
Control statement-Selective
Nurul Zakiah Zamri Tan
 
PPT
Descriptive statistics
Hiba Armouche
 
PDF
Social media : Type & Statistics
Rahul Yadav
 
PPTX
Type of data @ Web Mining Discussion
CherryBerry2
 
PPTX
Biostatistics : Types of Variable
Tarekk Alazabee
 
PPTX
Data Types and Variables In C Programming
Kamal Acharya
 
PPTX
Basics stat ppt-types of data
Farhana Shaheen
 
PPSX
Data type
Frijo Francis
 
PDF
Control statements
Kanwalpreet Kaur
 
PPTX
Data types
Zahid Hussain
 
PPT
Roultes law
Danish Aakash
 
PPTX
Introduction to Statistics (Part -I)
YesAnalytics
 
Java basic data types
javaicon
 
JAVA Data Types - Part 1
Ashok Asn
 
1 java - data type
vinay arora
 
Java basic introduction
Ideal Eyes Business College
 
3 java - variable type
vinay arora
 
Wynberg girls high-Jade Gibson-maths-grade9-statistics analysing data
Wynberg Girls High
 
Variables statistics
Khushbu :-)
 
MD Paediatrics (Part 1) - Overview of Basic Statistics
Bernard Deepal W. Jayamanne
 
Control statement-Selective
Nurul Zakiah Zamri Tan
 
Descriptive statistics
Hiba Armouche
 
Social media : Type & Statistics
Rahul Yadav
 
Type of data @ Web Mining Discussion
CherryBerry2
 
Biostatistics : Types of Variable
Tarekk Alazabee
 
Data Types and Variables In C Programming
Kamal Acharya
 
Basics stat ppt-types of data
Farhana Shaheen
 
Data type
Frijo Francis
 
Control statements
Kanwalpreet Kaur
 
Data types
Zahid Hussain
 
Roultes law
Danish Aakash
 
Introduction to Statistics (Part -I)
YesAnalytics
 
Ad

Similar to Java basic-syntax (20)

PPTX
Basic syntax
Ducat India
 
PPTX
Computer programming 2 chapter 1
MLG College of Learning, Inc
 
DOCX
java traning report_Summer.docx
GauravSharma164138
 
PPTX
cs213Lecture_1 java programming oopsss.pptx
mshanajoel6
 
PPTX
Core Java Tutorials by Mahika Tutorials
Mahika Tutorials
 
PPTX
Basics of java 2
Raghu nath
 
PPT
Java
Manav Prasad
 
DOCX
Unit of competency
loidasacueza
 
PDF
Javaprogbasics
cristiandinca69
 
PPT
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
nagendrareddy104104
 
PPT
Java Simple Introduction in single course
binzbinz3
 
PPTX
Java
Zeeshan Khan
 
DOCX
Unit2 java
mrecedu
 
DOCX
Java notes
Upasana Talukdar
 
PPTX
Java programmingjsjdjdjdjdjdjdjdjdiidiei
rajputtejaswa12
 
PPTX
Core java
Shridhar Ramesh
 
PPT
Introduction what is java
sanjeeviniindia1186
 
PPT
Java01
Sanjeev Tripathi
 
PPT
Java01
mosewoodward24
 
PPT
Java01
mosewoodward24
 
Basic syntax
Ducat India
 
Computer programming 2 chapter 1
MLG College of Learning, Inc
 
java traning report_Summer.docx
GauravSharma164138
 
cs213Lecture_1 java programming oopsss.pptx
mshanajoel6
 
Core Java Tutorials by Mahika Tutorials
Mahika Tutorials
 
Basics of java 2
Raghu nath
 
Unit of competency
loidasacueza
 
Javaprogbasics
cristiandinca69
 
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
nagendrareddy104104
 
Java Simple Introduction in single course
binzbinz3
 
Unit2 java
mrecedu
 
Java notes
Upasana Talukdar
 
Java programmingjsjdjdjdjdjdjdjdjdiidiei
rajputtejaswa12
 
Core java
Shridhar Ramesh
 
Introduction what is java
sanjeeviniindia1186
 
Ad

Recently uploaded (20)

PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PDF
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
PDF
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PPTX
How to Set Maximum Difference Odoo 18 POS
Celine George
 
PDF
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PPTX
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PDF
People & Earth's Ecosystem -Lesson 2: People & Population
marvinnbustamante1
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PPTX
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
PPSX
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
How to Set Maximum Difference Odoo 18 POS
Celine George
 
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
People & Earth's Ecosystem -Lesson 2: People & Population
marvinnbustamante1
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
Dimensions of Societal Planning in Commonism
StefanMz
 

Java basic-syntax

  • 1. Java object has a State and Behavior
  • 2. State (Variables) Variable or Field is nothing but the property of the class class “computer” may have property like : – Model – mem_size – hd_size – os_type etc
  • 3. Class Name first letter should be in Upper Case If several words are used to form a name of the class each inner words first letter should be in Upper Case. Ex: MyFirstJavaExample
  • 4. Behavior (Methods) Method is nothing but the operation that an object can perform It tells How an object can interact with outside world
  • 5. Method Name All method names should start with a Lower Case letter. Ex: public void myMethodName( )
  • 6. Java Application is a Java class having main method
  • 7. main method should be public – Class loader need to access this method should be static – method would be executed without an object
  • 9. ● Compile the code – javac HelloWorld.java ● Run the code – java HelloWorld
  • 10. Java is Case Sensitive ● Both the compiler (javac) and launcher (java) are case- sensitive. ● Type all code, commands, and file names exactly as shown. – HelloWorld is not the same as helloworld
  • 11. Program File Name Name of the program file should exactly match the class name. When saving the file you should save it using the class name and append ‘.java’ to the end of the name. Example : class ‘HelloWorld’ should be saved in file ‘HelloWorld.java’
  • 12. Java Identifiers All java components require names. Names used for classes, variables and methods are called identifiers.
  • 13. Java Keywords These are reserved words and may not be used as constant or variable or any other identifier names. Examples: abstract, boolean, break, byte, class, package etc.
  • 14. Comments in Java Java supports single line and multi-line comments very similar to c and c++. All characters available inside any comment are ignored by Java compiler.
  • 15. Using Blank Lines A line containing only whitespace is known as a blank line, and Java ignores it.