SlideShare une entreprise Scribd logo
1  sur  29
Computer Programming
                            Chapter 1 : Introduction


                  Atit Patumvan
  Faculty of Management and Information Sciences
                Naresuan University
2



                                                                What is Programming?


                         •        Computers are programmed to perform tasks

                         •        Different tasks = different programs

                         •        Program

                                •         Sequence of basic operations executed in
                                          succession

                                •         Contains instruction sequences for all tasks it can
                                          execute

                         •        Sophisticated programs require teams of highly
                                  skilled programmers and other professionals



Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University     Computer Programming, Chapter 1 : Introduction
3



                                                                             History Timeline




Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University              Computer Programming, Chapter 1 : Introduction
4



                             The Evolution of Programming Languages


                         •        To build programs, people use languages that are
                                  similar to human language. The results are
                                  translated into machine code, which computers
                                  understand.

                         •        Programming languages fall into three broad
                                  categories:

                                •         Machine languages

                                •         Assembly languages

                                •         Higher-level



Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University   Computer Programming, Chapter 1 : Introduction
5



                                                                   Assembly Languages


                         •        Assembly languages (second-generation
                                  languages) are only somewhat easier to work with
                                  than machine languages.

                         •        To create programs in assembly language,
                                  developers use cryptic English-like phrases to
                                  represent strings of numbers.

                         •        The code is then translated into object code, using a
                                  translator called an assembler.




Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University      Computer Programming, Chapter 1 : Introduction
6



                                                      Assembly Languages


                                                                   Assembly Code




                                                                                     Assembler



                                                                                      Assembly Code




Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University     Computer Programming, Chapter 1 : Introduction
7



                                                              Higher-Level Languages


                         •        Higher-level languages are more powerful than
                                  assembly language and allow the programmer to
                                  work in a more English-like environment.

                         •        Higher-level programming languages are divided
                                  into three "generations," each more powerful than
                                  the last:

                                •         Third-generation languages

                                •         Fourth-generation languages

                                •         Fifth-generation languages



Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University     Computer Programming, Chapter 1 : Introduction
8



                                                        Third-generation languages


                         •        Third-generation languages (3GLs) are the first to
                                  use true English-like phrasing, making them easier
                                  to ! use than previous languages.

                         •        3GLs are portable, meaning the object code created
                                  for one type of system can be translated for use on
                                  a different type of system.

                         •        The following languages are 3GLs

                                    FORTAN                                           BASIC    PHP
                                    C                                                Java     JavaScript
                                    COBOL                                            Pascal   Ruby
                                    C++                                              C#       Python

Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University                  Computer Programming, Chapter 1 : Introduction
9



                       A Typical Program Development Environment


                                      Edit                              Program is created in the editor and stored on disk


                             Preprocess                                          Preprocessor program processes the code


                                 Compile                                Compiler creates object code and stores it on disk.


                                     Link                                      Linker links the object code with the libraries


                                    Load                                              Loader puts program in memory


                                 Execute                                         CPU takes each instruction and executes it



Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University                                      Computer Programming, Chapter 1 : Introduction
10



                                                   Fourth-Generation Languages


                         •        Fourth-generation languages (4GLs) are even
                                  easier to use than 3GLs.

                         •        4GLs may use a text-based environment (like a
                                  3GL) or may allow the programmer to work in a
                                  visual environment, using graphical tools.

                         •        The following languages are 4GLs:

                                    Visual Basic
                                    Magic




Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University   Computer Programming, Chapter 1 : Introduction
11



                                                       Fifth-Generation Languages



                         •        Fifth-generation languages (5GLs) are an issue of
                                  debate in the programming community – some
                                  programmers !cannot agree that they even exist.

                         •        These high-level languages would use artificial
                                  intelligence to create software, making 5GLs
                                  extremely difficult to develop.

                         •        Solve problems using constraints rather than
                                  algorithms, used in Artificial Intelligence
                                    Prolog
                                    CLIPs

Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University   Computer Programming, Chapter 1 : Introduction
12



                                                            History of Java Language

                         •       JDK 1.0 (January 23, 1996)                          •   Java SE 7 (July 7, 2011)


                         •       JDK 1.1 (February 19, 1997)                         •   Java SE 8 (expected in summer
                                                                                         2013)
                         •       J2SE 1.2 (December 8, 1998)


                         •       J2SE 1.3 (May 8, 2000)


                         •       J2SE 1.4 (February 6, 2002)


                         •       J2SE 5.0 (September 30, 2004)


                         •       Java SE 6 (December 11, 2006)




Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University                         Computer Programming, Chapter 1 : Introduction
13



                                                                                     Java Editions


                         •        J2ME (Micro Edition) : Used to create programs
                                  that run on small handheld devices, such as phones,
                                  PDAs (personal digital assistants), and appliances.

                         •        J2SE (Standard Edition) : Used primarily to create
                                  programs for desktop computers or for many
                                  computers too large for J2ME and too small for
                                  J2EE.

                         •        J2EE (Enterprise Edition) : Used to create very
                                  large programs that run on servers managing heavy
                                  traffic and complicated transactions. These
                                  programs are the backbone of many online services,


Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University                   Computer Programming, Chapter 1 : Introduction
14



                                      Common Misconceptions About Java


                         •        Java is an extension of programmer

                         •        Java is an easy programming to learn

                         •        Java is an easy environment in which to program

                         •        Java will become a universal programming for all
                                  platforms

                         •        Java is just another programming language




Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University   Computer Programming, Chapter 1 : Introduction
15



                                      Common Misconceptions About Java


                         •       Java is interpreted, so it is too slow for serious
                                 applications on a specific platform.

                         •       All Java program run inside a Web pages.

                         •       Java applets are a major security risk.

                         •       JavaScript is a simpler version of Java

                         •       You should use Java instead of Perl for CGI scripting




Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University   Computer Programming, Chapter 1 : Introduction
16



                                      Common Misconceptions About Java


                         •       Java will revolutionize client-server computing.

                         •       Java will allow the component-based model of
                                 computing to take off

                         •       With Java, I can replace my computer with a $500
                                 “Internet appliance”




Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University   Computer Programming, Chapter 1 : Introduction
17



                                        The Java programming environment


                         •        Compared to C++: no header files, macros, pointers
                                  and references, unions, operator overloading,
                                  templates, etc.

                         •        Object-orientation: Classes + Inheritance

                         •        Distributed: RMI, Servlet, Distributed object
                                  programming.

                         •        Robust: Strong typing + no pointer + garbage
                                  collection




Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University   Computer Programming, Chapter 1 : Introduction
18



                                        The Java programming environment


                         •        Secure: Type-safety and access control

                         •        Architecture neutral: architecture neutral
                                  representation

                         •        Portable

                         •        Interpreted

                         •        High performance through Just in time compilation
                                  and runtime modification of code

                         •        Multi-threaded




Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University   Computer Programming, Chapter 1 : Introduction
19



                                                                                 Java Features


                         •        Well defined primitive data types: int, float, double,
                                  char, etc.

                         •        int 4 bytes [–2,147,648, 2,147,483,647]

                         •        Control statements similar to C++: if-then-else,
                                  switch, while, for

                         •        Interfaces

                         •        Exceptions




Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University               Computer Programming, Chapter 1 : Introduction
20



                                                                                 Java Features


                         •       Concurrency

                         •       Packages

                         •       Name spaces

                         •       Reflection

                         •       Applet model




Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University               Computer Programming, Chapter 1 : Introduction
21



                                       The Java programming environment


                         •        Java programming language specification

                                •         Syntax of Java programs

                                •         Defines different constructs and their semantics

                         •        Java byte code: Intermediate representation for
                                  Java programs

                         •        Java compiler: Transform Java programs into Java
                                  byte code




Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University   Computer Programming, Chapter 1 : Introduction
22



                                       The Java programming environment


                         •        Java interpreter: Read programs written in Java
                                  byte code and execute them

                         •        Java virtual machine: Runtime system that
                                  provides various services to running programs

                         •        Java programming environment: Set of libraries
                                  that provide services such as GUI, data
                                  structures,etc.

                         •        Java enabled browsers: Browsers that include a
                                  JVM + ability to load programs from remote hosts




Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University   Computer Programming, Chapter 1 : Introduction
23



                                                            The Java Virtual Machine


                         •        The heart of the Java Platform is the concept of a
                                  "virtual machine" that executes Java bytecode
                                  programs.

                         •        Sits between the Java program and the machine it is
                                  running on.

                         •        Offers the program an “abstract computer” that
                                  executes the Java code

                         •        virtual machine isn't running on a CPU - it is being
                                  emulated on the CPU of the host machine.




Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University     Computer Programming, Chapter 1 : Introduction
24



                                               How are Java programs written?


             HelloWorld.java                                                                          Compiler
             01: public class HelloWorld {
             02:                                                                                 javac HelloWorld.java
             03: public static void main(String[] args) {
             04:      System.out.println("Hello, World!");
             05: }
             06: }



                                                                                     HelloWorld.class (Java bytescodes)
                                                                                     01: ????1"
                                                                                     02:      @
                         Hello, World!                                               03:
                                                                                     init>()VCodeLineNumberTableLocalVariableTabl
                                                                                     ethis     LMidterm;main([Ljava/lang/
                                                                                     String;)Vargs[Ljava/lang/String;




                                                                                                      Interpreter

                                                                                                    java HelloWorld




Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University                               Computer Programming, Chapter 1 : Introduction
25




                                                          Write once, run any Where

            HelloWorld.java
            01: public class HelloWorld {
                                                                                                         Compiler
            02:
            03: public static void main(String[] args) {
                                                                                                    javac HelloWorld.java
            04:      System.out.println("Hello, World!");
            05: }
            06: }


                                                                                                     HelloWorld.class




                          HelloWorld.class
                                                                                      Interpreter       Interpreter                    Interpreter

                           Java API

                     Java Virtual Machine

               Hardware-Based Platform
                                                                                     Win32            Linux                     MacOS

Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University                                          Computer Programming, Chapter 1 : Introduction
26



                                              How Will Java Change Your Life?


                         •       Get started quickly                                 •   Write once, run any
                                                                                         where
                         •       Write less code
                                                                                     •   Distribute software
                         •       Write better code                                       more easily

                         •       Develop program
                                 more quickly

                         •       Avoid platform
                                 dependencies with
                                 100% pure Java



Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University                     Computer Programming, Chapter 1 : Introduction
27



                                                    Analyzing Your First Program




                            01: package com.patumvan.atit.courses.compro.ch01.hello;
                            02:
                            03: public class HelloPrinter {
                            04:
                            05:    public static void main(String[] args) {
                            06:        System.out.println("Hello, World!");
                            07:    }
                            08: }




Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University   Computer Programming, Chapter 1 : Introduction
28



                                                                                 Syntax Errors


                         •        Caused when the compiler cannot recognize a
                                  statement.

                         •        Are violations of the language

                         •        The compiler normally issues an error message to
                                  help the programmer locate and fix it

                         •        Also called compile errors or compile-time errors

                                   01:             public class Hello {
                                   02:                 pooblic static void main(String[] args) {
                                   03:                     System.owt.println("Hello, world!")_
                                   04:                 }
                                   05:             }


Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University               Computer Programming, Chapter 1 : Introduction
29



                                                                             Run-time Errors


                         •        Other major kind of error you’ll see

                         •        Happens when a program is running

                         •        We will talk more about these later

                         •        The compiler cannot identify these errors at compile
                                  time.




Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University             Computer Programming, Chapter 1 : Introduction

Contenu connexe

Tendances

High Level Language (HLL)
High Level Language (HLL)High Level Language (HLL)
High Level Language (HLL)Maliha Jahan
 
Presentation on generation of languages
Presentation on generation of languagesPresentation on generation of languages
Presentation on generation of languagesRicha Pant
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design BasicsAkhil Kaushik
 
Coding vs programming
Coding vs programmingCoding vs programming
Coding vs programmingAman Kumar
 
Compiler Design
Compiler DesignCompiler Design
Compiler DesignMir Majid
 
Generations of programming_language.kum_ari11-1-1-1
Generations of programming_language.kum_ari11-1-1-1Generations of programming_language.kum_ari11-1-1-1
Generations of programming_language.kum_ari11-1-1-1lakshmi kumari neelapu
 
Programming Fundamental Slide No.1
Programming Fundamental Slide No.1Programming Fundamental Slide No.1
Programming Fundamental Slide No.1Arslan Hussain
 
Introduction Programming Languages
Introduction Programming LanguagesIntroduction Programming Languages
Introduction Programming LanguagesManish Kharotia
 
PYTHON NOTES
PYTHON NOTESPYTHON NOTES
PYTHON NOTESNi
 
High level and Low level Language
High level and Low level Language High level and Low level Language
High level and Low level Language adnan usmani
 
Classification of Programming Languages
Classification of Programming LanguagesClassification of Programming Languages
Classification of Programming LanguagesProject Student
 
Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languagesVarun Garg
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programmingNoel Malle
 
Basic Computer Programming
Basic Computer ProgrammingBasic Computer Programming
Basic Computer ProgrammingAllen de Castro
 

Tendances (20)

High Level Language (HLL)
High Level Language (HLL)High Level Language (HLL)
High Level Language (HLL)
 
Presentation on generation of languages
Presentation on generation of languagesPresentation on generation of languages
Presentation on generation of languages
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design Basics
 
Coding vs programming
Coding vs programmingCoding vs programming
Coding vs programming
 
Computer Programming
Computer Programming Computer Programming
Computer Programming
 
Compilers
CompilersCompilers
Compilers
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
 
Generations of programming_language.kum_ari11-1-1-1
Generations of programming_language.kum_ari11-1-1-1Generations of programming_language.kum_ari11-1-1-1
Generations of programming_language.kum_ari11-1-1-1
 
Programming Fundamental Slide No.1
Programming Fundamental Slide No.1Programming Fundamental Slide No.1
Programming Fundamental Slide No.1
 
Computer languages
Computer languagesComputer languages
Computer languages
 
Computer Languages.
Computer Languages.Computer Languages.
Computer Languages.
 
Introduction Programming Languages
Introduction Programming LanguagesIntroduction Programming Languages
Introduction Programming Languages
 
PYTHON NOTES
PYTHON NOTESPYTHON NOTES
PYTHON NOTES
 
High level and Low level Language
High level and Low level Language High level and Low level Language
High level and Low level Language
 
Classification of Programming Languages
Classification of Programming LanguagesClassification of Programming Languages
Classification of Programming Languages
 
Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languages
 
generation of programming language
generation of programming languagegeneration of programming language
generation of programming language
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
 
Computer Programming - Lecture 1
Computer Programming - Lecture 1Computer Programming - Lecture 1
Computer Programming - Lecture 1
 
Basic Computer Programming
Basic Computer ProgrammingBasic Computer Programming
Basic Computer Programming
 

Similaire à Intro to Computer Programming Chapter 1

Form5 cd1
Form5 cd1Form5 cd1
Form5 cd1smktsj2
 
Introduction to computer programming
Introduction to computer programming Introduction to computer programming
Introduction to computer programming VanessaBuensalida
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer scienceumardanjumamaiwada
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer scienceumardanjumamaiwada
 
Generation of Computer language by arya dutta (1).pptx
Generation of Computer language by arya dutta (1).pptxGeneration of Computer language by arya dutta (1).pptx
Generation of Computer language by arya dutta (1).pptxAryaDutta4
 
introduction to programming languages
introduction to programming languagesintroduction to programming languages
introduction to programming languagesNaqashAhmad14
 
Speech To Speech Translation
Speech To Speech TranslationSpeech To Speech Translation
Speech To Speech TranslationIRJET Journal
 
Python Programming Unit1_Aditya College of Engg & Tech
Python Programming Unit1_Aditya College of Engg & TechPython Programming Unit1_Aditya College of Engg & Tech
Python Programming Unit1_Aditya College of Engg & TechRamanamurthy Banda
 
Programming language
Programming languageProgramming language
Programming languageShuja Qais
 
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi Professor Lili Saghafi
 
Third and fourth generation programming language
Third and fourth generation programming languageThird and fourth generation programming language
Third and fourth generation programming languageomeed
 
Lec21&22.pptx programing language and there study
Lec21&22.pptx programing language and there studyLec21&22.pptx programing language and there study
Lec21&22.pptx programing language and there studysamiullahamjad06
 
Programming Fundamentals and Programming Languages Concepts
Programming Fundamentals and Programming Languages ConceptsProgramming Fundamentals and Programming Languages Concepts
Programming Fundamentals and Programming Languages Conceptsimtiazalijoono
 

Similaire à Intro to Computer Programming Chapter 1 (20)

Form5 cd1
Form5 cd1Form5 cd1
Form5 cd1
 
programming.pptx
programming.pptxprogramming.pptx
programming.pptx
 
sege.pdf
sege.pdfsege.pdf
sege.pdf
 
Introduction to computer programming
Introduction to computer programming Introduction to computer programming
Introduction to computer programming
 
Programming language
Programming languageProgramming language
Programming language
 
lecture 4
 lecture 4 lecture 4
lecture 4
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
 
Generation of Computer language by arya dutta (1).pptx
Generation of Computer language by arya dutta (1).pptxGeneration of Computer language by arya dutta (1).pptx
Generation of Computer language by arya dutta (1).pptx
 
introduction to programming languages
introduction to programming languagesintroduction to programming languages
introduction to programming languages
 
Speech To Speech Translation
Speech To Speech TranslationSpeech To Speech Translation
Speech To Speech Translation
 
Software
SoftwareSoftware
Software
 
Python Programming Unit1_Aditya College of Engg & Tech
Python Programming Unit1_Aditya College of Engg & TechPython Programming Unit1_Aditya College of Engg & Tech
Python Programming Unit1_Aditya College of Engg & Tech
 
Programming languages.pptx
Programming languages.pptxProgramming languages.pptx
Programming languages.pptx
 
Programming language
Programming languageProgramming language
Programming language
 
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
 
Third and fourth generation programming language
Third and fourth generation programming languageThird and fourth generation programming language
Third and fourth generation programming language
 
Lec21&22.pptx programing language and there study
Lec21&22.pptx programing language and there studyLec21&22.pptx programing language and there study
Lec21&22.pptx programing language and there study
 
Programming Fundamentals and Programming Languages Concepts
Programming Fundamentals and Programming Languages ConceptsProgramming Fundamentals and Programming Languages Concepts
Programming Fundamentals and Programming Languages Concepts
 
Notacd07
Notacd07Notacd07
Notacd07
 

Plus de Atit Patumvan

Iot for smart agriculture
Iot for smart agricultureIot for smart agriculture
Iot for smart agricultureAtit Patumvan
 
An Overview of eZee Burrp! (Philus Limited)
An Overview of eZee Burrp! (Philus Limited)An Overview of eZee Burrp! (Philus Limited)
An Overview of eZee Burrp! (Philus Limited)Atit Patumvan
 
แบบฝึกหัดวิชา Theory of Computation ชุดที่ 1 เซ็ต
แบบฝึกหัดวิชา Theory of Computation ชุดที่ 1 เซ็ตแบบฝึกหัดวิชา Theory of Computation ชุดที่ 1 เซ็ต
แบบฝึกหัดวิชา Theory of Computation ชุดที่ 1 เซ็ตAtit Patumvan
 
Chapter 1 mathmatics tools
Chapter 1 mathmatics toolsChapter 1 mathmatics tools
Chapter 1 mathmatics toolsAtit Patumvan
 
Chapter 1 mathmatics tools
Chapter 1 mathmatics toolsChapter 1 mathmatics tools
Chapter 1 mathmatics toolsAtit Patumvan
 
รายงานการประเมินคุณภาพภายใน ปีงบประมาณ 2556
รายงานการประเมินคุณภาพภายใน ปีงบประมาณ 2556รายงานการประเมินคุณภาพภายใน ปีงบประมาณ 2556
รายงานการประเมินคุณภาพภายใน ปีงบประมาณ 2556Atit Patumvan
 
Chapter 0 introduction to theory of computation
Chapter 0 introduction to theory of computationChapter 0 introduction to theory of computation
Chapter 0 introduction to theory of computationAtit Patumvan
 
Chapter 01 mathmatics tools (slide)
Chapter 01 mathmatics tools (slide)Chapter 01 mathmatics tools (slide)
Chapter 01 mathmatics tools (slide)Atit Patumvan
 
การบริหารเชิงคุณภาพ ชุดที่ 8
การบริหารเชิงคุณภาพ ชุดที่ 8การบริหารเชิงคุณภาพ ชุดที่ 8
การบริหารเชิงคุณภาพ ชุดที่ 8Atit Patumvan
 
การบริหารเชิงคุณภาพ ชุดที่ 7
การบริหารเชิงคุณภาพ ชุดที่ 7การบริหารเชิงคุณภาพ ชุดที่ 7
การบริหารเชิงคุณภาพ ชุดที่ 7Atit Patumvan
 
การบริหารเชิงคุณภาพ ชุดที่ 6
การบริหารเชิงคุณภาพ ชุดที่ 6การบริหารเชิงคุณภาพ ชุดที่ 6
การบริหารเชิงคุณภาพ ชุดที่ 6Atit Patumvan
 
Computer Programming Chapter 5 : Methods
Computer Programming Chapter 5 : MethodsComputer Programming Chapter 5 : Methods
Computer Programming Chapter 5 : MethodsAtit Patumvan
 
Computer Programming Chapter 4 : Loops
Computer Programming Chapter 4 : Loops Computer Programming Chapter 4 : Loops
Computer Programming Chapter 4 : Loops Atit Patumvan
 
Introduction to Java EE (J2EE)
Introduction to Java EE (J2EE)Introduction to Java EE (J2EE)
Introduction to Java EE (J2EE)Atit Patumvan
 
การบริหารเชิงคุณภาพ ชุดที่ 5
การบริหารเชิงคุณภาพ ชุดที่ 5การบริหารเชิงคุณภาพ ชุดที่ 5
การบริหารเชิงคุณภาพ ชุดที่ 5Atit Patumvan
 
การบริหารเชิงคุณภาพ ชุดที่ 4
การบริหารเชิงคุณภาพ ชุดที่ 4การบริหารเชิงคุณภาพ ชุดที่ 4
การบริหารเชิงคุณภาพ ชุดที่ 4Atit Patumvan
 
การบริหารเชิงคุณภาพ ชุดที่ 3
การบริหารเชิงคุณภาพ ชุดที่ 3การบริหารเชิงคุณภาพ ชุดที่ 3
การบริหารเชิงคุณภาพ ชุดที่ 3Atit Patumvan
 
การบริหารเชิงคุณภาพ ชุดที่ 2
การบริหารเชิงคุณภาพ ชุดที่ 2การบริหารเชิงคุณภาพ ชุดที่ 2
การบริหารเชิงคุณภาพ ชุดที่ 2Atit Patumvan
 
การบริหารเชิงคุณภาพ ชุดที่ 1
การบริหารเชิงคุณภาพ ชุดที่ 1การบริหารเชิงคุณภาพ ชุดที่ 1
การบริหารเชิงคุณภาพ ชุดที่ 1Atit Patumvan
 

Plus de Atit Patumvan (20)

Iot for smart agriculture
Iot for smart agricultureIot for smart agriculture
Iot for smart agriculture
 
An Overview of eZee Burrp! (Philus Limited)
An Overview of eZee Burrp! (Philus Limited)An Overview of eZee Burrp! (Philus Limited)
An Overview of eZee Burrp! (Philus Limited)
 
แบบฝึกหัดวิชา Theory of Computation ชุดที่ 1 เซ็ต
แบบฝึกหัดวิชา Theory of Computation ชุดที่ 1 เซ็ตแบบฝึกหัดวิชา Theory of Computation ชุดที่ 1 เซ็ต
แบบฝึกหัดวิชา Theory of Computation ชุดที่ 1 เซ็ต
 
Chapter 1 mathmatics tools
Chapter 1 mathmatics toolsChapter 1 mathmatics tools
Chapter 1 mathmatics tools
 
Chapter 1 mathmatics tools
Chapter 1 mathmatics toolsChapter 1 mathmatics tools
Chapter 1 mathmatics tools
 
รายงานการประเมินคุณภาพภายใน ปีงบประมาณ 2556
รายงานการประเมินคุณภาพภายใน ปีงบประมาณ 2556รายงานการประเมินคุณภาพภายใน ปีงบประมาณ 2556
รายงานการประเมินคุณภาพภายใน ปีงบประมาณ 2556
 
Chapter 0 introduction to theory of computation
Chapter 0 introduction to theory of computationChapter 0 introduction to theory of computation
Chapter 0 introduction to theory of computation
 
Media literacy
Media literacyMedia literacy
Media literacy
 
Chapter 01 mathmatics tools (slide)
Chapter 01 mathmatics tools (slide)Chapter 01 mathmatics tools (slide)
Chapter 01 mathmatics tools (slide)
 
การบริหารเชิงคุณภาพ ชุดที่ 8
การบริหารเชิงคุณภาพ ชุดที่ 8การบริหารเชิงคุณภาพ ชุดที่ 8
การบริหารเชิงคุณภาพ ชุดที่ 8
 
การบริหารเชิงคุณภาพ ชุดที่ 7
การบริหารเชิงคุณภาพ ชุดที่ 7การบริหารเชิงคุณภาพ ชุดที่ 7
การบริหารเชิงคุณภาพ ชุดที่ 7
 
การบริหารเชิงคุณภาพ ชุดที่ 6
การบริหารเชิงคุณภาพ ชุดที่ 6การบริหารเชิงคุณภาพ ชุดที่ 6
การบริหารเชิงคุณภาพ ชุดที่ 6
 
Computer Programming Chapter 5 : Methods
Computer Programming Chapter 5 : MethodsComputer Programming Chapter 5 : Methods
Computer Programming Chapter 5 : Methods
 
Computer Programming Chapter 4 : Loops
Computer Programming Chapter 4 : Loops Computer Programming Chapter 4 : Loops
Computer Programming Chapter 4 : Loops
 
Introduction to Java EE (J2EE)
Introduction to Java EE (J2EE)Introduction to Java EE (J2EE)
Introduction to Java EE (J2EE)
 
การบริหารเชิงคุณภาพ ชุดที่ 5
การบริหารเชิงคุณภาพ ชุดที่ 5การบริหารเชิงคุณภาพ ชุดที่ 5
การบริหารเชิงคุณภาพ ชุดที่ 5
 
การบริหารเชิงคุณภาพ ชุดที่ 4
การบริหารเชิงคุณภาพ ชุดที่ 4การบริหารเชิงคุณภาพ ชุดที่ 4
การบริหารเชิงคุณภาพ ชุดที่ 4
 
การบริหารเชิงคุณภาพ ชุดที่ 3
การบริหารเชิงคุณภาพ ชุดที่ 3การบริหารเชิงคุณภาพ ชุดที่ 3
การบริหารเชิงคุณภาพ ชุดที่ 3
 
การบริหารเชิงคุณภาพ ชุดที่ 2
การบริหารเชิงคุณภาพ ชุดที่ 2การบริหารเชิงคุณภาพ ชุดที่ 2
การบริหารเชิงคุณภาพ ชุดที่ 2
 
การบริหารเชิงคุณภาพ ชุดที่ 1
การบริหารเชิงคุณภาพ ชุดที่ 1การบริหารเชิงคุณภาพ ชุดที่ 1
การบริหารเชิงคุณภาพ ชุดที่ 1
 

Dernier

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 

Dernier (20)

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 

Intro to Computer Programming Chapter 1

  • 1. Computer Programming Chapter 1 : Introduction Atit Patumvan Faculty of Management and Information Sciences Naresuan University
  • 2. 2 What is Programming? • Computers are programmed to perform tasks • Different tasks = different programs • Program • Sequence of basic operations executed in succession • Contains instruction sequences for all tasks it can execute • Sophisticated programs require teams of highly skilled programmers and other professionals Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 3. 3 History Timeline Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 4. 4 The Evolution of Programming Languages • To build programs, people use languages that are similar to human language. The results are translated into machine code, which computers understand. • Programming languages fall into three broad categories: • Machine languages • Assembly languages • Higher-level Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 5. 5 Assembly Languages • Assembly languages (second-generation languages) are only somewhat easier to work with than machine languages. • To create programs in assembly language, developers use cryptic English-like phrases to represent strings of numbers. • The code is then translated into object code, using a translator called an assembler. Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 6. 6 Assembly Languages Assembly Code Assembler Assembly Code Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 7. 7 Higher-Level Languages • Higher-level languages are more powerful than assembly language and allow the programmer to work in a more English-like environment. • Higher-level programming languages are divided into three "generations," each more powerful than the last: • Third-generation languages • Fourth-generation languages • Fifth-generation languages Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 8. 8 Third-generation languages • Third-generation languages (3GLs) are the first to use true English-like phrasing, making them easier to ! use than previous languages. • 3GLs are portable, meaning the object code created for one type of system can be translated for use on a different type of system. • The following languages are 3GLs FORTAN BASIC PHP C Java JavaScript COBOL Pascal Ruby C++ C# Python Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 9. 9 A Typical Program Development Environment Edit Program is created in the editor and stored on disk Preprocess Preprocessor program processes the code Compile Compiler creates object code and stores it on disk. Link Linker links the object code with the libraries Load Loader puts program in memory Execute CPU takes each instruction and executes it Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 10. 10 Fourth-Generation Languages • Fourth-generation languages (4GLs) are even easier to use than 3GLs. • 4GLs may use a text-based environment (like a 3GL) or may allow the programmer to work in a visual environment, using graphical tools. • The following languages are 4GLs: Visual Basic Magic Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 11. 11 Fifth-Generation Languages • Fifth-generation languages (5GLs) are an issue of debate in the programming community – some programmers !cannot agree that they even exist. • These high-level languages would use artificial intelligence to create software, making 5GLs extremely difficult to develop. • Solve problems using constraints rather than algorithms, used in Artificial Intelligence Prolog CLIPs Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 12. 12 History of Java Language • JDK 1.0 (January 23, 1996) • Java SE 7 (July 7, 2011) • JDK 1.1 (February 19, 1997) • Java SE 8 (expected in summer 2013) • J2SE 1.2 (December 8, 1998) • J2SE 1.3 (May 8, 2000) • J2SE 1.4 (February 6, 2002) • J2SE 5.0 (September 30, 2004) • Java SE 6 (December 11, 2006) Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 13. 13 Java Editions • J2ME (Micro Edition) : Used to create programs that run on small handheld devices, such as phones, PDAs (personal digital assistants), and appliances. • J2SE (Standard Edition) : Used primarily to create programs for desktop computers or for many computers too large for J2ME and too small for J2EE. • J2EE (Enterprise Edition) : Used to create very large programs that run on servers managing heavy traffic and complicated transactions. These programs are the backbone of many online services, Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 14. 14 Common Misconceptions About Java • Java is an extension of programmer • Java is an easy programming to learn • Java is an easy environment in which to program • Java will become a universal programming for all platforms • Java is just another programming language Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 15. 15 Common Misconceptions About Java • Java is interpreted, so it is too slow for serious applications on a specific platform. • All Java program run inside a Web pages. • Java applets are a major security risk. • JavaScript is a simpler version of Java • You should use Java instead of Perl for CGI scripting Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 16. 16 Common Misconceptions About Java • Java will revolutionize client-server computing. • Java will allow the component-based model of computing to take off • With Java, I can replace my computer with a $500 “Internet appliance” Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 17. 17 The Java programming environment • Compared to C++: no header files, macros, pointers and references, unions, operator overloading, templates, etc. • Object-orientation: Classes + Inheritance • Distributed: RMI, Servlet, Distributed object programming. • Robust: Strong typing + no pointer + garbage collection Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 18. 18 The Java programming environment • Secure: Type-safety and access control • Architecture neutral: architecture neutral representation • Portable • Interpreted • High performance through Just in time compilation and runtime modification of code • Multi-threaded Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 19. 19 Java Features • Well defined primitive data types: int, float, double, char, etc. • int 4 bytes [–2,147,648, 2,147,483,647] • Control statements similar to C++: if-then-else, switch, while, for • Interfaces • Exceptions Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 20. 20 Java Features • Concurrency • Packages • Name spaces • Reflection • Applet model Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 21. 21 The Java programming environment • Java programming language specification • Syntax of Java programs • Defines different constructs and their semantics • Java byte code: Intermediate representation for Java programs • Java compiler: Transform Java programs into Java byte code Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 22. 22 The Java programming environment • Java interpreter: Read programs written in Java byte code and execute them • Java virtual machine: Runtime system that provides various services to running programs • Java programming environment: Set of libraries that provide services such as GUI, data structures,etc. • Java enabled browsers: Browsers that include a JVM + ability to load programs from remote hosts Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 23. 23 The Java Virtual Machine • The heart of the Java Platform is the concept of a "virtual machine" that executes Java bytecode programs. • Sits between the Java program and the machine it is running on. • Offers the program an “abstract computer” that executes the Java code • virtual machine isn't running on a CPU - it is being emulated on the CPU of the host machine. Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 24. 24 How are Java programs written? HelloWorld.java Compiler 01: public class HelloWorld { 02: javac HelloWorld.java 03: public static void main(String[] args) { 04: System.out.println("Hello, World!"); 05: } 06: } HelloWorld.class (Java bytescodes) 01: ????1" 02: @ Hello, World! 03: init>()VCodeLineNumberTableLocalVariableTabl ethis LMidterm;main([Ljava/lang/ String;)Vargs[Ljava/lang/String; Interpreter java HelloWorld Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 25. 25 Write once, run any Where HelloWorld.java 01: public class HelloWorld { Compiler 02: 03: public static void main(String[] args) { javac HelloWorld.java 04: System.out.println("Hello, World!"); 05: } 06: } HelloWorld.class HelloWorld.class Interpreter Interpreter Interpreter Java API Java Virtual Machine Hardware-Based Platform Win32 Linux MacOS Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 26. 26 How Will Java Change Your Life? • Get started quickly • Write once, run any where • Write less code • Distribute software • Write better code more easily • Develop program more quickly • Avoid platform dependencies with 100% pure Java Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 27. 27 Analyzing Your First Program 01: package com.patumvan.atit.courses.compro.ch01.hello; 02: 03: public class HelloPrinter { 04: 05: public static void main(String[] args) { 06: System.out.println("Hello, World!"); 07: } 08: } Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 28. 28 Syntax Errors • Caused when the compiler cannot recognize a statement. • Are violations of the language • The compiler normally issues an error message to help the programmer locate and fix it • Also called compile errors or compile-time errors 01: public class Hello { 02: pooblic static void main(String[] args) { 03: System.owt.println("Hello, world!")_ 04: } 05: } Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction
  • 29. 29 Run-time Errors • Other major kind of error you’ll see • Happens when a program is running • We will talk more about these later • The compiler cannot identify these errors at compile time. Atit Patumvan, Faculty of Management and Information Sciences, Naresuan University Computer Programming, Chapter 1 : Introduction