SlideShare a Scribd company logo
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

PDF
Java basic-syntax
PDF
Java Basic Syntax
PPTX
Java basics
PDF
Lecture 10
PPTX
[OOP - Lec 07] Access Specifiers
PPTX
2- Introduction to java II
PPSX
Features of java technology
PPTX
5- Overriding and Abstraction In Java
Java basic-syntax
Java Basic Syntax
Java basics
Lecture 10
[OOP - Lec 07] Access Specifiers
2- Introduction to java II
Features of java technology
5- Overriding and Abstraction In Java

What's hot (19)

PDF
JAVA PROGRAMMING – Packages - Stream based I/O
PDF
Access specifiers (Public Private Protected) C++
PPT
Inner Classes
DOC
Java classes and objects interview questions
PPTX
More oop in java
PPTX
Java Inheritance - sub class constructors - Method overriding
PPTX
Introducing classes
PPTX
Access specifier
DOCX
Final Class in Java - By JavaGoal
PPTX
Inheritance and Polymorphism
PPTX
C# Access modifiers
DOCX
Class notes(week 7) on packages
PPT
Learn Java language fundamentals with Unit nexus
PDF
Java packages
PPTX
Java tutorial for beginners-tibacademy.in
PPTX
object oriented programming using c++
DOC
116824015 java-j2 ee
PPT
java tutorial 4
PPTX
JAVA PROGRAMMING – Packages - Stream based I/O
Access specifiers (Public Private Protected) C++
Inner Classes
Java classes and objects interview questions
More oop in java
Java Inheritance - sub class constructors - Method overriding
Introducing classes
Access specifier
Final Class in Java - By JavaGoal
Inheritance and Polymorphism
C# Access modifiers
Class notes(week 7) on packages
Learn Java language fundamentals with Unit nexus
Java packages
Java tutorial for beginners-tibacademy.in
object oriented programming using c++
116824015 java-j2 ee
java tutorial 4
Ad

Viewers also liked (20)

PDF
Java basic data types
ODP
JAVA Data Types - Part 1
PPT
1 java - data type
PPT
Java basic introduction
PPT
3 java - variable type
PPT
Wynberg girls high-Jade Gibson-maths-grade9-statistics analysing data
PPTX
Variables statistics
PPTX
MD Paediatrics (Part 1) - Overview of Basic Statistics
PPTX
Control statement-Selective
PPT
Descriptive statistics
PDF
Social media : Type & Statistics
PPTX
Type of data @ Web Mining Discussion
PPTX
Biostatistics : Types of Variable
PPTX
Data Types and Variables In C Programming
PPTX
Basics stat ppt-types of data
PPSX
Data type
PDF
Control statements
PPTX
Data types
PPT
Roultes law
PPTX
Introduction to Statistics (Part -I)
Java basic data types
JAVA Data Types - Part 1
1 java - data type
Java basic introduction
3 java - variable type
Wynberg girls high-Jade Gibson-maths-grade9-statistics analysing data
Variables statistics
MD Paediatrics (Part 1) - Overview of Basic Statistics
Control statement-Selective
Descriptive statistics
Social media : Type & Statistics
Type of data @ Web Mining Discussion
Biostatistics : Types of Variable
Data Types and Variables In C Programming
Basics stat ppt-types of data
Data type
Control statements
Data types
Roultes law
Introduction to Statistics (Part -I)
Ad

Similar to Java basic-syntax (20)

PPTX
Basic syntax
PPTX
Computer programming 2 chapter 1
DOCX
java traning report_Summer.docx
PPTX
cs213Lecture_1 java programming oopsss.pptx
PPTX
Core Java Tutorials by Mahika Tutorials
PPTX
Basics of java 2
PPT
JAVA ppt tutorial basics to learn java programming
PPT
DOCX
Unit of competency
PDF
Javaprogbasics
PPT
Java Simple Introduction in single course
PPT
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
PPTX
DOCX
Unit2 java
DOCX
Java notes
PPTX
Java programmingjsjdjdjdjdjdjdjdjdiidiei
PPTX
Core java
PPT
Introduction what is java
PPT
PPT
Java01
Basic syntax
Computer programming 2 chapter 1
java traning report_Summer.docx
cs213Lecture_1 java programming oopsss.pptx
Core Java Tutorials by Mahika Tutorials
Basics of java 2
JAVA ppt tutorial basics to learn java programming
Unit of competency
Javaprogbasics
Java Simple Introduction in single course
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
Unit2 java
Java notes
Java programmingjsjdjdjdjdjdjdjdjdiidiei
Core java
Introduction what is java
Java01

Recently uploaded (20)

PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Lesson notes of climatology university.
PDF
01-Introduction-to-Information-Management.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Basic Mud Logging Guide for educational purpose
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Classroom Observation Tools for Teachers
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Computing-Curriculum for Schools in Ghana
PDF
Insiders guide to clinical Medicine.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Pre independence Education in Inndia.pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPH.pptx obstetrics and gynecology in nursing
TR - Agricultural Crops Production NC III.pdf
Final Presentation General Medicine 03-08-2024.pptx
Lesson notes of climatology university.
01-Introduction-to-Information-Management.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Basic Mud Logging Guide for educational purpose
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Classroom Observation Tools for Teachers
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Computing-Curriculum for Schools in Ghana
Insiders guide to clinical Medicine.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
Pre independence Education in Inndia.pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape

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.