0% found this document useful (0 votes)
4 views16 pages

Introduction to Java Programming

The document is an introductory lecture on Java programming, outlining key concepts such as programming languages, the Java language itself, and object-oriented programming. It discusses the advantages of Java, the Java platform, and the compilation process, along with a simple example program. The lecture aims to provide foundational knowledge for understanding Java and its applications.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views16 pages

Introduction to Java Programming

The document is an introductory lecture on Java programming, outlining key concepts such as programming languages, the Java language itself, and object-oriented programming. It discusses the advantages of Java, the Java platform, and the compilation process, along with a simple example program. The lecture aims to provide foundational knowledge for understanding Java and its applications.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

D EPARTMENT OF I NFORMATION S YSTEMS

C OMPUTER S CIENCE FACULTY


K ABUL U NIVERSITY

Lecture 01. Introduction to Java Programming


Adapted from Java How To Program, 9th Edition, Paul & Harvey Deitel,
Deitel & Associates, inc.

By: Hedayat || Monday, Sept 30, 2024


O UTLINE

¡ Programming languages
¡ Introduction to Java
¡ Why Java
¡ Object Oriented Programming
¡ What is Java Platform
¡ How does Java compile programs
¡ Set the environment
¡ The first Java program

BY: HEDAYAT 2
W HAT IS A PROGRAMMING LANGUAGE?

¡ A programming language is an artificial language designed to communicate


instructions to a machine, particularly a computer.
¡ Programming languages can be used to create programs that control the
behavior of a machine and/or to express algorithms precisely.
¡ Examples: Java, C, C++, Visual Basic, Python …

BY: HEDAYAT 3
W HAT IS JAVA?

¡ Java is a programming language originally developed by James Gosling at Sun


Microsystems.
¡ Released in 1995 as a core component of Sun Microsystems' Java platform.
¡ The language derives much of its syntax from C and C++ but has a simpler object
model and fewer low-level facilities.
¡ Java applications are typically compiled to byte code (class file) that can run on
any Java Virtual Machine (JVM) regardless of computer architecture.

BY: HEDAYAT 4
W HAT IS JAVA?

¡ Java is a general-purpose, concurrent, class-based, object-oriented language that


is specifically designed to have as few implementation dependencies as possible.
¡ It is intended to let application developers "write once, run anywhere".
¡ Java is currently one of the most popular programming languages in use,
particularly for client-server web applications.

BY: HEDAYAT 5
W HY JAVA?

¡ Advantages and features:


¡ Platform independent
¡ Class Libraries
¡ Automatic Garbage Collection
¡ Java EE –Dynamic Web Application
¡ Java ME – Micro Edition for cell phone and PDA applications
¡ Java SE – Standard Edition
¡ Object Oriented Programming

BY: HEDAYAT 6
S O, WHAT IS OBJECT ORIENTED PROGRAMMING

¡ Object-oriented programming(OOP) is a programming paradigm using


"objects" – data structures consisting of data fields and methods together with
their interactions – to design applications and computer programs.
¡ Programming techniques may include features such as data abstraction,
encapsulation, messaging, modularity, polymorphism, and inheritance.
¡ Many modern programming languages now support OOP, at least as an option.

BY: HEDAYAT 7
W HAT IS JAVA P LATFORM?

¡ An edition of the Java platform is the name for a bundle of related programs from
Sun that allow for developing and running programs written in the Java
programming language.
¡ The platform is not specific to any one processor or operating system, but rather
an execution engine (called a virtual machine) and a compiler with a set of
libraries that are implemented for various hardware (called a virtual machine)
and operating systems so that Java programs can run identically on all of them.

BY: HEDAYAT 8
W HAT IS JAVA P LATFORM?

¡ The Java Platform consists of several programs, each of which provides a distinct
portion of its overall capabilities.
¡ For example, the Java compiler, which converts Java source code into Java byte code, is
provided as part of the Java Development Kit (JDK).
¡ The Java Runtime Environment (JRE), complementing the JVM with a just-in-time
(JIT) compiler, converts intermediate byte code into native machine code on the
fly.

BY: HEDAYAT 9
T HE JVM AND JRE

¡ A Java Virtual Machine is a piece of software that is implemented on non-virtual


hardware and on standard operating systems.
¡ Java's execution environment is termed the Java Runtime Environment, or JRE.
¡ It executes .class and .jar files by using the just-in time (JIT) compiler.

BY: HEDAYAT 10
T HE SDK

¡ The JDK has as its primary components a collection of programming tools,


including:
¡ java – the loader for Java applications. This tool is an interpreter and can interpret the
class files generated by the javac compiler. Now a single launcher is used for both
development and deployment. The old deployment launcher, jre, no longer comes
with Sun JDK.
¡ javac – the compiler, which converts source code into Java byte code.
¡ javadoc – the documentation generator, which automatically generates
documentation from source code comments
BY: HEDAYAT 11
C OMPILATION P ROCESS

BY: HEDAYAT 12
T HE F IRST PROGRAM

public class HelloWorld {


public static void main(String args[]){
[Link]("Hello World!");
}

¡ Note that String is built in


¡ println is a member function for the [Link] class

BY: HEDAYAT 13
RUNNING THE PROGRAM

¡ Set the environment, Install java on your machine,


¡ Configuring CLI to run java program
¡ setting up PATH variable
¡ Using an IDE (Eclipse, Netbeans)

BY: HEDAYAT 14
TO S UM UP

¡ You now know:


¡ Programming languages
¡ What is Java
¡ Advantages of Java
¡ Object Oriented Programming
¡ What is Java Platform
¡ How does Java compile programs
¡ The first Java program
BY: HEDAYAT 15
T HE E ND

BY: HEDAYAT 16

You might also like