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.
1/7/2019 1Jamsher Bhanbhro(F16CS11)
Hello World!
• public class HelloWorld{
public static void main (String args[]){
System.out.println(“Hello World!”);
}
}
1/7/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.
1/7/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.
1/7/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.
1/7/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.
1/7/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
1/7/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.
1/7/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
1/7/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
1/7/2019 Jamsher Bhanbhro(F16CS11) 10

More Related Content

What's hot (19)

PPT
Lecture 3 java basics
the_wumberlog
 
PDF
overview of c#
Kandreo Gotro
 
DOCX
Bc0051 – system software
smumbahelp
 
PPT
About java
vibrantblade16
 
PPT
Developing For Ubraa
Garrizaldy Santos
 
PDF
Bt0074 oops with java2
Techglyphs
 
PPTX
Function in Python
Md. Shafiuzzaman Hira
 
PDF
Programming Sessions KU Leuven - Session 02
Rafael Camacho Dejay
 
DOCX
Examples c#
bhaskard8
 
PDF
Core Java Tutorial
Java2Blog
 
PPTX
Java ce241
Minal Maniar
 
PPTX
Java features
Prashant Gajendra
 
PDF
Quiz1solt (2)
NALINIMUDLIAR94
 
PPTX
Java history, versions, types of errors and exception, quiz
SAurabh PRajapati
 
PPTX
Learn To Code: Introduction to c
SadhanaParameswaran
 
PPTX
Java applet
Rohan Gajre
 
PPT
Java Presentation
pm2214
 
PPTX
Java programming course for beginners
Eduonix Learning Solutions
 
PPT
1 2 java development
Ken Kretsch
 
Lecture 3 java basics
the_wumberlog
 
overview of c#
Kandreo Gotro
 
Bc0051 – system software
smumbahelp
 
About java
vibrantblade16
 
Developing For Ubraa
Garrizaldy Santos
 
Bt0074 oops with java2
Techglyphs
 
Function in Python
Md. Shafiuzzaman Hira
 
Programming Sessions KU Leuven - Session 02
Rafael Camacho Dejay
 
Examples c#
bhaskard8
 
Core Java Tutorial
Java2Blog
 
Java ce241
Minal Maniar
 
Java features
Prashant Gajendra
 
Quiz1solt (2)
NALINIMUDLIAR94
 
Java history, versions, types of errors and exception, quiz
SAurabh PRajapati
 
Learn To Code: Introduction to c
SadhanaParameswaran
 
Java applet
Rohan Gajre
 
Java Presentation
pm2214
 
Java programming course for beginners
Eduonix Learning Solutions
 
1 2 java development
Ken Kretsch
 

Similar to Compiling and understanding first program in java (20)

PPTX
Multi Threading- in Java WPS Office.pptx
ManasaMR2
 
PPTX
#_ varible function
abdullah al mahamud rosi
 
PDF
Java Basics.pdf
EdFeranil
 
PPTX
Java Hello World Program
JavaWithUs
 
PPT
java01.ppt
Godwin585235
 
PPTX
Mpl 1
AHHAAH
 
PPT
Java PPt.ppt
NavneetSheoran3
 
PPT
2 Getting To Know Your Programing Environment
dM Technologies
 
PPT
2 Getting To Know Your Programing Environment
guest9aa151
 
PPTX
Java programmingjsjdjdjdjdjdjdjdjdiidiei
rajputtejaswa12
 
PPTX
Basics of java 2
Raghu nath
 
PPTX
Java
Zeeshan Khan
 
PPTX
Core java &collections
Ravi varma
 
PPTX
Core java1
Ravi varma
 
PPTX
Core java
Ravi varma
 
PDF
java 1 new.pdf
SulSya
 
PPTX
Java tutorial for beginners-tibacademy.in
TIB Academy
 
PPTX
LECTURE 2 -Object oriented Java Basics.pptx
AOmaAli
 
PPT
Java Primitive Type from Long Nguyen's lecture
ssusere8fc511
 
PPT
Java for Mainframers
Rich Helton
 
Multi Threading- in Java WPS Office.pptx
ManasaMR2
 
#_ varible function
abdullah al mahamud rosi
 
Java Basics.pdf
EdFeranil
 
Java Hello World Program
JavaWithUs
 
java01.ppt
Godwin585235
 
Mpl 1
AHHAAH
 
Java PPt.ppt
NavneetSheoran3
 
2 Getting To Know Your Programing Environment
dM Technologies
 
2 Getting To Know Your Programing Environment
guest9aa151
 
Java programmingjsjdjdjdjdjdjdjdjdiidiei
rajputtejaswa12
 
Basics of java 2
Raghu nath
 
Core java &collections
Ravi varma
 
Core java1
Ravi varma
 
Core java
Ravi varma
 
java 1 new.pdf
SulSya
 
Java tutorial for beginners-tibacademy.in
TIB Academy
 
LECTURE 2 -Object oriented Java Basics.pptx
AOmaAli
 
Java Primitive Type from Long Nguyen's lecture
ssusere8fc511
 
Java for Mainframers
Rich Helton
 
Ad

More from Jamsher bhanbhro (14)

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
Lect4
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
 
Ad

Recently uploaded (20)

PDF
Horarios de distribución de agua en julio
pegazohn1978
 
PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PPTX
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
PPTX
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PPTX
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
PPTX
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
PPTX
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PDF
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PPTX
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
Horarios de distribución de agua en julio
pegazohn1978
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 

Compiling and understanding first program in java

  • 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. 1/7/2019 1Jamsher Bhanbhro(F16CS11)
  • 2. Hello World! • public class HelloWorld{ public static void main (String args[]){ System.out.println(“Hello World!”); } } 1/7/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. 1/7/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. 1/7/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. 1/7/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. 1/7/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 1/7/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. 1/7/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 1/7/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 1/7/2019 Jamsher Bhanbhro(F16CS11) 10