SlideShare a Scribd company logo
Introduction to Java Programming, 4E Y. Daniel Liang
Introduction Course Objectives Organization of the Book
Course Objectives 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)
Course Objectives, cont. 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
Book Chapters 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
Book Chapters, cont. 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
Book Chapters, cont. Part III: GUI Programming Chapter 10 Getting Started with GUI Programming  Chapter 11 Creating User Interfaces  Chapter 12 Applets and Advanced GUI
Book Chapters, cont. 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
Chapter 1 Introduction to Java and Forte What Is Java? Getting Started With Java Programming Create, Compile and Running a Java Application
What Is Java? History Characteristics of Java
History 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)
Characteristics of Java 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
JDK Versions 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)
JDK Editions 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.
Java IDE Tools Forte by Sun MicroSystems  Borland JBuilder Microsoft Visual J++ WebGain Café  IBM Visual Age for Java
Getting Started with Java Programming A Simple Java Application Compiling Programs Executing Applications
A Simple Application 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!"); } } Run Source NOTE: To run the program,  install slide files on hard disk.
Creating and Compiling Programs On command line javac file.java
Executing Applications On command line java classname
Example javac Welcome.java java Welcome output:...
Compiling and Running a Program Where are the files stored in the directory?
Anatomy of a Java Program Comments Package Reserved words Modifiers Statements Blocks Classes Methods The main method
Comments 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  /* , it scans for the next  */  and ignores any text between  /*  and  */ .
Package 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.
Reserved Words 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 later in the book.
Modifiers 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."
Statements 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 a semicolon (;).
Blocks A pair of braces in a program forms a block that groups components of a program.
Classes 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 program is defined by using one or more classes.
Methods 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.
main Method 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; }
Displaying Text in a Message Dialog Box 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.”  Run Source
The showMessageDialog Method  JOptionPane.showMessageDialog(null, "Welcome to Java!", "Example 1.2", JOptionPane.INFORMATION_MESSAGE));
The exit Method  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.
Ad

More Related Content

What's hot (19)

Java programming course for beginners
Java programming course for beginnersJava programming course for beginners
Java programming course for beginners
Eduonix Learning Solutions
 
Introduction to java technology
Introduction to java technologyIntroduction to java technology
Introduction to java technology
Indika Munaweera Kankanamge
 
Introduction
IntroductionIntroduction
Introduction
richsoden
 
Java features
Java featuresJava features
Java features
Prashant Gajendra
 
Java Programming for Designers
Java Programming for DesignersJava Programming for Designers
Java Programming for Designers
R. Sosa
 
Java Presentation For Syntax
Java Presentation For SyntaxJava Presentation For Syntax
Java Presentation For Syntax
PravinYalameli
 
Core Java Introduction | Basics
Core Java Introduction  | BasicsCore Java Introduction  | Basics
Core Java Introduction | Basics
Hùng Nguyễn Huy
 
Chapter 1. java programming language overview
Chapter 1. java programming language overviewChapter 1. java programming language overview
Chapter 1. java programming language overview
Jong Soon Bok
 
Java Presentation
Java PresentationJava Presentation
Java Presentation
pm2214
 
Bt0074 oops with java2
Bt0074 oops with java2Bt0074 oops with java2
Bt0074 oops with java2
Techglyphs
 
Java Notes
Java Notes Java Notes
Java Notes
Sreedhar Chowdam
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objects
vmadan89
 
Introduction to Java -unit-1
Introduction to Java -unit-1Introduction to Java -unit-1
Introduction to Java -unit-1
RubaNagarajan
 
JAVA Object Oriented Programming (OOP)
JAVA Object Oriented Programming (OOP)JAVA Object Oriented Programming (OOP)
JAVA Object Oriented Programming (OOP)
Prof. Erwin Globio
 
Java notes
Java notesJava notes
Java notes
Manish Swarnkar
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
jayc8586
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java Programming
Math-Circle
 
Java seminar
Java seminarJava seminar
Java seminar
devendrakhairwa
 
Core java course syllabus
Core java course syllabusCore java course syllabus
Core java course syllabus
Papitha Velumani
 
Introduction
IntroductionIntroduction
Introduction
richsoden
 
Java Programming for Designers
Java Programming for DesignersJava Programming for Designers
Java Programming for Designers
R. Sosa
 
Java Presentation For Syntax
Java Presentation For SyntaxJava Presentation For Syntax
Java Presentation For Syntax
PravinYalameli
 
Core Java Introduction | Basics
Core Java Introduction  | BasicsCore Java Introduction  | Basics
Core Java Introduction | Basics
Hùng Nguyễn Huy
 
Chapter 1. java programming language overview
Chapter 1. java programming language overviewChapter 1. java programming language overview
Chapter 1. java programming language overview
Jong Soon Bok
 
Java Presentation
Java PresentationJava Presentation
Java Presentation
pm2214
 
Bt0074 oops with java2
Bt0074 oops with java2Bt0074 oops with java2
Bt0074 oops with java2
Techglyphs
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objects
vmadan89
 
Introduction to Java -unit-1
Introduction to Java -unit-1Introduction to Java -unit-1
Introduction to Java -unit-1
RubaNagarajan
 
JAVA Object Oriented Programming (OOP)
JAVA Object Oriented Programming (OOP)JAVA Object Oriented Programming (OOP)
JAVA Object Oriented Programming (OOP)
Prof. Erwin Globio
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
jayc8586
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java Programming
Math-Circle
 

Viewers also liked (15)

Kalpesh-Maintenance (BE-Mechanical)Press
Kalpesh-Maintenance (BE-Mechanical)Press Kalpesh-Maintenance (BE-Mechanical)Press
Kalpesh-Maintenance (BE-Mechanical)Press
Kalpesh Parmar
 
Slideshare
SlideshareSlideshare
Slideshare
TalkReal
 
Readme
ReadmeReadme
Readme
kuponjia
 
Presentación1
Presentación1Presentación1
Presentación1
Jholman Camilo Mora
 
Do not change your workspace ..
Do not change your workspace ..Do not change your workspace ..
Do not change your workspace ..
Mark Haynes
 
TECON Company Profile
TECON Company ProfileTECON Company Profile
TECON Company Profile
Gunter R. Schillinger
 
ejercicio 11 anova
ejercicio 11 anovaejercicio 11 anova
ejercicio 11 anova
panchohouse
 
Videojuegos
VideojuegosVideojuegos
Videojuegos
robdansgaming
 
CURRICULUM VITAE new
CURRICULUM VITAE newCURRICULUM VITAE new
CURRICULUM VITAE new
Vikram Patel
 
Marchitez vascular o wilt
Marchitez vascular o wiltMarchitez vascular o wilt
Marchitez vascular o wilt
Ruben Infantes Vargas
 
2016.9.4 揚聲歌唱,寶貴十架,我心切切渴慕祢
2016.9.4 揚聲歌唱,寶貴十架,我心切切渴慕祢2016.9.4 揚聲歌唱,寶貴十架,我心切切渴慕祢
2016.9.4 揚聲歌唱,寶貴十架,我心切切渴慕祢
Ruru Chien
 
如何趕鬼
如何趕鬼如何趕鬼
如何趕鬼
Ruru Chien
 
Liderazgo emocional
Liderazgo emocional Liderazgo emocional
Liderazgo emocional
Cindy Jimenez-Vera
 
Oral manifestations of nutritional deficiencies
Oral manifestations of nutritional deficienciesOral manifestations of nutritional deficiencies
Oral manifestations of nutritional deficiencies
Arsalan Wahid Malik
 
Kalpesh-Maintenance (BE-Mechanical)Press
Kalpesh-Maintenance (BE-Mechanical)Press Kalpesh-Maintenance (BE-Mechanical)Press
Kalpesh-Maintenance (BE-Mechanical)Press
Kalpesh Parmar
 
Slideshare
SlideshareSlideshare
Slideshare
TalkReal
 
Do not change your workspace ..
Do not change your workspace ..Do not change your workspace ..
Do not change your workspace ..
Mark Haynes
 
ejercicio 11 anova
ejercicio 11 anovaejercicio 11 anova
ejercicio 11 anova
panchohouse
 
CURRICULUM VITAE new
CURRICULUM VITAE newCURRICULUM VITAE new
CURRICULUM VITAE new
Vikram Patel
 
2016.9.4 揚聲歌唱,寶貴十架,我心切切渴慕祢
2016.9.4 揚聲歌唱,寶貴十架,我心切切渴慕祢2016.9.4 揚聲歌唱,寶貴十架,我心切切渴慕祢
2016.9.4 揚聲歌唱,寶貴十架,我心切切渴慕祢
Ruru Chien
 
Oral manifestations of nutritional deficiencies
Oral manifestations of nutritional deficienciesOral manifestations of nutritional deficiencies
Oral manifestations of nutritional deficiencies
Arsalan Wahid Malik
 
Ad

Similar to 01slide (20)

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
 
Unit 1 – Introduction to Java- (Shilpa R).pptx
Unit 1 – Introduction to Java- (Shilpa R).pptxUnit 1 – Introduction to Java- (Shilpa R).pptx
Unit 1 – Introduction to Java- (Shilpa R).pptx
shilpar780389
 
Professional-core-java-training
Professional-core-java-trainingProfessional-core-java-training
Professional-core-java-training
Vibrant Technologies & Computers
 
Professional-core-java-training
Professional-core-java-trainingProfessional-core-java-training
Professional-core-java-training
Vibrant Technologies & Computers
 
Java for Mainframers
Java for MainframersJava for Mainframers
Java for Mainframers
Rich Helton
 
Chapter1pp
Chapter1ppChapter1pp
Chapter1pp
J. C.
 
Java course-in-mumbai
Java course-in-mumbaiJava course-in-mumbai
Java course-in-mumbai
Unmesh Baile
 
Chapter 2.1
Chapter 2.1Chapter 2.1
Chapter 2.1
sotlsoc
 
OOP with Java
OOP with JavaOOP with Java
OOP with Java
OmegaHub
 
Unit1 introduction to Java
Unit1 introduction to JavaUnit1 introduction to Java
Unit1 introduction to Java
DevaKumari Vijay
 
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
 
Javalecture 1
Javalecture 1Javalecture 1
Javalecture 1
mrinalbhutani
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdf
Umesh Kumar
 
Java chapter 1
Java   chapter 1Java   chapter 1
Java chapter 1
Mukesh Tekwani
 
Object Oriented Programming unit 1 content for students
Object Oriented Programming unit 1 content for studentsObject Oriented Programming unit 1 content for students
Object Oriented Programming unit 1 content for students
ASHASITTeaching
 
Intro Java Rev010
Intro Java Rev010Intro Java Rev010
Intro Java Rev010
Rich Helton
 
SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to Java
SMIJava
 
Java lab1 manual
Java lab1 manualJava lab1 manual
Java lab1 manual
nahalomar
 
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
 
Unit 1 – Introduction to Java- (Shilpa R).pptx
Unit 1 – Introduction to Java- (Shilpa R).pptxUnit 1 – Introduction to Java- (Shilpa R).pptx
Unit 1 – Introduction to Java- (Shilpa R).pptx
shilpar780389
 
Java for Mainframers
Java for MainframersJava for Mainframers
Java for Mainframers
Rich Helton
 
Chapter1pp
Chapter1ppChapter1pp
Chapter1pp
J. C.
 
Java course-in-mumbai
Java course-in-mumbaiJava course-in-mumbai
Java course-in-mumbai
Unmesh Baile
 
Chapter 2.1
Chapter 2.1Chapter 2.1
Chapter 2.1
sotlsoc
 
OOP with Java
OOP with JavaOOP with Java
OOP with Java
OmegaHub
 
Unit1 introduction to Java
Unit1 introduction to JavaUnit1 introduction to Java
Unit1 introduction to Java
DevaKumari Vijay
 
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
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdf
Umesh Kumar
 
Object Oriented Programming unit 1 content for students
Object Oriented Programming unit 1 content for studentsObject Oriented Programming unit 1 content for students
Object Oriented Programming unit 1 content for students
ASHASITTeaching
 
Intro Java Rev010
Intro Java Rev010Intro Java Rev010
Intro Java Rev010
Rich Helton
 
SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to Java
SMIJava
 
Java lab1 manual
Java lab1 manualJava lab1 manual
Java lab1 manual
nahalomar
 
Ad

Recently uploaded (20)

Lecture 4.pptx which is need for microeconomic
Lecture 4.pptx which is need for microeconomicLecture 4.pptx which is need for microeconomic
Lecture 4.pptx which is need for microeconomic
mdrakibhasan1427
 
SAFETY BRIEFING.........................
SAFETY BRIEFING.........................SAFETY BRIEFING.........................
SAFETY BRIEFING.........................
BalaChandran458212
 
Placement cell of college - why choose me
Placement cell of college - why choose mePlacement cell of college - why choose me
Placement cell of college - why choose me
mmanvi024
 
For ssrvm school Admission Campaign.pptx
For ssrvm school Admission Campaign.pptxFor ssrvm school Admission Campaign.pptx
For ssrvm school Admission Campaign.pptx
ArunTYltp
 
Research Project csi1 - This presentation compares popular web browsers such ...
Research Project csi1 - This presentation compares popular web browsers such ...Research Project csi1 - This presentation compares popular web browsers such ...
Research Project csi1 - This presentation compares popular web browsers such ...
bomisung0207
 
Traditional Medicine aDRTYSRTYSRTnd HIV.ppt
Traditional Medicine aDRTYSRTYSRTnd HIV.pptTraditional Medicine aDRTYSRTYSRTnd HIV.ppt
Traditional Medicine aDRTYSRTYSRTnd HIV.ppt
XolaniRadebe7
 
UPSC+BAProgramme Syllabus for students who want to pursue UPSC coaching from ...
UPSC+BAProgramme Syllabus for students who want to pursue UPSC coaching from ...UPSC+BAProgramme Syllabus for students who want to pursue UPSC coaching from ...
UPSC+BAProgramme Syllabus for students who want to pursue UPSC coaching from ...
Tushar kumar
 
GENERAL INFORMATION for the most beautiful
GENERAL INFORMATION for the most beautifulGENERAL INFORMATION for the most beautiful
GENERAL INFORMATION for the most beautiful
12213013
 
remakingyourselfpresentation-250430095415-6476ade1.pptx
remakingyourselfpresentation-250430095415-6476ade1.pptxremakingyourselfpresentation-250430095415-6476ade1.pptx
remakingyourselfpresentation-250430095415-6476ade1.pptx
lakhmanpindariya9176
 
LCL216_2024-2_WEEKS 4 & 5_IF CLAUSES (1).pdf
LCL216_2024-2_WEEKS 4 & 5_IF CLAUSES (1).pdfLCL216_2024-2_WEEKS 4 & 5_IF CLAUSES (1).pdf
LCL216_2024-2_WEEKS 4 & 5_IF CLAUSES (1).pdf
rafaelsago2015
 
sorcesofdrugs-160228074 56 4246643544 (3).ppt
sorcesofdrugs-160228074 56 4246643544 (3).pptsorcesofdrugs-160228074 56 4246643544 (3).ppt
sorcesofdrugs-160228074 56 4246643544 (3).ppt
IndalSatnami
 
NATIONALISM IN EUROPE class 10 best ppt.pdf
NATIONALISM IN EUROPE class 10 best ppt.pdfNATIONALISM IN EUROPE class 10 best ppt.pdf
NATIONALISM IN EUROPE class 10 best ppt.pdf
leenamakkar79
 
Software Development Business Plan1.pptx
Software Development Business Plan1.pptxSoftware Development Business Plan1.pptx
Software Development Business Plan1.pptx
vkprintingsolution
 
巴利亚多利德大学毕业证书学校原版文凭补办UVa成绩单办本科成绩单
巴利亚多利德大学毕业证书学校原版文凭补办UVa成绩单办本科成绩单巴利亚多利德大学毕业证书学校原版文凭补办UVa成绩单办本科成绩单
巴利亚多利德大学毕业证书学校原版文凭补办UVa成绩单办本科成绩单
xule9cv6nd
 
Huckel_MO_Theory_Colorful_Presentation (1).pptx
Huckel_MO_Theory_Colorful_Presentation (1).pptxHuckel_MO_Theory_Colorful_Presentation (1).pptx
Huckel_MO_Theory_Colorful_Presentation (1).pptx
study2022bsc
 
CHAPTER 7 - Foreign Direct Investment.pptx
CHAPTER 7 - Foreign Direct Investment.pptxCHAPTER 7 - Foreign Direct Investment.pptx
CHAPTER 7 - Foreign Direct Investment.pptx
72200337
 
Science Lab Safety PPT.pptxwgyie ulbyaaaaaaaaaaaaaaaaaaaaaau
Science Lab Safety PPT.pptxwgyie ulbyaaaaaaaaaaaaaaaaaaaaaauScience Lab Safety PPT.pptxwgyie ulbyaaaaaaaaaaaaaaaaaaaaaau
Science Lab Safety PPT.pptxwgyie ulbyaaaaaaaaaaaaaaaaaaaaaau
atifkhan990367
 
Employment Communication : The Job HUnting.pptx
Employment Communication : The Job HUnting.pptxEmployment Communication : The Job HUnting.pptx
Employment Communication : The Job HUnting.pptx
JunaidAlvi5
 
RCM-billing in medical coding0000 1.pptx
RCM-billing in medical coding0000 1.pptxRCM-billing in medical coding0000 1.pptx
RCM-billing in medical coding0000 1.pptx
liajohn0808
 
Sample animal revalidation protocol for resaecrh based.pptx
Sample animal revalidation protocol for resaecrh based.pptxSample animal revalidation protocol for resaecrh based.pptx
Sample animal revalidation protocol for resaecrh based.pptx
azeemccras
 
Lecture 4.pptx which is need for microeconomic
Lecture 4.pptx which is need for microeconomicLecture 4.pptx which is need for microeconomic
Lecture 4.pptx which is need for microeconomic
mdrakibhasan1427
 
SAFETY BRIEFING.........................
SAFETY BRIEFING.........................SAFETY BRIEFING.........................
SAFETY BRIEFING.........................
BalaChandran458212
 
Placement cell of college - why choose me
Placement cell of college - why choose mePlacement cell of college - why choose me
Placement cell of college - why choose me
mmanvi024
 
For ssrvm school Admission Campaign.pptx
For ssrvm school Admission Campaign.pptxFor ssrvm school Admission Campaign.pptx
For ssrvm school Admission Campaign.pptx
ArunTYltp
 
Research Project csi1 - This presentation compares popular web browsers such ...
Research Project csi1 - This presentation compares popular web browsers such ...Research Project csi1 - This presentation compares popular web browsers such ...
Research Project csi1 - This presentation compares popular web browsers such ...
bomisung0207
 
Traditional Medicine aDRTYSRTYSRTnd HIV.ppt
Traditional Medicine aDRTYSRTYSRTnd HIV.pptTraditional Medicine aDRTYSRTYSRTnd HIV.ppt
Traditional Medicine aDRTYSRTYSRTnd HIV.ppt
XolaniRadebe7
 
UPSC+BAProgramme Syllabus for students who want to pursue UPSC coaching from ...
UPSC+BAProgramme Syllabus for students who want to pursue UPSC coaching from ...UPSC+BAProgramme Syllabus for students who want to pursue UPSC coaching from ...
UPSC+BAProgramme Syllabus for students who want to pursue UPSC coaching from ...
Tushar kumar
 
GENERAL INFORMATION for the most beautiful
GENERAL INFORMATION for the most beautifulGENERAL INFORMATION for the most beautiful
GENERAL INFORMATION for the most beautiful
12213013
 
remakingyourselfpresentation-250430095415-6476ade1.pptx
remakingyourselfpresentation-250430095415-6476ade1.pptxremakingyourselfpresentation-250430095415-6476ade1.pptx
remakingyourselfpresentation-250430095415-6476ade1.pptx
lakhmanpindariya9176
 
LCL216_2024-2_WEEKS 4 & 5_IF CLAUSES (1).pdf
LCL216_2024-2_WEEKS 4 & 5_IF CLAUSES (1).pdfLCL216_2024-2_WEEKS 4 & 5_IF CLAUSES (1).pdf
LCL216_2024-2_WEEKS 4 & 5_IF CLAUSES (1).pdf
rafaelsago2015
 
sorcesofdrugs-160228074 56 4246643544 (3).ppt
sorcesofdrugs-160228074 56 4246643544 (3).pptsorcesofdrugs-160228074 56 4246643544 (3).ppt
sorcesofdrugs-160228074 56 4246643544 (3).ppt
IndalSatnami
 
NATIONALISM IN EUROPE class 10 best ppt.pdf
NATIONALISM IN EUROPE class 10 best ppt.pdfNATIONALISM IN EUROPE class 10 best ppt.pdf
NATIONALISM IN EUROPE class 10 best ppt.pdf
leenamakkar79
 
Software Development Business Plan1.pptx
Software Development Business Plan1.pptxSoftware Development Business Plan1.pptx
Software Development Business Plan1.pptx
vkprintingsolution
 
巴利亚多利德大学毕业证书学校原版文凭补办UVa成绩单办本科成绩单
巴利亚多利德大学毕业证书学校原版文凭补办UVa成绩单办本科成绩单巴利亚多利德大学毕业证书学校原版文凭补办UVa成绩单办本科成绩单
巴利亚多利德大学毕业证书学校原版文凭补办UVa成绩单办本科成绩单
xule9cv6nd
 
Huckel_MO_Theory_Colorful_Presentation (1).pptx
Huckel_MO_Theory_Colorful_Presentation (1).pptxHuckel_MO_Theory_Colorful_Presentation (1).pptx
Huckel_MO_Theory_Colorful_Presentation (1).pptx
study2022bsc
 
CHAPTER 7 - Foreign Direct Investment.pptx
CHAPTER 7 - Foreign Direct Investment.pptxCHAPTER 7 - Foreign Direct Investment.pptx
CHAPTER 7 - Foreign Direct Investment.pptx
72200337
 
Science Lab Safety PPT.pptxwgyie ulbyaaaaaaaaaaaaaaaaaaaaaau
Science Lab Safety PPT.pptxwgyie ulbyaaaaaaaaaaaaaaaaaaaaaauScience Lab Safety PPT.pptxwgyie ulbyaaaaaaaaaaaaaaaaaaaaaau
Science Lab Safety PPT.pptxwgyie ulbyaaaaaaaaaaaaaaaaaaaaaau
atifkhan990367
 
Employment Communication : The Job HUnting.pptx
Employment Communication : The Job HUnting.pptxEmployment Communication : The Job HUnting.pptx
Employment Communication : The Job HUnting.pptx
JunaidAlvi5
 
RCM-billing in medical coding0000 1.pptx
RCM-billing in medical coding0000 1.pptxRCM-billing in medical coding0000 1.pptx
RCM-billing in medical coding0000 1.pptx
liajohn0808
 
Sample animal revalidation protocol for resaecrh based.pptx
Sample animal revalidation protocol for resaecrh based.pptxSample animal revalidation protocol for resaecrh based.pptx
Sample animal revalidation protocol for resaecrh based.pptx
azeemccras
 

01slide

  • 1. Introduction to Java Programming, 4E Y. Daniel Liang
  • 2. Introduction Course Objectives Organization of the Book
  • 3. Course Objectives 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)
  • 4. Course Objectives, cont. 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
  • 5. Book Chapters 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
  • 6. Book Chapters, cont. 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
  • 7. Book Chapters, cont. Part III: GUI Programming Chapter 10 Getting Started with GUI Programming Chapter 11 Creating User Interfaces Chapter 12 Applets and Advanced GUI
  • 8. Book Chapters, cont. 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
  • 9. Chapter 1 Introduction to Java and Forte What Is Java? Getting Started With Java Programming Create, Compile and Running a Java Application
  • 10. What Is Java? History Characteristics of Java
  • 11. History 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)
  • 12. Characteristics of Java 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
  • 13. JDK Versions 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)
  • 14. JDK Editions 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.
  • 15. Java IDE Tools Forte by Sun MicroSystems Borland JBuilder Microsoft Visual J++ WebGain Café IBM Visual Age for Java
  • 16. Getting Started with Java Programming A Simple Java Application Compiling Programs Executing Applications
  • 17. A Simple Application 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!"); } } Run Source NOTE: To run the program, install slide files on hard disk.
  • 18. Creating and Compiling Programs On command line javac file.java
  • 19. Executing Applications On command line java classname
  • 20. Example javac Welcome.java java Welcome output:...
  • 21. Compiling and Running a Program Where are the files stored in the directory?
  • 22. Anatomy of a Java Program Comments Package Reserved words Modifiers Statements Blocks Classes Methods The main method
  • 23. Comments 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 /* , it scans for the next */ and ignores any text between /* and */ .
  • 24. Package 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.
  • 25. Reserved Words 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 later in the book.
  • 26. Modifiers 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."
  • 27. Statements 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 a semicolon (;).
  • 28. Blocks A pair of braces in a program forms a block that groups components of a program.
  • 29. Classes 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 program is defined by using one or more classes.
  • 30. Methods 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.
  • 31. main Method 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; }
  • 32. Displaying Text in a Message Dialog Box 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.” Run Source
  • 33. The showMessageDialog Method JOptionPane.showMessageDialog(null, "Welcome to Java!", "Example 1.2", JOptionPane.INFORMATION_MESSAGE));
  • 34. The exit Method 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.

Editor's Notes

  • #2: First Class: Introduction, Prerequisites, Advices, Syllabus Lab 1: Create a Java Project, Compile, and Run. Show syntax errors Print program Capture screen shots, and save it in Word, and print it. Homework One: Check in the class randomly.