Chap 1. Getting Started Objectives

Slides:



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

In Review JAVA C++ GUIs - Windows Webopedia.com.
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.
Client Side Programming Using Java Applet Outcomes: You will be expected to know: – Java Applets and HTML file; –bytecode and platform independent programs;
Introduction to Java The objectives of this chapter are: To describe the key aspects of Java To describe the Java software development kit (SDK) To explain.
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.
Introduction to Java Programming
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,
JAVA ENVIRONMENT JDK, API, JVM. JAVA ENVIRONMENT  Java environment includes development tools and many classes and methods. Java Environment JDK (Java.
Introduction to Java.
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 vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming.
 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.
Java Introduction Lecture 1. Java Powerful, object-oriented language Free SDK and many resources at
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.
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.
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.
© 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 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.
CSC 551: Web Programming Spring 2004
(Computer fundamental Lab)
CSC 551: Web Programming Spring 2004
Chap 4. Programming Fundamentals
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 1. Getting Started Objectives Describes the key features of the Java language Describe the Java Virtual Machine Write a simple Java application, compile and run it. Use the Java API on-line documentation

What is Java? A programming language A development environment An application environment Key features Object-oriented language Provide an interpreted environment Eliminate pointer arithmetic and memory allocation/deallocation Possible to run more than one thread Improved security

Java Virtual Machine(JVM) 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.

Java Translation and Execution Java source code Java bytecode Java compiler Java interpreter Bytecode compiler Runtime Machine code

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

Java Translation 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

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

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

Java Translation 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

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)

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

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

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

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

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

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 See Confucius.java and No_Parking.java Links to applets can be embedded in HTML documents

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