SlideShare a Scribd company logo
Compiling the First Java Program
•Printing Hello World On Screen
•Understanding the keywords
•Understanding the Syntax of program
•How to compile a java program
•How to execute a java Program
•What is camel case syntax.
4/10/2019 1Jamsher Bhanbhro(F16CS11)
Hello World!
• public class HelloWorld{
public static void main (String args[]){
System.out.println(“Hello World!”);
}
}
4/10/2019 Jamsher Bhanbhro(F16CS11) 2
Understanding the syntax
• Here public is the access modifier which tells
the accesses of our program/class i.e where our
class can be called and where it can’t.
• Public means we can call our class throughout
the program it can run any where it is public.
• Further we will discuss in the access modifier
lecture.
4/10/2019 Jamsher Bhanbhro(F16CS11) 3
Cont…
• Class is the keyword which makes our
program’s class.
• Class is the collection of the object’s properties
and behavior.
• HelloWorld is the name of the calss.
• Curly braces are the body of the program.
4/10/2019 Jamsher Bhanbhro(F16CS11) 4
Cont…
• public static : static is the reference variable or
the keyword which is used to call a function or
a program without creating an object.
• We have used static keyword with main
method because we may call it several times
so we want to call it directly without creating
it’s object many times.
• Void: this is the type the method it tells
methods will return some value.
4/10/2019 Jamsher Bhanbhro(F16CS11) 5
Cont…
• main: it is name of the method.
• String args[]: it is the array which tells that main method will take
arguments.
• We will further discus string args in the upcoming lectures.
• System: It is the class which is predefined in which there are built-in
functions for showing outputs.
• .out: it is an object or the reference variables which use the inner
functions of the System Class like printing some ting etc.
• println: print on new line.
• the square braces tells the args of the method.
• In the double square text is written which will show as it is on the
screen. In the above case there is Hello World
• And the last bracket use to end the program.
4/10/2019 Jamsher Bhanbhro(F16CS11) 6
Syntax
The above program uses the followings…
1. Classes
2. Objects
3. Keywords
4. Identifiers
5. Methods/Functions
6. Braces
4/10/2019 Jamsher Bhanbhro(F16CS11) 7
How to compile the java program
• After writing the code save it as Classname.java
• Name of the file and the class should be the same.
• If the path of your machine is than open command window and type javac and the
name of your program.java
• javac is the java compiler.
• After typing this in cmd press enter if there will be error of path set or errors in
your program than that will be shown here if not than .class file will be developed
in the directory where your program is saved.
• If .class file is formed it means your code is compiled successfully.
4/10/2019 Jamsher Bhanbhro(F16CS11) 8
How to execute a java program
• If there no any error occur during the compile
time it means your path is set and your code is
also right.
• So now for the execution or checking the
output functionality of our program we have to
write java class-name i.e java HelloWorld
4/10/2019 Jamsher Bhanbhro(F16CS11) 9
What is Camel Case in java
• Camel case stands that the first latter of the
each class should be written in the capital
letter.
• This is more useful because we will easy
understand that which is class when there is
large code in our program.
• In the above case there are three classes
• i- HelloWorld ii-System iii-String
4/10/2019 Jamsher Bhanbhro(F16CS11) 10

More Related Content

PPTX
Compiling and understanding first program in java
Jamsher bhanbhro
 
PPTX
Structure of a C# Program
Ali Hassan
 
DOCX
Cis 355 i lab 1 of 6
helpido9
 
PPTX
Getting Program Input
Dr. Rosemarie Sibbaluca-Guirre
 
DOCX
Cis 355 i lab 1 of 6
solutionjug4
 
PPT
Introduction
richsoden
 
PDF
Session 2 of programming
Ramy F. Radwan
 
PDF
Bt0074 oops with java2
Techglyphs
 
Compiling and understanding first program in java
Jamsher bhanbhro
 
Structure of a C# Program
Ali Hassan
 
Cis 355 i lab 1 of 6
helpido9
 
Getting Program Input
Dr. Rosemarie Sibbaluca-Guirre
 
Cis 355 i lab 1 of 6
solutionjug4
 
Introduction
richsoden
 
Session 2 of programming
Ramy F. Radwan
 
Bt0074 oops with java2
Techglyphs
 

What's hot (19)

PDF
Java8 features
Minal Maniar
 
PPT
Lecture 3 java basics
the_wumberlog
 
PDF
Java se 8 language enhancements & features
Juarez Junior
 
PDF
GA Sample Teach: Intro to JS Functions
Thinkful
 
PPT
Java
tintinsan
 
PDF
Quiz1solt (2)
NALINIMUDLIAR94
 
PPTX
Error handling and debugging in vb
Salim M
 
DOCX
Examples c#
bhaskard8
 
PPTX
Exception handling in ASP .NET
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Java ce241
Minal Maniar
 
PPTX
Java history, versions, types of errors and exception, quiz
SAurabh PRajapati
 
PPTX
Architecture diagram of jvm
home
 
PPTX
Debugging in .Net
Muhammad Amir
 
DOCX
Bc0051 – system software
smumbahelp
 
PPT
7 programming-using-java decision-making220102011
Mahmoud Alfarra
 
PPTX
Java features
Prashant Gajendra
 
Java8 features
Minal Maniar
 
Lecture 3 java basics
the_wumberlog
 
Java se 8 language enhancements & features
Juarez Junior
 
GA Sample Teach: Intro to JS Functions
Thinkful
 
Java
tintinsan
 
Quiz1solt (2)
NALINIMUDLIAR94
 
Error handling and debugging in vb
Salim M
 
Examples c#
bhaskard8
 
Exception handling in ASP .NET
baabtra.com - No. 1 supplier of quality freshers
 
Java ce241
Minal Maniar
 
Java history, versions, types of errors and exception, quiz
SAurabh PRajapati
 
Architecture diagram of jvm
home
 
Debugging in .Net
Muhammad Amir
 
Bc0051 – system software
smumbahelp
 
7 programming-using-java decision-making220102011
Mahmoud Alfarra
 
Java features
Prashant Gajendra
 
Ad

Similar to Lect4 (20)

PDF
Object Oriented Programming with Java Basic Syntax.pdf
BINJAD1
 
PPTX
Multi Threading- in Java WPS Office.pptx
ManasaMR2
 
PPTX
#_ varible function
abdullah al mahamud rosi
 
PDF
Java Basics.pdf
EdFeranil
 
PPTX
Analysis of a basic java program
Sujit Kumar
 
PPTX
Java Hello World Program
JavaWithUs
 
PPTX
Mpl 1
AHHAAH
 
PPT
java01.ppt
Godwin585235
 
PPTX
Java programmingjsjdjdjdjdjdjdjdjdiidiei
rajputtejaswa12
 
PPT
Java PPt.ppt
NavneetSheoran3
 
PPTX
Java
Zeeshan Khan
 
PPTX
Basics of java 2
Raghu nath
 
PPTX
Core java &collections
Ravi varma
 
PPTX
Core java1
Ravi varma
 
PPTX
Core java
Ravi varma
 
PPT
2 Getting To Know Your Programing Environment
dM Technologies
 
PPT
2 Getting To Know Your Programing Environment
guest9aa151
 
PPTX
Java tutorial for beginners-tibacademy.in
TIB Academy
 
PPTX
LECTURE 2 -Object oriented Java Basics.pptx
AOmaAli
 
PDF
java 1 new.pdf
SulSya
 
Object Oriented Programming with Java Basic Syntax.pdf
BINJAD1
 
Multi Threading- in Java WPS Office.pptx
ManasaMR2
 
#_ varible function
abdullah al mahamud rosi
 
Java Basics.pdf
EdFeranil
 
Analysis of a basic java program
Sujit Kumar
 
Java Hello World Program
JavaWithUs
 
Mpl 1
AHHAAH
 
java01.ppt
Godwin585235
 
Java programmingjsjdjdjdjdjdjdjdjdiidiei
rajputtejaswa12
 
Java PPt.ppt
NavneetSheoran3
 
Basics of java 2
Raghu nath
 
Core java &collections
Ravi varma
 
Core java1
Ravi varma
 
Core java
Ravi varma
 
2 Getting To Know Your Programing Environment
dM Technologies
 
2 Getting To Know Your Programing Environment
guest9aa151
 
Java tutorial for beginners-tibacademy.in
TIB Academy
 
LECTURE 2 -Object oriented Java Basics.pptx
AOmaAli
 
java 1 new.pdf
SulSya
 
Ad

More from Jamsher bhanbhro (13)

PDF
Abstraction in Java: Abstract class and Interfaces
Jamsher bhanbhro
 
PDF
Method, Constructor, Method Overloading, Method Overriding, Inheritance In Java
Jamsher bhanbhro
 
PPTX
Regular Expressions in Java.
Jamsher bhanbhro
 
PPTX
Java Arrays and DateTime Functions
Jamsher bhanbhro
 
PPTX
Lect10
Jamsher bhanbhro
 
PPTX
Lect9
Jamsher bhanbhro
 
PPTX
Lect8
Jamsher bhanbhro
 
PPTX
Lect7
Jamsher bhanbhro
 
PPTX
Lect6
Jamsher bhanbhro
 
PPTX
Lect5
Jamsher bhanbhro
 
PPTX
Introduction to java
Jamsher bhanbhro
 
PPTX
Caap presentation by me
Jamsher bhanbhro
 
PPTX
Introduction to parts of Computer(Computer Fundamentals)
Jamsher bhanbhro
 
Abstraction in Java: Abstract class and Interfaces
Jamsher bhanbhro
 
Method, Constructor, Method Overloading, Method Overriding, Inheritance In Java
Jamsher bhanbhro
 
Regular Expressions in Java.
Jamsher bhanbhro
 
Java Arrays and DateTime Functions
Jamsher bhanbhro
 
Introduction to java
Jamsher bhanbhro
 
Caap presentation by me
Jamsher bhanbhro
 
Introduction to parts of Computer(Computer Fundamentals)
Jamsher bhanbhro
 

Recently uploaded (20)

PPTX
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
PPTX
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
PDF
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
PPTX
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
PPTX
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PPTX
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
DOCX
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
PPTX
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
PPTX
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
PPTX
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
DOCX
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 
PPTX
Gupta Art & Architecture Temple and Sculptures.pptx
Virag Sontakke
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PPTX
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
PDF
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
PPTX
Care of patients with elImination deviation.pptx
AneetaSharma15
 
PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 
Gupta Art & Architecture Temple and Sculptures.pptx
Virag Sontakke
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
Care of patients with elImination deviation.pptx
AneetaSharma15
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 

Lect4

  • 1. Compiling the First Java Program •Printing Hello World On Screen •Understanding the keywords •Understanding the Syntax of program •How to compile a java program •How to execute a java Program •What is camel case syntax. 4/10/2019 1Jamsher Bhanbhro(F16CS11)
  • 2. Hello World! • public class HelloWorld{ public static void main (String args[]){ System.out.println(“Hello World!”); } } 4/10/2019 Jamsher Bhanbhro(F16CS11) 2
  • 3. Understanding the syntax • Here public is the access modifier which tells the accesses of our program/class i.e where our class can be called and where it can’t. • Public means we can call our class throughout the program it can run any where it is public. • Further we will discuss in the access modifier lecture. 4/10/2019 Jamsher Bhanbhro(F16CS11) 3
  • 4. Cont… • Class is the keyword which makes our program’s class. • Class is the collection of the object’s properties and behavior. • HelloWorld is the name of the calss. • Curly braces are the body of the program. 4/10/2019 Jamsher Bhanbhro(F16CS11) 4
  • 5. Cont… • public static : static is the reference variable or the keyword which is used to call a function or a program without creating an object. • We have used static keyword with main method because we may call it several times so we want to call it directly without creating it’s object many times. • Void: this is the type the method it tells methods will return some value. 4/10/2019 Jamsher Bhanbhro(F16CS11) 5
  • 6. Cont… • main: it is name of the method. • String args[]: it is the array which tells that main method will take arguments. • We will further discus string args in the upcoming lectures. • System: It is the class which is predefined in which there are built-in functions for showing outputs. • .out: it is an object or the reference variables which use the inner functions of the System Class like printing some ting etc. • println: print on new line. • the square braces tells the args of the method. • In the double square text is written which will show as it is on the screen. In the above case there is Hello World • And the last bracket use to end the program. 4/10/2019 Jamsher Bhanbhro(F16CS11) 6
  • 7. Syntax The above program uses the followings… 1. Classes 2. Objects 3. Keywords 4. Identifiers 5. Methods/Functions 6. Braces 4/10/2019 Jamsher Bhanbhro(F16CS11) 7
  • 8. How to compile the java program • After writing the code save it as Classname.java • Name of the file and the class should be the same. • If the path of your machine is than open command window and type javac and the name of your program.java • javac is the java compiler. • After typing this in cmd press enter if there will be error of path set or errors in your program than that will be shown here if not than .class file will be developed in the directory where your program is saved. • If .class file is formed it means your code is compiled successfully. 4/10/2019 Jamsher Bhanbhro(F16CS11) 8
  • 9. How to execute a java program • If there no any error occur during the compile time it means your path is set and your code is also right. • So now for the execution or checking the output functionality of our program we have to write java class-name i.e java HelloWorld 4/10/2019 Jamsher Bhanbhro(F16CS11) 9
  • 10. What is Camel Case in java • Camel case stands that the first latter of the each class should be written in the capital letter. • This is more useful because we will easy understand that which is class when there is large code in our program. • In the above case there are three classes • i- HelloWorld ii-System iii-String 4/10/2019 Jamsher Bhanbhro(F16CS11) 10