SlideShare a Scribd company logo
 Course Objectives
 Organization of the Book
1
 Upon completing the course, you will understand
◦ Create, compile, and run Java programs
◦ Primitive data types
◦ Java control flow
◦ Methods
◦ Arrays (for teaching Java in two semesters, this could be the
end)
◦ Object-oriented programming
◦ Core Java classes (Swing, exception,
internationalization, multithreading, multimedia, I/O,
networking, Java Collections Framework)
2
 You will be able to
◦ Develop programs using Forte
◦ Write simple programs using primitive data types,
control statements, methods, and arrays.
◦ Create and use methods
◦ Develop a GUI interface and Java applets
◦ Write interesting projects
◦ Establish a firm foundation on Java concepts
3
 Part I: Fundamentals of Programming
◦ Chapter 1 Introduction to Java
◦ Chapter 2 Primitive Data Types and Operations
◦ Chapter 3 Control Statements
◦ Chapter 4 Methods
◦ Chapter 5 Arrays
4
 Part II: Object-Oriented Programming
◦ Chapter 6 Objects and Classes
◦ Chapter 7 Strings
◦ Chapter 8 Class Inheritance and Interfaces
◦ Chapter 9 Object-Oriented Software Development
5
 Part III: GUI Programming
◦ Chapter 10 Getting Started with GUI Programming
◦ Chapter 11 Creating User Interfaces
◦ Chapter 12 Applets and Advanced GUI
6
 Part IV: Developing Comprehensive Projects
◦ Chapter 13 Exception Handling
◦ Chapter 14 Internationalization
◦ Chapter 15 Multithreading
◦ Chapter 16 Multimedia
◦ Chapter 17 Input and Output
◦ Chapter 18 Networking
◦ Chapter 19 Java Data Structures
7
 What Is Java?
 Getting Started With Java Programming
◦ Create, Compile and Running a Java Application
8
 History
 Characteristics of Java
9
 James Gosling and Sun Microsystems
 Oak
 Java, May 20, 1995, Sun World
 HotJava
◦ The first Java-enabled Web browser
 JDK Evolutions
 J2SE, J2ME, and J2EE (not mentioned in the
book, but could discuss here optionally)
10
 Java is simple
 Java is object-oriented
 Java is distributed
 Java is interpreted
 Java is robust
 Java is secure
 Java is architecture-neutral
 Java is portable
 Java’s performance
 Java is multithreaded
 Java is dynamic
11
 JDK 1.02 (1995)
 JDK 1.1 (1996)
 Java 2 SDK v 1.2 (a.k.a JDK 1.2, 1998)
 Java 2 SDK v 1.3 (a.k.a JDK 1.3, 2000)
 Java 2 SDK v 1.4 (a.k.a JDK 1.4, 2002)
12
 Java Standard Edition (J2SE)
◦ J2SE can be used to develop client-side standalone
applications or applets.
 Java Enterprise Edition (J2EE)
◦ J2EE can be used to develop server-side applications
such as Java servlets and Java ServerPages.
 Java Micro Edition (J2ME).
◦ J2ME can be used to develop applications for mobile
devices such as cell phones.
This book uses J2SE to introduce Java
programming.
13
 Forte by Sun MicroSystems
 Borland JBuilder
 Microsoft Visual J++
 WebGain Café
 IBM Visual Age for Java
14
 A Simple Java Application
 Compiling Programs
 Executing Applications
15
Example 1.1
//This application program prints Welcome
//to Java!
package chapter1;
public class Welcome {
public static void main(String[] args) {
System.out.println("Welcome to Java!");
}
}
16
RunRunSourceSource
NOTE: To run the program,
install slide files on hard
disk.
 On command line
◦ javac file.java
17
Source Code
Create/Modify Source Code
Compile Source Code
i.e. javac Welcome.java
Bytecode
Run Byteode
i.e. java Welcome
Result
If compilation errors
If runtime errors or incorrect result
 On command line
◦ java classname
18
Java
Interpreter
on Windows
Java
Interpreter
on Sun Solaris
Java
Interpreter
on Linux
Bytecode
...
javac Welcome.java
java Welcome
output:...
19
20
Where are the files
stored in the
directory?c:example
chapter1 Welcome.class
Welcome.java
chapter2
.
.
.
Java source files and class files for Chapter 2
chapter19 Java source files and class files for Chapter 19
Welcome.java~
 Comments
 Package
 Reserved words
 Modifiers
 Statements
 Blocks
 Classes
 Methods
 The main method
21
In Java, comments are
preceded by two slashes (//)
in a line, or enclosed
between /* and */ in one or
multiple lines. When the
compiler sees //, it ignores
all text after // in the
same line. When it sees /*,
22
The second line in the program
(package chapter1;) specifies a package
name, chapter1, for the class Welcome.
Forte compiles the source code in
Welcome.java, generates
Welcome.class, and stores
Welcome.class in the chapter1 folder.
23
Reserved words or keywords are
words that have a specific
meaning to the compiler and
cannot be used for other
purposes in the program. For
example, when the compiler sees
the word class, it understands
that the word after class is the
name for the class. Other
reserved words in Example 1.1
are public, static, and void.
Their use will be introduced 24
Java uses certain reserved words called
modifiers that specify the properties of the
data, methods, and classes and how they
can be used. Examples of modifiers are
public and static. Other modifiers are
private, final, abstract, and protected. A
public datum, method, or class can be
accessed by other programs. A private
datum or method cannot be accessed by
other programs. Modifiers are discussed in
Chapter 6, "Objects and Classes."
25
A statement represents an
action or a sequence of
actions. The statement
System.out.println("Welcome
to Java!") in the program in
Example 1.1 is a statement
to display the greeting
"Welcome to Java!" Every
statement in Java ends with 26
27
A pair of braces in a program
forms a block that groups
components of a program.
public class Test {
public static void main(String[] args) {
System.out.println("Welcome to Java!");
}
}
Class block
Method block
The class is the essential Java
construct. A class is a template
or blueprint for objects. To
program in Java, you must
understand classes and be able
to write and use them. The
mystery of the class will
continue to be unveiled
throughout this book. For now,
though, understand that a 28
What is System.out.println? It is a method: a
collection of statements that performs a
sequence of operations to display a
message on the console. It can be used
even without fully understanding the
details of how it works. It is used by
invoking a statement with a string
argument. The string argument is enclosed
within parentheses. In this case, the
argument is "Welcome to Java!" You can
call the same println method with a
different argument to print a different
message. 29
The main method provides the
control of program flow. The
Java interpreter executes the
application by invoking the main
method.
The main method looks like this:
public static void main(String[]
args) {
// Statements; 30
you can use the showMessageDialog
method in the JOptionPane class.
JOptionPane is one of the many
predefined classes in the Java system,
which can be reused rather than
“reinventing the wheel.”
31
RunRunSourceSource
JOptionPane.showMessageDialog(null, "Welcome to
Java!",
"Example 1.2",
JOptionPane.INFORMATION_MESSAGE));
32
Use Exit to terminate the program and stop
all threads.
NOTE: When your program starts, a thread
is spawned to run the program. When the
showMessageDialog is invoked, a separate
thread is spawned to run this method. The
thread is not terminated even you close the
dialog box. To terminate the thread, you
have to invoke the exit method.
33

More Related Content

What's hot

Java training in delhi
Java training in delhiJava training in delhi
Java training in delhi
APSMIND TECHNOLOGY PVT LTD.
 
Chapter 1. java programming language overview
Chapter 1. java programming language overviewChapter 1. java programming language overview
Chapter 1. java programming language overviewJong Soon Bok
 
Java programming language
Java programming languageJava programming language
Java programming language
SubhashKumar329
 
Introduction to Java -unit-1
Introduction to Java -unit-1Introduction to Java -unit-1
Introduction to Java -unit-1
RubaNagarajan
 
Java programming(unit 1)
Java programming(unit 1)Java programming(unit 1)
Java programming(unit 1)
SURBHI SAROHA
 
Chapter 1 introduction to java technology
Chapter 1 introduction to java technologyChapter 1 introduction to java technology
Chapter 1 introduction to java technologysshhzap
 
Lecture - 1 introduction to java
Lecture - 1 introduction to javaLecture - 1 introduction to java
Lecture - 1 introduction to java
manish kumar
 
Introduction to Java Programming
Introduction to Java Programming Introduction to Java Programming
Introduction to Java Programming
Saravanakumar R
 
Features of java
Features of javaFeatures of java
Features of java
laratechnologies
 
Java programming course for beginners
Java programming course for beginnersJava programming course for beginners
Java programming course for beginners
Eduonix Learning Solutions
 
Java Notes
Java Notes Java Notes
Java Notes
Sreedhar Chowdam
 
java packages
java packagesjava packages
java packages
aptechsravan
 
Packages in java
Packages in javaPackages in java
Packages in java
Jerlin Sundari
 
Packages access protection, importing packages
Packages   access protection, importing packagesPackages   access protection, importing packages
Packages access protection, importing packages
TharuniDiddekunta
 
Basic of Java
Basic of JavaBasic of Java
Basic of Java
Ajeet Kumar Verma
 
Introducing Java 7
Introducing Java 7Introducing Java 7
Introducing Java 7
Markus Eisele
 
Java and its features
Java and its featuresJava and its features
Java and its features
Pydi Nikhil
 
1
11
JAVA PPT by NAVEEN TOKAS
JAVA PPT by NAVEEN TOKASJAVA PPT by NAVEEN TOKAS
JAVA PPT by NAVEEN TOKAS
NAVEEN TOKAS
 
Java Programming for Designers
Java Programming for DesignersJava Programming for Designers
Java Programming for Designers
R. Sosa
 

What's hot (20)

Java training in delhi
Java training in delhiJava training in delhi
Java training in delhi
 
Chapter 1. java programming language overview
Chapter 1. java programming language overviewChapter 1. java programming language overview
Chapter 1. java programming language overview
 
Java programming language
Java programming languageJava programming language
Java programming language
 
Introduction to Java -unit-1
Introduction to Java -unit-1Introduction to Java -unit-1
Introduction to Java -unit-1
 
Java programming(unit 1)
Java programming(unit 1)Java programming(unit 1)
Java programming(unit 1)
 
Chapter 1 introduction to java technology
Chapter 1 introduction to java technologyChapter 1 introduction to java technology
Chapter 1 introduction to java technology
 
Lecture - 1 introduction to java
Lecture - 1 introduction to javaLecture - 1 introduction to java
Lecture - 1 introduction to java
 
Introduction to Java Programming
Introduction to Java Programming Introduction to Java Programming
Introduction to Java Programming
 
Features of java
Features of javaFeatures of java
Features of java
 
Java programming course for beginners
Java programming course for beginnersJava programming course for beginners
Java programming course for beginners
 
Java Notes
Java Notes Java Notes
Java Notes
 
java packages
java packagesjava packages
java packages
 
Packages in java
Packages in javaPackages in java
Packages in java
 
Packages access protection, importing packages
Packages   access protection, importing packagesPackages   access protection, importing packages
Packages access protection, importing packages
 
Basic of Java
Basic of JavaBasic of Java
Basic of Java
 
Introducing Java 7
Introducing Java 7Introducing Java 7
Introducing Java 7
 
Java and its features
Java and its featuresJava and its features
Java and its features
 
1
11
1
 
JAVA PPT by NAVEEN TOKAS
JAVA PPT by NAVEEN TOKASJAVA PPT by NAVEEN TOKAS
JAVA PPT by NAVEEN TOKAS
 
Java Programming for Designers
Java Programming for DesignersJava Programming for Designers
Java Programming for Designers
 

Similar to Java intro

01slide
01slide01slide
01slide
Horesh Kumar
 
Core java-introduction
Core java-introductionCore java-introduction
Core java-introduction
Ramlal Pawar
 
01slide (1)ffgfefge
01slide (1)ffgfefge01slide (1)ffgfefge
01slide (1)ffgfefge
bsnl007
 
Professional-core-java-training
Professional-core-java-trainingProfessional-core-java-training
Professional-core-java-training
Vibrant Technologies & Computers
 
Java course-in-mumbai
Java course-in-mumbaiJava course-in-mumbai
Java course-in-mumbai
Unmesh Baile
 
Professional-core-java-training
Professional-core-java-trainingProfessional-core-java-training
Professional-core-java-training
Vibrant Technologies & Computers
 
Basics of java 1
Basics of java 1Basics of java 1
Basics of java 1
Vijay Kankane
 
OOP with Java
OOP with JavaOOP with Java
OOP with Java
OmegaHub
 
Java Standard edition(Java ) programming Basics for beginner's
Java Standard edition(Java ) programming Basics  for beginner'sJava Standard edition(Java ) programming Basics  for beginner's
Java Standard edition(Java ) programming Basics for beginner's
momin6
 
Chapter 2.1
Chapter 2.1Chapter 2.1
Chapter 2.1sotlsoc
 
Introduction to java programming tutorial
Introduction to java programming   tutorialIntroduction to java programming   tutorial
Introduction to java programming tutorial
jackschitze
 
Introduction
IntroductionIntroduction
Introduction
richsoden
 
Java chapter 1
Java   chapter 1Java   chapter 1
Java chapter 1
Mukesh Tekwani
 
Unit1 introduction to Java
Unit1 introduction to JavaUnit1 introduction to Java
Unit1 introduction to Java
DevaKumari Vijay
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to Java
Professional Guru
 
Javanotes
JavanotesJavanotes
Javanotes
John Cutajar
 
Java for Mainframers
Java for MainframersJava for Mainframers
Java for Mainframers
Rich Helton
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objects
vmadan89
 
Java introduction
Java introductionJava introduction
Java introduction
logeswarisaravanan
 

Similar to Java intro (20)

01slide
01slide01slide
01slide
 
Core java-introduction
Core java-introductionCore java-introduction
Core java-introduction
 
01slide (1)ffgfefge
01slide (1)ffgfefge01slide (1)ffgfefge
01slide (1)ffgfefge
 
Professional-core-java-training
Professional-core-java-trainingProfessional-core-java-training
Professional-core-java-training
 
Java course-in-mumbai
Java course-in-mumbaiJava course-in-mumbai
Java course-in-mumbai
 
Professional-core-java-training
Professional-core-java-trainingProfessional-core-java-training
Professional-core-java-training
 
Basics of java 1
Basics of java 1Basics of java 1
Basics of java 1
 
OOP with Java
OOP with JavaOOP with Java
OOP with Java
 
01slide
01slide01slide
01slide
 
Java Standard edition(Java ) programming Basics for beginner's
Java Standard edition(Java ) programming Basics  for beginner'sJava Standard edition(Java ) programming Basics  for beginner's
Java Standard edition(Java ) programming Basics for beginner's
 
Chapter 2.1
Chapter 2.1Chapter 2.1
Chapter 2.1
 
Introduction to java programming tutorial
Introduction to java programming   tutorialIntroduction to java programming   tutorial
Introduction to java programming tutorial
 
Introduction
IntroductionIntroduction
Introduction
 
Java chapter 1
Java   chapter 1Java   chapter 1
Java chapter 1
 
Unit1 introduction to Java
Unit1 introduction to JavaUnit1 introduction to Java
Unit1 introduction to Java
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to Java
 
Javanotes
JavanotesJavanotes
Javanotes
 
Java for Mainframers
Java for MainframersJava for Mainframers
Java for Mainframers
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objects
 
Java introduction
Java introductionJava introduction
Java introduction
 

More from husnara mohammad

Jsp intro
Jsp introJsp intro
Jsp intro
husnara mohammad
 
Hibernate
HibernateHibernate
Hibernate
husnara mohammad
 
Spring frame work
Spring frame workSpring frame work
Spring frame work
husnara mohammad
 
Php with my sql
Php with my sqlPhp with my sql
Php with my sql
husnara mohammad
 
Asp dot net
Asp dot netAsp dot net
Asp dot net
husnara mohammad
 
Hibernate introduction
Hibernate introductionHibernate introduction
Hibernate introduction
husnara mohammad
 
Selenium
SeleniumSelenium
Sql introduction
Sql introductionSql introduction
Sql introduction
husnara mohammad
 
Ruby on Rails
Ruby on RailsRuby on Rails
Ruby on Rails
husnara mohammad
 
C++ basics
C++ basicsC++ basics
C++ basics
husnara mohammad
 
Ajax basic intro
Ajax basic introAjax basic intro
Ajax basic intro
husnara mohammad
 
Backbone js
Backbone jsBackbone js
Backbone js
husnara mohammad
 
Web attacks
Web attacksWeb attacks
Web attacks
husnara mohammad
 

More from husnara mohammad (16)

Ajax
AjaxAjax
Ajax
 
Log4e
Log4eLog4e
Log4e
 
Jsp intro
Jsp introJsp intro
Jsp intro
 
Hibernate
HibernateHibernate
Hibernate
 
J2EE
J2EEJ2EE
J2EE
 
Spring frame work
Spring frame workSpring frame work
Spring frame work
 
Php with my sql
Php with my sqlPhp with my sql
Php with my sql
 
Asp dot net
Asp dot netAsp dot net
Asp dot net
 
Hibernate introduction
Hibernate introductionHibernate introduction
Hibernate introduction
 
Selenium
SeleniumSelenium
Selenium
 
Sql introduction
Sql introductionSql introduction
Sql introduction
 
Ruby on Rails
Ruby on RailsRuby on Rails
Ruby on Rails
 
C++ basics
C++ basicsC++ basics
C++ basics
 
Ajax basic intro
Ajax basic introAjax basic intro
Ajax basic intro
 
Backbone js
Backbone jsBackbone js
Backbone js
 
Web attacks
Web attacksWeb attacks
Web attacks
 

Recently uploaded

Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 

Recently uploaded (20)

Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 

Java intro

  • 1.  Course Objectives  Organization of the Book 1
  • 2.  Upon completing the course, you will understand ◦ Create, compile, and run Java programs ◦ Primitive data types ◦ Java control flow ◦ Methods ◦ Arrays (for teaching Java in two semesters, this could be the end) ◦ Object-oriented programming ◦ Core Java classes (Swing, exception, internationalization, multithreading, multimedia, I/O, networking, Java Collections Framework) 2
  • 3.  You will be able to ◦ Develop programs using Forte ◦ Write simple programs using primitive data types, control statements, methods, and arrays. ◦ Create and use methods ◦ Develop a GUI interface and Java applets ◦ Write interesting projects ◦ Establish a firm foundation on Java concepts 3
  • 4.  Part I: Fundamentals of Programming ◦ Chapter 1 Introduction to Java ◦ Chapter 2 Primitive Data Types and Operations ◦ Chapter 3 Control Statements ◦ Chapter 4 Methods ◦ Chapter 5 Arrays 4
  • 5.  Part II: Object-Oriented Programming ◦ Chapter 6 Objects and Classes ◦ Chapter 7 Strings ◦ Chapter 8 Class Inheritance and Interfaces ◦ Chapter 9 Object-Oriented Software Development 5
  • 6.  Part III: GUI Programming ◦ Chapter 10 Getting Started with GUI Programming ◦ Chapter 11 Creating User Interfaces ◦ Chapter 12 Applets and Advanced GUI 6
  • 7.  Part IV: Developing Comprehensive Projects ◦ Chapter 13 Exception Handling ◦ Chapter 14 Internationalization ◦ Chapter 15 Multithreading ◦ Chapter 16 Multimedia ◦ Chapter 17 Input and Output ◦ Chapter 18 Networking ◦ Chapter 19 Java Data Structures 7
  • 8.  What Is Java?  Getting Started With Java Programming ◦ Create, Compile and Running a Java Application 8
  • 10.  James Gosling and Sun Microsystems  Oak  Java, May 20, 1995, Sun World  HotJava ◦ The first Java-enabled Web browser  JDK Evolutions  J2SE, J2ME, and J2EE (not mentioned in the book, but could discuss here optionally) 10
  • 11.  Java is simple  Java is object-oriented  Java is distributed  Java is interpreted  Java is robust  Java is secure  Java is architecture-neutral  Java is portable  Java’s performance  Java is multithreaded  Java is dynamic 11
  • 12.  JDK 1.02 (1995)  JDK 1.1 (1996)  Java 2 SDK v 1.2 (a.k.a JDK 1.2, 1998)  Java 2 SDK v 1.3 (a.k.a JDK 1.3, 2000)  Java 2 SDK v 1.4 (a.k.a JDK 1.4, 2002) 12
  • 13.  Java Standard Edition (J2SE) ◦ J2SE can be used to develop client-side standalone applications or applets.  Java Enterprise Edition (J2EE) ◦ J2EE can be used to develop server-side applications such as Java servlets and Java ServerPages.  Java Micro Edition (J2ME). ◦ J2ME can be used to develop applications for mobile devices such as cell phones. This book uses J2SE to introduce Java programming. 13
  • 14.  Forte by Sun MicroSystems  Borland JBuilder  Microsoft Visual J++  WebGain Café  IBM Visual Age for Java 14
  • 15.  A Simple Java Application  Compiling Programs  Executing Applications 15
  • 16. Example 1.1 //This application program prints Welcome //to Java! package chapter1; public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } 16 RunRunSourceSource NOTE: To run the program, install slide files on hard disk.
  • 17.  On command line ◦ javac file.java 17 Source Code Create/Modify Source Code Compile Source Code i.e. javac Welcome.java Bytecode Run Byteode i.e. java Welcome Result If compilation errors If runtime errors or incorrect result
  • 18.  On command line ◦ java classname 18 Java Interpreter on Windows Java Interpreter on Sun Solaris Java Interpreter on Linux Bytecode ...
  • 20. 20 Where are the files stored in the directory?c:example chapter1 Welcome.class Welcome.java chapter2 . . . Java source files and class files for Chapter 2 chapter19 Java source files and class files for Chapter 19 Welcome.java~
  • 21.  Comments  Package  Reserved words  Modifiers  Statements  Blocks  Classes  Methods  The main method 21
  • 22. In Java, comments are preceded by two slashes (//) in a line, or enclosed between /* and */ in one or multiple lines. When the compiler sees //, it ignores all text after // in the same line. When it sees /*, 22
  • 23. The second line in the program (package chapter1;) specifies a package name, chapter1, for the class Welcome. Forte compiles the source code in Welcome.java, generates Welcome.class, and stores Welcome.class in the chapter1 folder. 23
  • 24. Reserved words or keywords are words that have a specific meaning to the compiler and cannot be used for other purposes in the program. For example, when the compiler sees the word class, it understands that the word after class is the name for the class. Other reserved words in Example 1.1 are public, static, and void. Their use will be introduced 24
  • 25. Java uses certain reserved words called modifiers that specify the properties of the data, methods, and classes and how they can be used. Examples of modifiers are public and static. Other modifiers are private, final, abstract, and protected. A public datum, method, or class can be accessed by other programs. A private datum or method cannot be accessed by other programs. Modifiers are discussed in Chapter 6, "Objects and Classes." 25
  • 26. A statement represents an action or a sequence of actions. The statement System.out.println("Welcome to Java!") in the program in Example 1.1 is a statement to display the greeting "Welcome to Java!" Every statement in Java ends with 26
  • 27. 27 A pair of braces in a program forms a block that groups components of a program. public class Test { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } Class block Method block
  • 28. The class is the essential Java construct. A class is a template or blueprint for objects. To program in Java, you must understand classes and be able to write and use them. The mystery of the class will continue to be unveiled throughout this book. For now, though, understand that a 28
  • 29. What is System.out.println? It is a method: a collection of statements that performs a sequence of operations to display a message on the console. It can be used even without fully understanding the details of how it works. It is used by invoking a statement with a string argument. The string argument is enclosed within parentheses. In this case, the argument is "Welcome to Java!" You can call the same println method with a different argument to print a different message. 29
  • 30. The main method provides the control of program flow. The Java interpreter executes the application by invoking the main method. The main method looks like this: public static void main(String[] args) { // Statements; 30
  • 31. you can use the showMessageDialog method in the JOptionPane class. JOptionPane is one of the many predefined classes in the Java system, which can be reused rather than “reinventing the wheel.” 31 RunRunSourceSource
  • 32. JOptionPane.showMessageDialog(null, "Welcome to Java!", "Example 1.2", JOptionPane.INFORMATION_MESSAGE)); 32
  • 33. Use Exit to terminate the program and stop all threads. NOTE: When your program starts, a thread is spawned to run the program. When the showMessageDialog is invoked, a separate thread is spawned to run this method. The thread is not terminated even you close the dialog box. To terminate the thread, you have to invoke the exit method. 33