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

What's hot (20)

Bt0074 oops with java2
Bt0074 oops with java2Bt0074 oops with java2
Bt0074 oops with java2
 
Java8 features
Java8 featuresJava8 features
Java8 features
 
Java basics training 1
Java basics training 1Java basics training 1
Java basics training 1
 
Lecture 3 java basics
Lecture 3 java basicsLecture 3 java basics
Lecture 3 java basics
 
Java se 8 language enhancements & features
Java se 8   language enhancements & featuresJava se 8   language enhancements & features
Java se 8 language enhancements & features
 
GA Sample Teach: Intro to JS Functions
GA Sample Teach: Intro to JS FunctionsGA Sample Teach: Intro to JS Functions
GA Sample Teach: Intro to JS Functions
 
Java
JavaJava
Java
 
Quiz1solt (2)
Quiz1solt (2)Quiz1solt (2)
Quiz1solt (2)
 
Error handling and debugging in vb
Error handling and debugging in vbError handling and debugging in vb
Error handling and debugging in vb
 
Examples c#
Examples c#Examples c#
Examples c#
 
3. jvm
3. jvm3. jvm
3. jvm
 
Exception handling in ASP .NET
Exception handling in ASP .NETException handling in ASP .NET
Exception handling in ASP .NET
 
JVM
JVMJVM
JVM
 
Java ce241
Java ce241Java ce241
Java ce241
 
Java history, versions, types of errors and exception, quiz
Java history, versions, types of errors and exception, quiz Java history, versions, types of errors and exception, quiz
Java history, versions, types of errors and exception, quiz
 
Architecture diagram of jvm
Architecture diagram of jvmArchitecture diagram of jvm
Architecture diagram of jvm
 
Debugging in .Net
Debugging in .NetDebugging in .Net
Debugging in .Net
 
Bc0051 – system software
Bc0051 – system softwareBc0051 – system software
Bc0051 – system software
 
7 programming-using-java decision-making220102011
7 programming-using-java decision-making2201020117 programming-using-java decision-making220102011
7 programming-using-java decision-making220102011
 
Java features
Java featuresJava features
Java features
 

Similar to Lect4

Intro to programing with java-lecture 1
Intro to programing with java-lecture 1Intro to programing with java-lecture 1
Intro to programing with java-lecture 1Mohamed Essam
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer scienceumardanjumamaiwada
 
Java lab1 manual
Java lab1 manualJava lab1 manual
Java lab1 manualnahalomar
 
01-ch01-1-println.ppt java introduction one
01-ch01-1-println.ppt java introduction one01-ch01-1-println.ppt java introduction one
01-ch01-1-println.ppt java introduction onessuser656672
 
Intro Java Rev010
Intro Java Rev010Intro Java Rev010
Intro Java Rev010Rich Helton
 
Java for Mainframers
Java for MainframersJava for Mainframers
Java for MainframersRich Helton
 
Understanding And Using Reflection
Understanding And Using ReflectionUnderstanding And Using Reflection
Understanding And Using ReflectionGanesh Samarthyam
 
Unit of competency
Unit of competencyUnit of competency
Unit of competencyloidasacueza
 
Programming in Java: Getting Started
Programming in Java: Getting StartedProgramming in Java: Getting Started
Programming in Java: Getting StartedMartin Chapman
 
Concurrency Programming in Java - 02 - Essentials of Java Part 1
Concurrency Programming in Java - 02 - Essentials of Java Part 1Concurrency Programming in Java - 02 - Essentials of Java Part 1
Concurrency Programming in Java - 02 - Essentials of Java Part 1Sachintha Gunasena
 
Selenium web driver | java
Selenium web driver | javaSelenium web driver | java
Selenium web driver | javaRajesh Kumar
 
Unit2 java
Unit2 javaUnit2 java
Unit2 javamrecedu
 
Chapter 2.1
Chapter 2.1Chapter 2.1
Chapter 2.1sotlsoc
 

Similar to Lect4 (20)

Intro to programing with java-lecture 1
Intro to programing with java-lecture 1Intro to programing with java-lecture 1
Intro to programing with java-lecture 1
 
Basics of java 1
Basics of java 1Basics of java 1
Basics of java 1
 
lecture 6
 lecture 6 lecture 6
lecture 6
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
 
Java lab1 manual
Java lab1 manualJava lab1 manual
Java lab1 manual
 
01-ch01-1-println.ppt java introduction one
01-ch01-1-println.ppt java introduction one01-ch01-1-println.ppt java introduction one
01-ch01-1-println.ppt java introduction one
 
Intro Java Rev010
Intro Java Rev010Intro Java Rev010
Intro Java Rev010
 
Java for Mainframers
Java for MainframersJava for Mainframers
Java for Mainframers
 
Java
JavaJava
Java
 
Understanding And Using Reflection
Understanding And Using ReflectionUnderstanding And Using Reflection
Understanding And Using Reflection
 
Unit of competency
Unit of competencyUnit of competency
Unit of competency
 
Programming in Java: Getting Started
Programming in Java: Getting StartedProgramming in Java: Getting Started
Programming in Java: Getting Started
 
01slide
01slide01slide
01slide
 
01slide
01slide01slide
01slide
 
Concurrency Programming in Java - 02 - Essentials of Java Part 1
Concurrency Programming in Java - 02 - Essentials of Java Part 1Concurrency Programming in Java - 02 - Essentials of Java Part 1
Concurrency Programming in Java - 02 - Essentials of Java Part 1
 
Java introduction
Java introductionJava introduction
Java introduction
 
Selenium web driver | java
Selenium web driver | javaSelenium web driver | java
Selenium web driver | java
 
Java Programming Fundamentals
Java Programming Fundamentals Java Programming Fundamentals
Java Programming Fundamentals
 
Unit2 java
Unit2 javaUnit2 java
Unit2 java
 
Chapter 2.1
Chapter 2.1Chapter 2.1
Chapter 2.1
 

More from Jamsher bhanbhro

More from Jamsher bhanbhro (13)

Abstraction in Java: Abstract class and Interfaces
Abstraction in  Java: Abstract class and InterfacesAbstraction in  Java: Abstract class and Interfaces
Abstraction in Java: Abstract class and Interfaces
 
Method, Constructor, Method Overloading, Method Overriding, Inheritance In Java
Method, Constructor, Method Overloading, Method Overriding, Inheritance In  JavaMethod, Constructor, Method Overloading, Method Overriding, Inheritance In  Java
Method, Constructor, Method Overloading, Method Overriding, Inheritance In Java
 
Regular Expressions in Java.
Regular Expressions in Java.Regular Expressions in Java.
Regular Expressions in Java.
 
Java Arrays and DateTime Functions
Java Arrays and DateTime FunctionsJava Arrays and DateTime Functions
Java Arrays and DateTime Functions
 
Lect10
Lect10Lect10
Lect10
 
Lect9
Lect9Lect9
Lect9
 
Lect8
Lect8Lect8
Lect8
 
Lect7
Lect7Lect7
Lect7
 
Lect6
Lect6Lect6
Lect6
 
Lect5
Lect5Lect5
Lect5
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Caap presentation by me
Caap presentation by meCaap presentation by me
Caap presentation by me
 
Introduction to parts of Computer(Computer Fundamentals)
Introduction to parts of Computer(Computer Fundamentals)Introduction to parts of Computer(Computer Fundamentals)
Introduction to parts of Computer(Computer Fundamentals)
 

Recently uploaded

Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesPooky Knightsmith
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxCeline George
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismDabee Kamal
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................MirzaAbrarBaig5
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptxPoojaSen20
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...Nguyen Thanh Tu Collection
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesAmanpreetKaur157993
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project researchCaitlinCummins3
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi RajagopalEADTU
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxMarlene Maheu
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptxPoojaSen20
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFVivekanand Anglo Vedic Academy
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptxVishal Singh
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint23600690
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
Scopus Indexed Journals 2024 - ISCOPUS Publications
Scopus Indexed Journals 2024 - ISCOPUS PublicationsScopus Indexed Journals 2024 - ISCOPUS Publications
Scopus Indexed Journals 2024 - ISCOPUS PublicationsISCOPE Publication
 

Recently uploaded (20)

Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical Principles
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptx
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptx
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
Scopus Indexed Journals 2024 - ISCOPUS Publications
Scopus Indexed Journals 2024 - ISCOPUS PublicationsScopus Indexed Journals 2024 - ISCOPUS Publications
Scopus Indexed Journals 2024 - ISCOPUS Publications
 

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