SlideShare a Scribd company logo
Computer Technology Institute (CTI)
Programming Fundamentals Using Java
Lecture 1
Jawid Ahmad Niazi
Technical Institute of Ghazni
Prepared By: Jawid Ahmad Niazi 1
• Java technology is both a programming language and a platform
• The Java programming language is a high-level language that
can be characterized by all of the following
– Simple
– Architecture neutral
– Object oriented
– Portable
Prepared By: Jawid Ahmad Niazi 2
• In the Java programming language, all source code is first written in
plain text files ending with the .java extension.
• Those source files are then compiled into .class files by the Java
compiler (javac).
• A .class file does not contain code that is native to your processor;
it instead contains bytecodes-- the machine language of the Java
Virtual Machine.
Prepared By: Jawid Ahmad Niazi 3
Prepared By: Jawid Ahmad Niazi 4
• Name the person(s) who developed Java?
• Answer: Java was developed by James Gosling &
Patrick Naughton at Sun Microsystems, Inc. in 1991.
• What was the initial name of Java?
• Answer: Java language was initially called “Oak” and
was renamed “Java” in 1995.
• Important features of JAVA.
• Java is a platform - independent language It is highly
reliable
• It is a distributed language
• It is an object oriented language
• What kind of files contain Java source code?
• Answer: The Java source code is saved in files with names the end
with “.java”.
Prepared By: Jawid Ahmad Niazi 5
Prepared By: Jawid Ahmad Niazi 6
• What is source code?
• Answer: Source code is the plain text that makes up the part or
all of a computer program.
• What is bytecode?
• Answer: Bytecode is a low-level computer language translation
of Java source code program.
Prepared By: Jawid Ahmad Niazi 7
• The Java launcher tool (java) then runs your
application with an instance of the Java Virtual
Machine.
Prepared By: Jawid Ahmad Niazi 8
Platform
Independen
8
ce
Java
Program
Java
Compiler
(javac)
Java
Byte Code
Can be
executed
MS-DOS
Windows (X)
UNIX
Any other (O.S.)
Source Code JavaVirtual
Machine
Prepared By: Jawid Ahmad Niazi 9
• Because the Java Virtual Machine is available on
many different operating systems, the same .class
files are capable of running on
– Microsoft Windows,
– the Solaris TM Operating System (SolarisOS),
– Linux, or
– MacOS.
Prepared By: Jawid Ahmad Niazi 10
What is a Java virtual machine?
Answer: A Java virtual machine(JVM) is a software
system that translates and executes Java bytecode.
Name two types of Java programs?
Answer: We can develop two types of Java
programs
1. Stand-alone application
2. Web applets
Prepared By: Jawid Ahmad Niazi 11
• Your first application, HelloWorldApp, will simply
display the greeting "Hello world!". To create this
program, you will:
 Create a source file. A source file contains text,
written in the Java programming language, that you and
other programmers can understand. You can use any
text editor to create and edit source files.
 Compile the source file into a .class file. The Java
compiler, javac, takes your source file and translates its
text into instructions that the Java Virtual Machine can
understand. The instructions contained within this file
are known as bytecodes.
 Run the program. The Java launcher (java) uses the
Java Virtual Machine to run your application.
• First, start your editor. You can launch the NotePad editor from
the Start menu by selecting Programs > Accessories >
NotePad. In a new document, type in the following code:
• /**
• * The HelloWorldApp class implements an application that
• * simply displays "Hello World!" to the standard output.
• */
• class HelloWorldApp {
• public static void main(String[] args) {
• //Display "Hello World!"
• System.out.println("Hello World!");
• }
• }
• You can save the file as HelloWorldApp.java
Prepared By: Jawid Ahmad Niazi
Prepared By: Jawid Ahmad Niazi
• You can save the file as HelloWorldApp.java
13
Prepared By: Jawid Ahmad Niazi 14
• Bring up a shell, or "command," window
• You can do this from the Start menu by choosing MS-DOS
Prompt (Windows 7/8/10) or Command Prompt (Windows
NT/XP), or by choosing Run... and then entering cmd
Prepared By: Jawid Ahmad Niazi 15
• To Compile the Program, execute the compiler, javac, specifying
the name of the source file on the command line
C:> javac HelloWorldApp.java
• The java compiler creates a file called HelloWorldApp.class
• To run the program, we must use the Java Interpreter called
Java by,
java HelloWorldApp
• The output is displayed,
Hello World!
Lab Assignment
• 1. Write a program to display the following output
• My name is
I am years old
• I study in Technical Institute at Ghazni
Prepared By: Jawid Ahmad Niazi 16
Any Question……
Prepared By: Jawid Ahmad Niazi 17

More Related Content

What's hot

JAVA ENVIRONMENT
JAVA  ENVIRONMENTJAVA  ENVIRONMENT
JAVA ENVIRONMENT
josemachoco
 
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVMJava Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
shamnasain
 
Presentation on java (8)
Presentation on java (8)Presentation on java (8)
Presentation on java (8)
Shwetakant1
 
Learn Java Part 1
Learn Java Part 1Learn Java Part 1
Learn Java Part 1
Gurpreet singh
 
Java byte code presentation
Java byte code presentationJava byte code presentation
Java byte code presentation
Mahnoor Hashmi
 
Java Class 2
Java Class 2Java Class 2
Java Class 2
Mayank Aggarwal
 
Java Class1
Java Class1Java Class1
Java Class1
Mayank Aggarwal
 
Chapter 1 java
Chapter 1 java Chapter 1 java
Chapter 1 java
Ahmad sohail Kakar
 
History of Java 1/2
History of Java 1/2History of Java 1/2
History of Java 1/2
Eberhard Wolff
 
JDK,JRE,JVM
JDK,JRE,JVMJDK,JRE,JVM
JDK,JRE,JVM
Cognizant
 
QSpiders - Jdk Jvm Jre and Jit
QSpiders - Jdk Jvm Jre and JitQSpiders - Jdk Jvm Jre and Jit
QSpiders - Jdk Jvm Jre and Jit
Qspiders - Software Testing Training Institute
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to javaSujit Kumar
 
Java 1
Java 1Java 1
Presentation on Core java
Presentation on Core javaPresentation on Core java
Presentation on Core java
mahir jain
 
Introduction to Java Programming
Introduction to Java Programming Introduction to Java Programming
Introduction to Java Programming
Saravanakumar R
 
Programming in java ppt
Programming in java  pptProgramming in java  ppt
Programming in java ppt
MrsRBoomadeviIT
 
Introduction to Core Java Programming
Introduction to Core Java ProgrammingIntroduction to Core Java Programming
Introduction to Core Java Programming
Collaboration Technologies
 
Basic difference between jdk,jre,jvm in advance java course
Basic difference between jdk,jre,jvm in advance java courseBasic difference between jdk,jre,jvm in advance java course
Basic difference between jdk,jre,jvm in advance java course
Preeti Agarwal
 

What's hot (19)

JAVA ENVIRONMENT
JAVA  ENVIRONMENTJAVA  ENVIRONMENT
JAVA ENVIRONMENT
 
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVMJava Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
 
Presentation on java (8)
Presentation on java (8)Presentation on java (8)
Presentation on java (8)
 
Learn Java Part 1
Learn Java Part 1Learn Java Part 1
Learn Java Part 1
 
Java byte code presentation
Java byte code presentationJava byte code presentation
Java byte code presentation
 
JVM
JVMJVM
JVM
 
Java Class 2
Java Class 2Java Class 2
Java Class 2
 
Java Class1
Java Class1Java Class1
Java Class1
 
Chapter 1 java
Chapter 1 java Chapter 1 java
Chapter 1 java
 
History of Java 1/2
History of Java 1/2History of Java 1/2
History of Java 1/2
 
JDK,JRE,JVM
JDK,JRE,JVMJDK,JRE,JVM
JDK,JRE,JVM
 
QSpiders - Jdk Jvm Jre and Jit
QSpiders - Jdk Jvm Jre and JitQSpiders - Jdk Jvm Jre and Jit
QSpiders - Jdk Jvm Jre and Jit
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Java 1
Java 1Java 1
Java 1
 
Presentation on Core java
Presentation on Core javaPresentation on Core java
Presentation on Core java
 
Introduction to Java Programming
Introduction to Java Programming Introduction to Java Programming
Introduction to Java Programming
 
Programming in java ppt
Programming in java  pptProgramming in java  ppt
Programming in java ppt
 
Introduction to Core Java Programming
Introduction to Core Java ProgrammingIntroduction to Core Java Programming
Introduction to Core Java Programming
 
Basic difference between jdk,jre,jvm in advance java course
Basic difference between jdk,jre,jvm in advance java courseBasic difference between jdk,jre,jvm in advance java course
Basic difference between jdk,jre,jvm in advance java course
 

Similar to Lecture java01

JAVA First Day
JAVA First DayJAVA First Day
JAVA First Day
Sher Singh Bardhan
 
Dr. Rajeshree Khande :Intoduction to java
Dr. Rajeshree Khande :Intoduction to javaDr. Rajeshree Khande :Intoduction to java
Dr. Rajeshree Khande :Intoduction to java
DrRajeshreeKhande
 
Intoduction to java
Intoduction to javaIntoduction to java
Intoduction to java
jalinder123
 
J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01
Jay Palit
 
Java introduction
Java introductionJava introduction
Java introduction
logeswarisaravanan
 
Java & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate FrameworkJava & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate Framework
Mohit Belwal
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
Java Lover
 
basic core java up to operator
basic core java up to operatorbasic core java up to operator
basic core java up to operator
kamal kotecha
 
1 java intro
1 java intro1 java intro
Java ppt1
Java ppt1Java ppt1
Java ppt1
nikhilsh66131
 
Notes of java first unit
Notes of java first unitNotes of java first unit
Notes of java first unit
gowher172236
 
PPS Java Overview Unit I.ppt
PPS Java Overview Unit I.pptPPS Java Overview Unit I.ppt
PPS Java Overview Unit I.ppt
RajeshSukte1
 
PPS Java Overview Unit I.ppt
PPS Java Overview Unit I.pptPPS Java Overview Unit I.ppt
PPS Java Overview Unit I.ppt
CDSukte
 
Java1
Java1Java1
Java1
Java1Java1
Training on Core java | PPT Presentation | Shravan Sanidhya
Training on Core java | PPT Presentation | Shravan SanidhyaTraining on Core java | PPT Presentation | Shravan Sanidhya
Training on Core java | PPT Presentation | Shravan Sanidhya
Shravan Sanidhya
 
1.Intro--Why Java.pptx
1.Intro--Why Java.pptx1.Intro--Why Java.pptx
1.Intro--Why Java.pptx
YounasKhan542109
 
1 Introduction To Java Technology
1 Introduction To Java Technology 1 Introduction To Java Technology
1 Introduction To Java Technology
dM Technologies
 

Similar to Lecture java01 (20)

JAVA First Day
JAVA First DayJAVA First Day
JAVA First Day
 
Dr. Rajeshree Khande :Intoduction to java
Dr. Rajeshree Khande :Intoduction to javaDr. Rajeshree Khande :Intoduction to java
Dr. Rajeshree Khande :Intoduction to java
 
Intoduction to java
Intoduction to javaIntoduction to java
Intoduction to java
 
J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01
 
Java introduction
Java introductionJava introduction
Java introduction
 
Java & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate FrameworkJava & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate Framework
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
 
basic core java up to operator
basic core java up to operatorbasic core java up to operator
basic core java up to operator
 
1 java intro
1 java intro1 java intro
1 java intro
 
java intro.pptx
java intro.pptxjava intro.pptx
java intro.pptx
 
Java ppt1
Java ppt1Java ppt1
Java ppt1
 
Notes of java first unit
Notes of java first unitNotes of java first unit
Notes of java first unit
 
PPS Java Overview Unit I.ppt
PPS Java Overview Unit I.pptPPS Java Overview Unit I.ppt
PPS Java Overview Unit I.ppt
 
PPS Java Overview Unit I.ppt
PPS Java Overview Unit I.pptPPS Java Overview Unit I.ppt
PPS Java Overview Unit I.ppt
 
Java1
Java1Java1
Java1
 
Java1
Java1Java1
Java1
 
Training on Core java | PPT Presentation | Shravan Sanidhya
Training on Core java | PPT Presentation | Shravan SanidhyaTraining on Core java | PPT Presentation | Shravan Sanidhya
Training on Core java | PPT Presentation | Shravan Sanidhya
 
Introduction to java technology
Introduction to java technologyIntroduction to java technology
Introduction to java technology
 
1.Intro--Why Java.pptx
1.Intro--Why Java.pptx1.Intro--Why Java.pptx
1.Intro--Why Java.pptx
 
1 Introduction To Java Technology
1 Introduction To Java Technology 1 Introduction To Java Technology
1 Introduction To Java Technology
 

Recently uploaded

Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 

Recently uploaded (20)

Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 

Lecture java01

  • 1. Computer Technology Institute (CTI) Programming Fundamentals Using Java Lecture 1 Jawid Ahmad Niazi Technical Institute of Ghazni Prepared By: Jawid Ahmad Niazi 1
  • 2. • Java technology is both a programming language and a platform • The Java programming language is a high-level language that can be characterized by all of the following – Simple – Architecture neutral – Object oriented – Portable Prepared By: Jawid Ahmad Niazi 2
  • 3. • In the Java programming language, all source code is first written in plain text files ending with the .java extension. • Those source files are then compiled into .class files by the Java compiler (javac). • A .class file does not contain code that is native to your processor; it instead contains bytecodes-- the machine language of the Java Virtual Machine. Prepared By: Jawid Ahmad Niazi 3
  • 4. Prepared By: Jawid Ahmad Niazi 4 • Name the person(s) who developed Java? • Answer: Java was developed by James Gosling & Patrick Naughton at Sun Microsystems, Inc. in 1991. • What was the initial name of Java? • Answer: Java language was initially called “Oak” and was renamed “Java” in 1995.
  • 5. • Important features of JAVA. • Java is a platform - independent language It is highly reliable • It is a distributed language • It is an object oriented language • What kind of files contain Java source code? • Answer: The Java source code is saved in files with names the end with “.java”. Prepared By: Jawid Ahmad Niazi 5
  • 6. Prepared By: Jawid Ahmad Niazi 6 • What is source code? • Answer: Source code is the plain text that makes up the part or all of a computer program. • What is bytecode? • Answer: Bytecode is a low-level computer language translation of Java source code program.
  • 7. Prepared By: Jawid Ahmad Niazi 7 • The Java launcher tool (java) then runs your application with an instance of the Java Virtual Machine.
  • 8. Prepared By: Jawid Ahmad Niazi 8 Platform Independen 8 ce Java Program Java Compiler (javac) Java Byte Code Can be executed MS-DOS Windows (X) UNIX Any other (O.S.) Source Code JavaVirtual Machine
  • 9. Prepared By: Jawid Ahmad Niazi 9 • Because the Java Virtual Machine is available on many different operating systems, the same .class files are capable of running on – Microsoft Windows, – the Solaris TM Operating System (SolarisOS), – Linux, or – MacOS.
  • 10. Prepared By: Jawid Ahmad Niazi 10 What is a Java virtual machine? Answer: A Java virtual machine(JVM) is a software system that translates and executes Java bytecode. Name two types of Java programs? Answer: We can develop two types of Java programs 1. Stand-alone application 2. Web applets
  • 11. Prepared By: Jawid Ahmad Niazi 11 • Your first application, HelloWorldApp, will simply display the greeting "Hello world!". To create this program, you will:  Create a source file. A source file contains text, written in the Java programming language, that you and other programmers can understand. You can use any text editor to create and edit source files.  Compile the source file into a .class file. The Java compiler, javac, takes your source file and translates its text into instructions that the Java Virtual Machine can understand. The instructions contained within this file are known as bytecodes.  Run the program. The Java launcher (java) uses the Java Virtual Machine to run your application.
  • 12. • First, start your editor. You can launch the NotePad editor from the Start menu by selecting Programs > Accessories > NotePad. In a new document, type in the following code: • /** • * The HelloWorldApp class implements an application that • * simply displays "Hello World!" to the standard output. • */ • class HelloWorldApp { • public static void main(String[] args) { • //Display "Hello World!" • System.out.println("Hello World!"); • } • } • You can save the file as HelloWorldApp.java Prepared By: Jawid Ahmad Niazi
  • 13. Prepared By: Jawid Ahmad Niazi • You can save the file as HelloWorldApp.java 13
  • 14. Prepared By: Jawid Ahmad Niazi 14 • Bring up a shell, or "command," window • You can do this from the Start menu by choosing MS-DOS Prompt (Windows 7/8/10) or Command Prompt (Windows NT/XP), or by choosing Run... and then entering cmd
  • 15. Prepared By: Jawid Ahmad Niazi 15 • To Compile the Program, execute the compiler, javac, specifying the name of the source file on the command line C:> javac HelloWorldApp.java • The java compiler creates a file called HelloWorldApp.class • To run the program, we must use the Java Interpreter called Java by, java HelloWorldApp • The output is displayed, Hello World!
  • 16. Lab Assignment • 1. Write a program to display the following output • My name is I am years old • I study in Technical Institute at Ghazni Prepared By: Jawid Ahmad Niazi 16
  • 17. Any Question…… Prepared By: Jawid Ahmad Niazi 17