© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Starting Out with Java: From Control Structures through Objects Fourth.

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

 Computer hardware components are the physical pieces of the computer.  The major hardware components of a computer are: – The central processing.
Chapter 10 馬可夫鏈 緒言 如果讀者仔細觀察日常生活中所發生的 諸多事件,必然會發現有些事件的未來 發展或演變與該事件現階段的狀況全然 無關,這種事件稱為獨立試行過程 (process of independent trials) ;而另一些 事件則會受到該事件現階段的狀況影響。
Introduction to Java Programming Lecture 13 Classes I OO Programming.
學習C++的基本語法 認識關鍵字與識別字的不同 學習程式碼偵錯的流程 學習如何提高程式的可讀性
EBSCO 資料庫. 基本檢索畫面 問題: 想看哈佛商業評論 點選 [ 出版品 ] 輸入 [ 期刊名稱 ]
建立靜態資料成員 關鍵字: static 靜態資料成員不屬於特定物件,而是該類物件 所共同擁有的,可做為類別範圍裡的靜態變數。
第一章 變數、常數及資料型態. 變數 C 程式語言的變數名稱 第一個字必須是英文字母或底線 (_) 之後可以是數字, 英文字母或底線 (_) 不可以是保留字 例: Num (Ο) _score (Ο) C&C (X) 8num (X)
Introduction to Computer Science Fall 2003, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
程式語言實習 - JAVA Class1 1. 介紹 Java 編寫、編譯、執行 2. 請同學完成作業二.
1 Fall 2008ACS-1903 Chapter 1 Topics Java History Java Programs Why Program? Computer Systems: Hardware and Software Programming Languages What Is a Program.
資訊科技概論 第5章 系統程式.
第 1 章 PC 的基本構造. 本章提要 PC 系統簡介 80x86 系列 CPU 及其暫存器群 記憶體: Memory 80x86 的分節式記憶體管理 80x86 的 I/O 結構 學習組合語言的基本工具.
Introduction to Java Programming Lecture 17 Abstract Classes & Interfaces.
最新計算機概論 第 5 章 系統程式. 5-1 系統程式的類型 作業系統 (OS) : 介於電腦硬體與 應用軟體之間的 程式,除了提供 執行應用軟體的 環境,還負責分 配系統資源。
Hung-Hsiang WuWindows Processing Design1 Chapter 3 基本觀念 變數宣告與型態 特殊運算子符號 字串與數值的轉換 類別與物件的觀念 建立新的專案 WinMain 程式進入點 Include Header File.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Introduction to Java Programming Lecture 1: Introduction To Java And Computers Spring 2008.
Introduction to Java Programming Lecture 1: Introduction To Java And Computers 2/
In Chapter 1 您將學到什麼 ? 了解 Java 語言的特徵 Java 程式的發展過程關係 Java 程式的基本架構.
教材名稱:網際網路安全之技術及其應用 (編號: 41 ) 計畫主持人:胡毓忠 副教授 聯絡電話: 教材網址: 執行單位: 政治大學資訊科學系.
資訊教育 東海大學物理系施奇廷 92 學年度第一學期. 物理研究的新方法 傳統:理論與實驗 傳統:理論與實驗 現在:理論、實驗、計算 現在:理論、實驗、計算 計算 vs. 實驗:計算物理可視為在所有的條 件皆能完美調控之下的「數值實驗室」 計算 vs. 實驗:計算物理可視為在所有的條 件皆能完美調控之下的「數值實驗室」
資料結構實習-一 參數傳遞.
資訊教育 吳桂光 東海大學物理系助理教授 Tel: 3467 Office: ST223 Office hour: Mon (10:30-12am) or by appointment.
1 Introduction to Java Programming Lecture 2: Basics of Java Programming Spring 2008.
計算機概論 演算法與程式語言 李明山.
第 9 章 TSR 程式基本教練. 本章提要 TSR 程式 以熱鍵 (Hot key) 叫用 TSR 程式 Clock 中斷 int 08h 、 int 1ch DOS reentrant 的問題 有用的 TSR 程式.
函式 Function Part.2 東海大學物理系‧資訊教育 施奇廷. 遞迴( Recursion ) 函式可以「呼叫自己」,這種動作稱為 「遞迴」 此程式的執行結果相當於陷入無窮迴圈, 無法停止(只能按 Ctrl-C ) 這給我們一個暗示:函式的遞迴呼叫可以 達到部分迴圈的效果.
資料結構實習-二.
2010 MCML introduction 製作日期: 2010/9/10 製作人 : 胡名霞.
資訊教育 吳桂光 東海大學物理系助理教授 Tel: Office: ST223 Office hour: Mon (8:10-12am) or by appointment.
資訊教育 吳桂光 東海大學物理系助理教授 Tel: 3467 Office: ST223 Office hour: Tue, Fri. (10-11am)
1 Introduction to Java Programming Lecture 2: Basics of Java Programming Spring 2009.
Chapter 1: Introduction to Computers and Java
1 Introduction to Java Programming Lecture 2: Basics of Java Programming Spring 2010.
What is static? CS340100, NTHU Yoshi. Static? 靜態 ? class Test { static int staticX; int instanceX; public Test(int var1, int var2) { this.staticX = var1;
Microsoft Excel.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
1 Introduction to Java Programming Lecture 3 Mathematical Operators Spring 2009.
第 1 章 PC 的基本構造. 本章提要 PC 系統簡介 80x86 系列 CPU 及其暫存器群 記憶體: Memory 80x86 的分節式記憶體管理 80x86 的 I/O 結構 學習組合語言的基本工具.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
1 柱體與錐體 1. 找出柱體與錐體的規則 2. 柱體的命名與特性 3. 柱體的展開圖 4. 錐體的命名與特性 5. 錐體的展開圖
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
© 2012 Pearson Education, Inc. All rights reserved. Starting Out with Java: From Control Structures through Data Structures Second Edition by Tony Gaddis.
Introduction to Java Lecture # Java History Green Team started by Sun Microsystems. *7 Handheld controller for multiple entertainment systems.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
CS2422 Basic Concepts Department of Computer Science National Tsing Hua University.
Chapter 1: Introduction to Computers and Java
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
CHAPTER 1 Introduction to Computers and Java Copyright © 2016 Pearson Education, Inc., Hoboken NJ.
Java Tutorial /10/21. Java Resource Java SDK –Download from –Install Jdk windows-i586.exe –
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Java: From Control Structures through Objects Third Edition.
! !美洲華語 李雅莉老師製作 TextVocabularyidiomStoryChallenge $100 $200 $300 $400 $500 $600 $100 $200 $300 $400 $500 $600 $100 $200 $300 $400 $500 $600 $100 $200.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
©2016 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved. CSC 110 – INTRO TO COMPUTING - PROGRAMMING Overview of Programming.
Chapter 1: Introduction to Computers and Java 1-2 Chapter Topics Chapter 1 discusses the following main topics: –Introduction –Why Program? –Computer.
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved. Introduction to Computers and Computing.
CHAPTER 1 Introduction to Computers and Java Copyright © 2016 Pearson Education, Ltd.
Chapter 1: Introduction to Computers and Programming.
© 2012 Pearson Education, Inc. All rights reserved. Starting Out with Java: From Control Structures through Data Structures Second Edition by Tony Gaddis.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
CSC235 Computer Organization & Assembly Language
Lecture 1b- Introduction
Assembly Language for x86 Processors 6th Edition
Chapter 1: Introduction to Computers and Java
Presentation transcript:

© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Starting Out with Java: From Control Structures through Objects Fourth Edition by Tony Gaddis Chapter 1: Introduction to Computers and Java

© 2010 Pearson Addison-Wesley. All rights reserved Software Software refers to the programs that run on a computer. There are two classifications of software: –Operating Systems ( 作業系統 ) –Application Software ( 應用軟體 )

© 2010 Pearson Addison-Wesley. All rights reserved Programming Languages A program( 程式 ) –a set of instructions a computer follows in order to perform a task. – 我們來觀察電腦中的應用程式: Winword.exe A programming language( 程式語言 ) –a special language used to write computer programs. 別以為微波爐與遙控器上的文字是給機器看的 –Java 語言比中文嚴謹許多 – 要吃蘋果嗎 = 蘋果要吃嗎 = 你要吃蘋果嗎 = 蘋果你 要吃嗎

© 2010 Pearson Addison-Wesley. All rights reserved. 程式執行的基本過程 Central Processing Unit Main Memory USB Disk Hard Disk Secondary memory devices provide long-term storage Information is moved between main memory and secondary memory as needed Hard disks Floppy disks ZIP disks Writable CDs Writable DVDs Tapes 觀察 WinWord.exe 進入記憶體

© 2010 Pearson Addison-Wesley. All rights reserved. 1-5 Programming Languages The binary numbers are encoded as a machine language ( 機器 語言 ). Each CPU has its own machine language. –Motorola series processors –Intel x86 series processors –DEC Alpha processors, etc. Example of a machine language instruction: – (ADD) – (MOV) In the distant past, programmers wrote programs in machine language.

© 2010 Pearson Addison-Wesley. All rights reserved. 1-6 Programming Languages High level programming languages ( 高階語言 ) followed that were not processor dependent. Some common programming languages: Java BASICC++ C Python COBOL JavaScript Ruby PHP C# Visual Basic Pascal

© 2010 Pearson Addison-Wesley. All rights reserved. 1-7 Program Development Process Text editor Source code (.java ) Saves Java statements Java compiler Is read by Byte code (.class ) Produces Java Virtual Machine Is interpreted by Program Execution Results in 平台依賴性 平台無關性

© 2010 Pearson Addison-Wesley. All rights reserved. Translating Languages English: Display the sum of A times B plus C. Java: System.out.println(A*B+C) Assembly Language: mov eax,A mul B add eax,C call WriteInt Intel Machine Language: A F E

© 2010 Pearson Addison-Wesley. All rights reserved What is a Program Made of? Common Language Elements There are some concepts that are common to virtually all programming languages. Common concepts: –Key words ( 關鍵字 ) Reserved words ( 保留字 ) –Operators ( 運算子 ) –Punctuation ( 標點符號 ) –Programmer-defined identifiers ( 自訂識別字 ) –Strict syntactic rules. ( 語法規則 )

© 2010 Pearson Addison-Wesley. All rights reserved Programming Languages Sample Program public class HelloWorld { public static void main(String[] args) { String message = "Hello World"; System.out.println(message); }

© 2010 Pearson Addison-Wesley. All rights reserved Programming Languages Sample Program Key words in the sample program are: Key words are lower case (Java is a case sensitive language). – 課堂活動:讓我們試試把 public 改成 PUBLIC… Key words cannot be used as a programmer-defined identifier. – 課堂活動:讓我們試試把 main 改成 public… – 課堂活動:讓我們試試把 main 改成 class… public class static void

© 2010 Pearson Addison-Wesley. All rights reserved Programming Languages Semi-colons are used to end Java statements( 敘 述 ) not all lines of a Java program end a statement. Part of learning Java is to learn where to properly use the punctuation.

© 2010 Pearson Addison-Wesley. All rights reserved Programming Languages Lines vs Statements There are differences between lines ( 行 ) and statements when discussing source code. System.out.println( message); This is one Java statement written using two lines. A statement is a complete Java instruction that causes the computer to perform an action.

© 2010 Pearson Addison-Wesley. All rights reserved Programming Languages Variables ( 變數 ) Data in a Java program is stored in memory. Variable names ( 變數名稱 ) represent a location in memory. Variables are created by the programmer who assigns it a programmer-defined identifier. example: int hours = 40; In this example, the variable hours is created as an integer (more on this later) and assigned the value of 40. 請幫我把右邊第三個抽屜裡面 的東西拿給我

© 2010 Pearson Addison-Wesley. All rights reserved Programming Languages Variables Variables are simply a name given to represent a place in memory. 0x000 0x001 0x002 0x003 0x004 0x005 0x006 0x007

© 2010 Pearson Addison-Wesley. All rights reserved Programming Languages Variables 0x000 0x001 0x002 0x003 0x004 0x005 0x006 0x007 The Java Virtual Machine (JVM) actually decides where the value will be placed in memory. 72 Assume that the this variable declaration has been made. int length = 72; The variable length is a symbolic name for the memory location 0x003.