Chap 4. Programming Fundamentals

Slides:



Advertisements
Similar presentations
In Review JAVA C++ GUIs - Windows Webopedia.com.
Advertisements

Chapter 1: Computer Systems
Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming.
Object Orientated Programming
The Java Programming Language
JDK, Jan Pettersen Nytun - HiA 1 The Java Programming Environment: The programmer write source code with a text editor. The programmer write source code.
Slides prepared by Rose Williams, Binghamton University Chapter 1 Getting Started 1.1 Introduction to Java.
Aalborg Media Lab 21-Jun-15 Software Design Lecture 1 “ Introduction to Java and OOP”
Outline Java program structure Basic program elements
1 Chapter 3 Programs and Packages. 2 Java Virtual Machine (JVM) Java programs execute on the JVM. The JVM is a virtual rather than a physical machine,
Chapter 1 Introduction.
Introduction to the JDK Java for Computational Finance
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
Java Software Solutions Lewis and Loftus Chapter 2 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Software Concepts -- Introduction.
Chapter 1 Introduction.
Java Programming, 2E Introductory Concepts and Techniques Chapter 2 Creating a Java Application and Applet.
Java Programming, 3e Concepts and Techniques Chapter 2 - Part 2 Creating a Java Application and Applet.
 Java Programming Environment  Creating Simple Java Application  Lexical Issues  Java Class Library.
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
Chapter 1.4 Programming languages Homework Due: Monday, August 11, 2014.
Introduction to Computers and Java Chapter 1.3. A Sip of Java: Outline History of the Java Language Applets A First Java Program Compiling a Java Program.
© 2006 Pearson Education 1 Obj: cont 1.3 and 1.4, to become familiar with identifiers and to understand how programming languages work HW: p.51 #1.8 –
FRST JAVA PROGRAM. Getting Started with Java Programming A Simple Java Application Compiling Programs Executing Applications.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
1 Introduction zNow we can begin to examine the basic ideas behind writing programs zLecture 1 focuses on: ythe structure of a Java application ybasic.
1 Computer Systems -- Introduction  Chapter 1 focuses on:  the structure of a Java application  basic program elements  preparing and executing a program.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and Server Side Programming Very rich GUI libraries Portability (machine independence) A.
CIS 644 Aug. 25, 1999 tour of Java. First … about the media lectures… we are experimenting with the media format please give feedback.
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
POS 406 Java Technology And Beginning Java Code
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Java Introduction 1. Introduction to Java Programming2 Computers and Computer Languages Computers are everywhere –how many computers do you own? Computers.
CS 3131 Introduction to Programming in Java Rich Maclin Computer Science Department.
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
FIRST JAVA PROGRAM. JAVA PROGRAMS Every program may consist of 1 or more classes. Syntax of a class: Each class can contain 1 or more methods. public.
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
Object Oriented Programming Examples: C++, Java Advantages: 1. reusibility of code 2. ability to adapt (extend) previously written code.
© 2004 Pearson Addison-Wesley. All rights reserved ComS 207: Programming I Instructor: Alexander Stoytchev
Lecture 2 Software Concepts Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of Technology.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and web applications Very rich GUI libraries Portability (machine independence) A real Object.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
White Space Spaces, blank lines, and tabs are collectively called white space and are used to separate words and symbols in a program Extra white space.
Java 3 More Java Then Java. Libraries & Packages Java standard class library is composed of useful classes that help us to achieve our programming goals.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
Java Software Solutions Lewis and Loftus Chapter 2 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Software Concepts -- Introduction.
Creating a Java Application and Applet
Know Your Java. Java is special Java source code Byte code/ native code Object code on windows Object code on Dos Object code on Lynux.
ITP 109 Week 2 Trina Gregory Introduction to Java.
Execution ways of program References: www. en.wikipedia.org/wiki/Integrated_development_environment  You can execute or run a simple java program with.
WEEK 2 1 Software Concepts -- Introduction Now we can begin to examine the basic ideas behind writing programs Chapter 2 focuses on: history.
Introduction to Programming 1 1 2Introduction to Java.
Introduction to 1. What is Java ? Sun Microsystems Java is a programming language and computing platform first released by Sun Microsystems in The.
1 Creating Objects  A variable holds either a primitive type or a reference to an object  A class name can be used as a type to declare an object reference.
1 Problem Solving  The purpose of writing a program is to solve a problem  The general steps in problem solving are: Understand the problem Dissect the.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
CS-140 Dick Steflik Lecture 3. Java C++ Interpreted optimized for the internet Runs on virtual ized machine Derived from C++ Good object model Widely.
Applications Active Web Documents Active Web Documents.
Working with Java.
CSCI-235 Micro-Computer Applications
Introduction to.
Internet and Java Foundations, Programming and Practice
Java programming lecture one
Introduction to Java Dept. Business Computing University of Winnipeg
Java Intro III.1 (Fr Feb 23).
Chapter 1: Computer Systems
Introduction CSC 111.
(Computer fundamental Lab)
Chap 1. Getting Started Objectives
Instructor: Alexander Stoytchev
Outcome of the Lecture Upon completion of this lecture you will be able to understand Fundamentals and Characteristics of Java Language Basic Terminology.
Presentation transcript:

Chap 4. Programming Fundamentals Chapter 4

Java Compiling and Execution Java source code Java bytecode Java compiler Java interpreter Bytecode compiler Runtime Machine code Chapter 4

Java Compiling and Execution The Java compiler translates Java source code into a special representation called bytecode Java bytecode is not the machine language for any traditional CPU Another software tool, called an interpreter, translates bytecode into machine language and executes it Therefore the Java compiler is not tied to any particular machine Java is considered to be architecture-neutral Chapter 4

Programming Languages A program must be translated into machine language before it can be executed on a particular type of CPU This can be accomplished in several ways A compiler is a software tool which translates source code into a specific target language Often, that target language is the machine language for a particular CPU type The Java approach is somewhat different Chapter 4

Java Virtual Machine(JVM) 교재 4-8 페이지 참조 An imaginary machine that is implemented by software Provide the hardware platform specification to which all Java code is compiled. Enables Java programs to be platform independent It is up to the Java interpreter of each specific hardware platform to ensure the running of code compiled for the JVM. Chapter 4

Java Program Structure See HelloWorldApp.java A program is made up of one or more classes A class contains one or more methods A method contains program statements A Java application always executes the main method Chapter 4

Java program 예: HelloWorldApp.java // // Sample HelloWorld application public class HelloWorldApp{ public static void main (String args[]) { System.out.println ("Hello World!"); } Chapter 4

Java Compiling and Execution Executing the compiler in a command line environment: > javac HelloWorldApp.java This creates a file called HelloWorldApp.class, which is submitted to the interpreter to be executed: > java HelloWorldApp The .java extension is used at compile time, but the .class extension is not used with the interpreter Other environments do this processing in a different way Chapter 4

Errors A program can have three types of errors The compiler will find problems with syntax and other basic issues (compile-time errors) If compile-time errors exist, an executable version of the program is not created A problem can occur during program execution, such as trying to divide by zero, which causes a program to terminate abnormally (run-time errors) A program may run, but produce incorrect results (logical errors) Chapter 4

Using the java Documentation The layout of this documentation is hierarchical.---> inheritance property Each class document has the same format The main sections of a class document include: The class hierarchy A description of the class and its general purpose A list of member variables A list of constructors A list of methods A detailed list of variables, constructors, methods Chapter 4

The Java API The Java Application Programmer Interface (API) is a collection of classes that can be used as needed The println and print methods are part of the Java API; they are not part of the Java language itself Both methods print information to the screen; the difference is that println moves to the next line when done, but print does not Chapter 4

Class Libraries The Java API is a class library, a group of classes that support program development Classes in a class hierarchy are often related by inheritance The classes in the Java API is separated into packages The System class, for example, is in package java.lang Each package contains a set of classes that relate in some way Chapter 4

The Java API Packages java.applet java.awt java.beans java.io Some packages in the Java API: java.applet java.awt java.beans java.io java.lang java.math java.net java.rmi java.security java.sql java.text java.util Chapter 4

Importing Packages Using a class from the Java API can be accomplished by using its fully qualified name: java.lang.System.out.println (); Or, the package can be imported using an import statement, which has two forms: import java.applet.*; import java.util.Random; The java.lang package is automatically imported into every Java program Chapter 4

Java Applets A Java applet is a Java program that is intended to be sent across a network and executed using a Web browser A Java application is a stand alone program Applications have a main method, but applets do not Applets are derived from the java.applet.Applet class Links to applets can be embedded in HTML documents Chapter 4

Java Applets local computer Java source code Java compiler Java bytecode Web browser remote computer Java interpreter Chapter 4

Models of Software Design and Development Staged Delivery Model Design-to-schedule Model Spiral Model Waterfall Model Evolutionary Delivery Model Chapter 4

Software Ideas and Concepts Requirement Analysis Architectural Design Waterfall Model Software Ideas and Concepts Requirement Analysis Architectural Design Detailed Design Coding and Debugging Testing Chapter 4