Introduction to Java

Similar documents
CHAPTER 1. Introduction to JAVA Programming

Programming in the Small II: Control

Index. Course Outline. Grading Policy. Lab Time Distribution. Important Instructions

Lecture 1: Overview of Java

Advanced Computer Programming

Kickstart Intro to Java Part I

Introduction to Java

Step 2: Map ER Model to Tables

CHAPTER 1 Introduction to Computers and Java

Advanced Computer Programming

G52PGP. Lecture oo3 Java (A real object oriented language)

Correctness and Robustness

Seminar report Java Submitted in partial fulfillment of the requirement for the award of degree Of CSE

XML Parsers. Asst. Prof. Dr. Kanda Runapongsa Saikaew Dept. of Computer Engineering Khon Kaen University

1. What is Jav a? simple

Class 1: Homework. Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017

Lecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University

Outline. Introduction to Java. What Is Java? History. Java 2 Platform. Java 2 Platform Standard Edition. Introduction Java 2 Platform

Programming. Syntax and Semantics

Lecture 4: Introduction to Java and your Development Environment

Outline. Overview. Control statements. Classes and methods. history and advantage how to: program, compile and execute 8 data types 3 types of errors

IT151: Introduction to Programming (java)

1.1 Your First Program

Learning objectives. The Java Environment. Java timeline (cont d) Java timeline. Understand the basic features of Java

Advanced Computer Programming

Advanced Object-Oriented Programming Introduction to OOP and Java

The Java programming environment. The Java programming environment. Java: A tiny intro. Java features

8/23/2014. Chapter Topics. Introduction. Java History. Why Program? Java Applications and Applets. Chapter 1: Introduction to Computers and Java

Chapter 1: Introduction to Computers and Java

C02: Overview of Software Development and Java

Chapter 1 Introduction to Computers, Programs, and Java

II. Compiling and launching from Command-Line, IDE A simple JAVA program

Chapter 1 Introduction to Java

Business and Scientific Applications of the Java Programming Language

Chapter 1 INTRODUCTION SYS-ED/ COMPUTER EDUCATION TECHNIQUES, INC.

Introduction to Java. Java Programs Classes, Methods, and Statements Comments Strings Escape Sequences Identifiers Keywords

Java Bytecode (binary file)

Lecture 1: Introduction to Java

Getting Started with Java. Atul Prakash

Programming in the Large II: Objects and Classes (Part 1)

Java is a high-level programming language originally developed by Sun Microsystems and released in Java runs on a variety of

Code Ninjas: Introduction to Computer Science. Macomb Science Olympiad Presented by Swati Dharia

Chapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc.

Java Memory Management

Lecture 1 - Introduction (Class Notes)

Program Development. Program Development. A Foundation for Programming. Program Development

CS 11 java track: lecture 1

CT 229. CT229 Lecture Notes. Labs. Tutorials. Lecture Notes. Programming II CT229. Objectives for CT229. IT Department NUI Galway

Well-formed XML Documents

Lesson 04: Our First Java Program (W01D4

Introduction to Java. Lecture 1 COP 3252 Summer May 16, 2017

Heap, Variables, References, and Garbage. CS152. Chris Pollett. Oct. 13, 2008.

History Introduction to Java Characteristics of Java Data types

Java Programming Language Mr.Rungrote Phonkam

A PROGRAM IS A SEQUENCE of instructions that a computer can execute to

An overview of Java, Data types and variables

CMSC 150 LECTURE 1 INTRODUCTION TO COURSE COMPUTER SCIENCE HELLO WORLD

CompSci 125 Lecture 02

Simple API for XML (SAX)

Goals. Java - An Introduction. Java is Compiled and Interpreted. Architecture Neutral & Portable. Compiled Languages. Introduction to Java

JAX-WS 3/14/12 JAX-WS

COMP6700/2140 JDK Tools

Answer1. Features of Java

Lesson 01 Introduction

CS 177 Recitation. Week 1 Intro to Java

Chapter 1 Introduction to Computers, Programs, and Java

Memory management. Johan Montelius KTH

CS 231 Data Structures and Algorithms, Fall 2016

Fundamentals of Programming. By Budditha Hettige

Certified Core Java Developer VS-1036

AP Computer Science Summer Assignment (updated 5/29/2018) DUE : Sept. 4, 2018

Sample Copy. Not for Distribution.

3 CREATING YOUR FIRST JAVA APPLICATION (USING WINDOWS)

Introduction to Programming (Java) 2/12

LANGUAGE RUNTIME NON-VOLATILE RAM AWARE SWAPPING

Step 4: Choose file organizations and indexes

1. Introduction. Java. Fall 2009 Instructor: Dr. Masoud Yaghini

Performance of Non-Moving Garbage Collectors. Hans-J. Boehm HP Labs

Programming in the Large II: Objects and Classes (Part 2)

Introduction to Java Programming CPIT 202. WEWwwbvxnvbxmnhsgfkdjfcn

Chapter 1: Introduction to Computers, Programs, and Java

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring

COT 3530: Data Structures. Giri Narasimhan. ECS 389; Phone: x3748

From C++ to Java. Duke CPS

Getting Started With Java

Name, Scope, and Binding. Outline [1]

Chapter 1 Introduction to Computers, Programs, and Java

This lecture will take you through simple and practical approach while learning Java Programming language.

History of Java. Java was originally developed by Sun Microsystems star:ng in This language was ini:ally called Oak Renamed Java in 1995

Java: Comment Text. Introduction. Concepts

Introduction to Java. Nihar Ranjan Roy.

BASICS.

Lecture 1: Introduction to Java

Crash Course Review Only. Please use online Jasmit Singh 2

Database Normalization

GUI Event Handlers (Part I)

JAVA An overview for C++ programmers

COSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan

Step 1: Create and Check ER Model

Chapter 1 Introduction to Computers, Programs, and Java

Transcription:

Introduction to Java 188230 Advanced Computer Programming Asst. Prof. Dr. Kanda Runapongsa Saikaew (krunapon@kku.ac.th) Department of Computer Engineering Khon Kaen University

Agenda What Java Is Why Java Installing Java Running Your First Java Program 188230 Advanced Computer Programming 2

What Java Is Java (with a capital J) is a high-level, third generation programming language, like C++ You can use Java to write computer applications that compute numbers, process words, play games, store data, etc. Java is a programming language and environment invented by James Gosling and others in 1994 188230 Advanced Computer Programming 3

Java Compiler and Interpreter Java programs that have been compiled into byte code still need an interpreter to execute them on any given platform The interpreter reads the byte code and translates it into the native language of the host machine on the fly Java compiler is javac Java interpreter is java 188230 Advanced Computer Programming 4

Agenda What Java Is Why Java Getting Java Software Installing Java Running Your First Java Program 188230 Advanced Computer Programming 5

Why Java Java is simple Java is object-oriented Java is platform independent Java is safe Java is high performance Java is multi-threaded Java is dynamic(ly linked) Java is garbage collected 188230 Advanced Computer Programming 6

Java is Simple Java was designed to make it much easier to write bug free code Java is easy to read and write Java does not need users to do memory allocation and deallocation Java is easy to learn 188230 Advanced Computer Programming 7

Java is Object-Oriented Simpler and easier to read programs More efficient reuse of code Faster time to market More robust and error-free code 188230 Advanced Computer Programming 8

Java is Platform Independent A Java program never really executes natively on the host machine Rather a special native program called the Java interpreter reads the byte code and executes the corresponding native machine instructions To port Java programs to a new platform, all you need to do is run it with an interpreter written for the new platform You don't even need to recompile 188230 Advanced Computer Programming 9

Java is Safe Java was designed from the ground up to allow for secure execution of code across a network Most notably there are no pointers in Java Java programs cannot access arbitrary addresses in memory Java implements a robust exception handling mechanism to deal with both expected and unexpected errors 188230 Advanced Computer Programming 10

Java is High Performance Java byte codes can be compiled on the fly to code that rivals C++ in speed using a "just-intime compiler." There are native-machine-architeture compilers for Java that produce executable code that does not require a separate interpreter These will produce executable code that does not require a separate interpreter, and that is indistinguishable in speed from C++ 188230 Advanced Computer Programming 11

Java is Multi-Threaded A process has a self-contained execution environment Each process has its own memory space Threads are sometimes called lightweight processes Creating a new thread requires fewer resources than creating a new process Java is inherently multi-threaded A single Java program can have many different processes executing independently and continuously 188230 Advanced Computer Programming 12

Java is Dynamic(ly linked Java does not have an explicit link phase Java source code is divided into.java files The compiler compiles these into.class files containing byte code Java.class files tend to be quite small, a few kilobytes at most It is not necessary to link in large runtime libraries to produce an executable Instead the necessary classes are loaded from the user's local system 188230 Advanced Computer Programming 13

Java is Garbage Collected Objects are created by Java's "new" operator, and memory for new objects is allocated on the heap at run time Garbage collection is the process of automatically freeing objects that are no longer referenced by the program This frees the programmer from having to keep track of when to free allocated memory, thereby preventing many potential bugs and headaches. 188230 Advanced Computer Programming 14

Installing Java Go to http://www.google.com Type install java on Windows' if you use Windows Java Downloads for All Operating Systems http://www.java.com/en/download/manual.jsp Choose Java SE with the latest version (Version 6 update 13) 188230 Advanced Computer Programming 15

Developing Your First Java Program Use text editor to write a file HelloWorld.java public class HelloWorld { } public static void main(string[] args) { } System.out.println( Hello World ); 188230 Advanced Computer Programming 16

Compiling and Running Program To compile a Java program Use command javac <filename.java> Example: javac HelloWorld.java To run a Java program Use command java <filename> Example: java HelloWorld 188230 Advanced Computer Programming 17

Sample Compiling and Running 188230 Advanced Computer Programming 18

Summary Java is a safe, robust, garbage-collected, object-oriented, high-performance, multithreaded, interpreted, architecture-neutral, cross-platform programming language Java complier is javac and Java interpreter is java To compile a program: javac filename.java To run a program: java filename 188230 Advanced Computer Programming 19

References http://www.javaworld.com/javaworld/jw-08-1996/ http://citec.us/forum/index.php?showtopic=3116 Elliotte Rusty Harold, The Java Developer's Resource, available at http://ibiblio.org/java/books/jdr/chapters/intro.htm 188230 Advanced Computer Programming 20