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

Similar documents
Java Programming Language Mr.Rungrote Phonkam

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

CHAPTER 1. Introduction to JAVA Programming

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview

History Introduction to Java Characteristics of Java Data types

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

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

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

Introduction to Java

Lecture 1: Introduction to Java

Introduction to Java. Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved.

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

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

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

Chapter 1 Introduction to Java

Chapter 1 Introduction to Computers, Programs, and Java. What is a Computer? A Bit of History

Introduction Welcome! Before you start Course Assessments The course at a glance How to pass M257

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 Language. Programs. Computer programs, known as software, are instructions to the computer. You tell a computer what to do through programs.

Networks Programming Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000)

Java Professional Certificate Day 1- Bridge Session

Introduction to Java Programming

Introduction. Overview of the Course on Java. Overview of Part 1 of the Course

Introduction to JAVA Programming Language

Advanced Object-Oriented Programming Introduction to OOP and Java

CSE 421 Course Overview and Introduction to Java

Programming. Syntax and Semantics

Project 1. Java Control Structures 1/17/2014. Project 1 and Java Intro. Project 1 (2) To familiarize with

Course information. Petr Hnětynka 2/2 Zk/Z

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

Chapter 1 Introduction to Computers, Programs, and Java

Chapter 1 Introduction to Computers, Programs, and Java

Outline. Object Oriented Programming. Course goals. Staff. Course resources. Assignments. Course organization Introduction Java overview Autumn 2003

Kickstart Intro to Java Part I

IQTIDAR ALI Lecturer IBMS Agriculture University Peshawar

COMP6700/2140 JDK Tools

1. What is Jav a? simple

B.V. Patel Institute of BMC & IT, UTU 2014

Notes of the course - Advanced Programming. Barbara Russo

엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University COPYRIGHTS 2017 EOM, HYEONSANG ALL RIGHTS RESERVED

Chapter 1 Introduction to Computers, Programs, and Java

Programming with Java

Course information. Petr Hnětynka 2/2 Zk/Z

2 Introduction to Java. Introduction to Programming 1 1

Atelier Java - J1. Marwan Burelle. EPITA Première Année Cycle Ingénieur.

Java Programming. Manuel Oriol, March 22nd, 2007

Object Oriented Concepts and Programming (CSC244) By Dr. Tabbasum Naz

CS335 Graphics and Multimedia

CS5015 Object-oriented Software Development. Lecture: Overview of Java Platform. A. O Riordan, 2010 Most recent revision, 2014 updated for Java 8

: Primitive data types Variables Operators if, if-else do-while, while, for. // // First Java Program. public class Hello {

2 rd class Department of Programming. OOP with Java Programming

Introduction to Java Programming CPIT 202. WEWwwbvxnvbxmnhsgfkdjfcn

COE318 Lecture Notes Week 3 (Week of Sept 17, 2012)

Lesson 01 Introduction

Tutorial 1 CSC 201. Java Programming Concepts عؾادئماظربجمةمبادؿكدامماجلاصا

Chapter 1: Introduction to Computers, Programs, and Java

Lecture 1: Overview of Java


Chapter 2 First Java Programs

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

OOSD. Introduction to JAVA. Giuseppe Lipari Scuola Superiore Sant Anna Pisa. September 12, 2011

Certified Core Java Developer VS-1036

Getting Started with Java. Atul Prakash

1. Java is the fastest growing programming language in the world.

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

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

Chapter 1 Introduction to Computers, Programs, and Java

Selected Java Topics

Introduction to OOP Using Java Pearson Education, Inc. All rights reserved.

Introduction to Java

OOSD. Introduction to JAVA. Giuseppe Lipari Scuola Superiore Sant Anna Pisa. September 29, 2010

Chapter 1. Introduction

Introduction to Java. Nihar Ranjan Roy.

Games Course, summer Introduction to Java. Frédéric Haziza

Getting Started With Java

5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont.

Course Outline. Introduction to java

Core JAVA Training Syllabus FEE: RS. 8000/-

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson

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

Lesson 2: First Java Programs

Lesson 04: Our First Java Program (W01D4

Getting Started. Chapter 1. Java Programming FROM THE BEGINNING. Chapter 1: Getting Started

Accurate study guides, High passing rate! Testhorse provides update free of charge in one year!

Agenda. Announcements. Extreme Java G Session 2 - Main Theme Java Tools and Software Engineering Techniques

Crash Course in Java. Why Java? Java notes for C++ programmers. Network Programming in Java is very different than in C/C++

Fall 2017 CISC124 9/16/2017

Application of Java in UG Based CAD Tool Development. Xuefeng Zhang GE Global Research Niskayuna, NY

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

Architecting Java solutions for CICS

02/03/15. Compile, execute, debugging THE ECLIPSE PLATFORM. Blanks'distribu.on' Ques+ons'with'no'answer' 10" 9" 8" No."of"students"vs."no.

Objectives. Chapter 1 Introduction to Computers, Programs, and Java. What is a Computer?

Chapter 1 Introduction to Computers, Programs, and Java

Assumptions. History

Exam Questions 1Z0-850

Objectives. Problem Solving. Introduction. An overview of object-oriented concepts. Programming and programming languages An introduction to Java

Outline. Parts 1 to 3 introduce and sketch out the ideas of OOP. Part 5 deals with these ideas in closer detail.

Introduction to Computers, Programs, and Java. CSE 114, Computer Science 1 Stony Brook University

Slide 1 Java Programming 1 Lecture 2D Java Mechanics Duration: 00:01:06 Advance mode: Auto

Transcription:

Learning objectives The Java Environment Understand the basic features of Java What are portability and robustness? Understand the concepts of bytecode and interpreter What is the JVM? Learn few coding conventions How shall I name identifiers? Version 1.1 Oct 2006 2 Java timeline 1991: SUN develops a programming language for cable TV set-top boxes Simple, OO, platform independent 1994: Java-based web browser (HotJava), the idea of applet comes out 1996: first version of Java (1.0) Java timeline (cont d) 1996: Netscape supports Java Popularity grows 1996: Java 1.02 released, followed by many updated releases in close rounds 1997: Java 1.1 released, major leap over for the language 1998: Java 2 platform (1.2 ver) released (libraries) 2005: Java 5 (language enhancements) New features marked with 3 4

OO language features OO language provides constructs to: Define classes (types) in a hierarchic way (inheritance) Create/destroy objects dynamically Send messages (w/ dynamic binding) No procedural constructs (pure OO language) no functions, class methods only no global vars, class attributes only Java features Platform independence (portability) Write once, run everywhere Translated to intermediate language (bytecode) Interpreted (with optimizations, e.g. JIT) High dynamicity Run time loading and linking Dynamic array sizes Automatic garbage collection 5 6 Java features (cont d) Robust language, i.e. less error prone Strong type model and no pointers Compile-time checks Run-time checks No array overflow Garbage collection No memory leaks Exceptions as a pervasive mechanism to check errors Java features (cont d) Shares many syntax elements w/ C++ Learning curve is less steep for C/C++ programmers Quasi-pure OO language Only classes and objects (no functions, pointers, and so on) Basic types deviates from pure OO... Easy to use 7 8

Java features - Classes There is one first level concepts: the class public class First { The source code of a class sits in a.java file having the same name Rule: one file per class Enforced automatically by IDEs Java features - Methods In Java there are no functions, but only methods within classes The execution of a Java program starts from a special method: public static void main(string[] args) Note return type is void args[0] is the first argument on the command line (after the program name) 9 Build and run Building and running (simple) Build environment Run-Time environment First.java Output Java Source (.java) Byte code Loader javac First.java Java compiler First.class bytecode Java Virtual Machine java -cp. First Note: no extension Java Compiler (javac) Java ByteCode (.class) Interpreter Byte code Verifier Run time OS/HW Just In Time (JIT) Compiler Java Virtual Machine (JVM) 12

Example File: First.java: public class First { public static void main(string[] args){ int a; a = 3; System.out.println(a); Java features (cont d) Supports programming in the large JavaDoc Class libraries (Packages) Lots of standard utilities included Concurrency (thread) Graphics (GUI) (library) Network programming (library) socket, RMI applet (client side programming) 14 Types of Java programs Application It s a common program, similarly to C executable programs Runs through the Java interpreter (java) of the installed Java Virtual Machine public class HelloWorld { public static void main(string args[]){ System.out.println( Hello world! ); Types of Java programs Applet (client browser) Java code dynamically downloaded Execution is limited by sandbox Servlet (web server) In J2EE (Java 2 Enterprise Edition) Midlet (mobile devices, e.g. smartphone and PDA) In J2ME (Java 2 Micro Edition) 15 16

Java development environment JSE 1.5.0_08 javac compiler jdb debugger JRE (Java Run Time Environment) Interpreter Native packages (awt, swing, system, etc) Docs http://java.sun.com/j2se/1.5.0/docs/ Eclipse editor http://www.eclipse.org/ Coding conventions Use camelback capitalization for compound names, not underscore Class name must be capitalized Method name, object instance name, attributes, method variables must all start in lowercase Constants must be all uppercases (w/ underscore) Indent properly 17 18 Coding conventions (example) class ClassName { const double PI = 3.14; private int attributename; public void methodname { int var; if ( var==0 ) { Wrap-up session Java is a quasi-pure OO language Java is interpreted Java is robust (no pointers, static/dynamic checks, garbage collection) Java provides many utilities (data types, threads, networking, graphics) Java can used for different types of programs Coding conventions are not just aesthetic 19 20

FAQ Which is more powefull : Java or C? Performance: C is better though non that much better (JIT) Ease of use: Java Error containment: Java How can I generate an.exe file? You don't do it. Use an installed JVM to execute the program GCJ: http://gcc.gnu.org/java/ FAQ I downloaded Java on my PC but I cannot compile Java programs: Check you downloaded Java SDK (including the compiler) not Java RTE or JRE (just the JVM) Check that the shell path include pathtojava/bin Note: Eclipse uses a different compiler than javac FAQ Java cannot find a class (ClassNotFoundException) The name of the class must not include the extension.class: Es. java Prova Check you are in the right place in your file system java looks for classes starting from the current working directory