CSE 421 Course Overview and Introduction to Java

Similar documents
Lecture 1: Overview of Java

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

Certified Core Java Developer VS-1036

Introduction to Java

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

Introduction to Java. Nihar Ranjan Roy.

CS11 Java. Fall Lecture 1

Getting Started with Java. Atul Prakash

Introduction to Java Programming

NetBeans IDE Java Quick Start Tutorial

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

CS 11 java track: lecture 1

An Introduction to Software Engineering. David Greenstein Monta Vista High School

CHAPTER 1. Introduction to JAVA Programming

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

Fundamentals of Programming. By Budditha Hettige

2 Introduction to Java. Introduction to Programming 1 1

CompSci 125 Lecture 02

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


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

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

Lecture 1: Introduction to Java

Java Programming Language Mr.Rungrote Phonkam

Chapter 1 Introduction to Computers, Programs, and Java

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

Java language. Part 1. Java fundamentals. Yevhen Berkunskyi, NUoS

Chapter 1 Introduction to Java

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

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

Notes of the course - Advanced Programming. Barbara Russo

Advanced Object-Oriented Programming Introduction to OOP and Java

Pace University. Fundamental Concepts of CS121 1

Java Programming. Manuel Oriol, March 22nd, 2007

Java Puzzle Ball Nick Ristuccia

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

Introduction to Programming (Java) 2/12

Chapter 1: Introduction to Computers and Java

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

JVM interprets the Java bytecode, controls how it interacts with the operating system and manages memory.

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

Chapter 1 Introduction to Computers, Programs, and Java

Java Language. Programs. Computer programs, known as software, are instructions to the computer. You tell a computer what to do through programs.

Introduction to Java Programming CPIT 202. WEWwwbvxnvbxmnhsgfkdjfcn

These two items are all you'll need to write your first application reading instructions in English.

INF160 IS Development Environments

CVS. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 21

MEAP Edition Manning Early Access Program Get Programming with Java Version 1

CHAPTER 1 Introduction to Computers and Java

Programming. Syntax and Semantics

Chapter 1 Introduction to Computers, Programs, and Java

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

Lecture 4: Introduction to Java and your Development Environment

Javac and Eclipse tutorial

Computational Applications in Nuclear Astrophysics using Java Java course Lecture 1

Software Installation for CS121

Chapter 1 Introduction to Computers, Programs, and Java

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

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

IQTIDAR ALI Lecturer IBMS Agriculture University Peshawar

History Introduction to Java Characteristics of Java Data types

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

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

Lesson 01 Introduction

Chapter 1 Introduction to Computers, Programs, and Java

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

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

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

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG

AP Computer Science A: Java Programming

S8352: Java From the Very Beginning Part I - Exercises

MARS AREA SCHOOL DISTRICT Curriculum TECHNOLOGY EDUCATION

Programming with Java

AP Computer Science A

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

Introduction Basic elements of Java

CS321 Languages and Compiler Design I. Winter 2012 Lecture 2

Introduction to. Android Saturday. Yanqiao ZHU Google Camp School of Software Engineering, Tongji University. In courtesy of The Java Tutorials

Module 1: Introduction to Computers, Programs, and Java

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.

Getting Started With Java

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

Chapter 1. Introduction

Special Topics: Programming Languages

16.410: Jump Starting With Java

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

Programming Language Basics

Java Programming. Zheng-Liang Lu. Java 308 Spring Department of Computer Science & Information Engineering National Taiwan University

Chapter 2 Author Notes

C++ Spring Break Packet 11 The Java Programming Language

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

IT151: Introduction to Programming (java)

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

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

Chapter 1: Introduction to Computers, Programs, and Java

Short Questions. Instructor: Created by: Visit: 2/2/2018 OOP with JAVA. Muhammad Naveed

Introduction. Introduction to OOP with Java. Lecture 01: Introduction to OOP with Java - AKF Sep AbuKhleiF -

USING THE OOSIML/JAVA. With a Terminal Window

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

Chapter 1 Introduction to Computers, Programs, and Java

Transcription:

CSE 421 Course Overview and Introduction to Java Computer Science and Engineering College of Engineering The Ohio State University Lecture 1

Learning Objectives Knowledgeable in how sound software engineering principles for componentbased design are manifested in a current popular programming language SE principles: Resolve Programming language: Java Proficient at Java programming Proficient at use of industrial-strength software development tools Informed in good programming practices

Pre- and Post-requisites Required background: CSE 321 Typed imperative programming paradigm Control flow, types, variables, arrays Encapsulation and information hiding Client view vs implementation view Abstract vs concrete templates/instances Behavioral specifications Mathematical model and constraints Abstraction correspondence and conventions Requires, ensures, and alters clauses Preparation for: CSE 560 Practical programming patterns Tool support for software development

Course Content Language Tools Good programming practices

Course Content 1: Language Core syntax and features Declarations, assignment, control flow Methods, objects, classes, interfaces Inheritance, polymorphism Generics, exceptions Packages (ie Java component catalogs) Collections (eg Map, Set, Queue, List ) Logging, IO, Swing for GUIs

Course Content 2: Tools Eclipse Industrial-strength open source IDE Many (free) extensions available Javadoc Industry-standard documentation utility for Java programs JUnit Industry-standard library for unit testing programs CVS/SVN Widely-adopted versioning systems for coordinating team development

Course Content 3: Good Practices Problem: Complex language mechanisms make it easy to produce code that is wrong, brittle, inextensible, and hard to maintain Solution : Good programming practices form a discipline that helps (but does not guarantee) developers write better code Simple syntactic idioms Naming conventions, coding conventions Decoupling by programming to the interface Complex design patterns Single-point of control (eg factories, MVC) Maintaining an invariant (eg immutable, singleton)

What is Java? Developed by Sun Microsystems James Gosling Birth: 1994 (progenesis from Oak) Based on C/C++ Similar syntax, control, data structures Imperative, object-oriented Originally designed for building Web/Internet applications Now often viewed as a general purpose programming language Currently enjoys wide-spread acceptance Had immediate impact, then continued success

Volume of Google Searches Java C++ C# Perl PHP

Major Java Myths 1. Java is a small, simple language True initially, but every revision to the language has added functionality and complexity 2. Java does not have pointers References (ie pointers) are ubiquitous 3. Once I start using Java, I can forget all that Resolve/C++ stuff Understanding sound principles for component-based software is even more important

Resources On line tutorials from Sun ( trails ) http://java.sun.com/docs/books/tutorial On line API documentation http://java.sun.com/javase/6/docs/api Carmen http://carmen.osu.edu class news, discussions, grades lab submission (in dropbox ) Class website Handouts, lecture notes, lab assignments Pointers to more resources

The Java Virtual Machine (JVM) An abstract computer architecture The software that executes Java programs Part of Java Runtime Environment (JRE) Java program compiled into bytecode Java bytecode then interpreted by JVM Java program (text file) MyProg.java javac compile interpret Java bytecode (binary) MyProg.class java JVM OS / architecture

Implications of JVM Portability Sun slogan: Write once, run anywhere JVM is ubiquitous Environment configuration path variable for shell to find java / javac executables classpath variable for JVM to find bytecode at execution time Dynamic extensibility JVM can find bytecode on-the-fly Performance Extra layer comes at (small) penalty in performance

Environment Setup: JDK 1.5 Version 1.5 == version 5 Lab: CL 112 (& Baker 310 if available) http://www.cse.ohio-state.edu/cs/labs.shtml Follow these steps: log into the solaris (ie stdsun) or linux (ie stdlogin) environment subscribe to JDK-CURRENT $ subscribe JDK-CURRENT log out and log back in Confirm set-up $ java version java version 1.5.0_08...

Install Java Platform at Home Can be installed on different platforms: Solaris, Windows, Linux, Trail: Getting Started > Hello World! Download OS-specific Java Development Kit (JDK) Tools for program development (eg javac) JRE Create simple program (with a text editor) Compile (with javac) Run (with java) Make sure to download: J2SE JDK (not J2EE, not JRE) Version 6 (1.6.0_07, ie update 7)

Getting Started: 1. Creating Source File Using any text editor: Create a file HelloWorldApp.java Copy the following code into this file: public class HelloWorldApp { } Note: public static void main(string[] args) { // Display "Hello World!" System.out.println("Hello World!"); } Class name must match file name Java is CASE SENSITIVE!

Getting Started: 2. Compiling the Program Compile using javac $ javac HelloWorldApp.java Generates a file named HelloWorldApp.class $ ls HelloWorldApp.class HelloWorldApp.java Problem javac: command not found Cause Shell can not find javac executable Solutions Use full path on command line $ /usr/local/jdk1.5.0_08/bin/javac HelloWorldApp.java Set path environment variable $ export PATH=$PATH:/usr/local/jdk1.5.0_08/bin/javac

Getting Started: 3. Running the Program From same directory, run using java $ java HelloWorldApp Hello World! Note: argument is HelloWorldApp, not a file (.java or.class) Problem Exception in thread "main" java.lang.noclassdeffounderror: HelloWorldApp Cause JVM can not find HelloWorldApp bytecode (ie.class file) Solutions Explicitly set classpath on command line $ java classpath ~/421/example HelloWorldApp Set classpath using environment variable $ export CLASSPATH=.:~/421/example

Language Basics: Statements Similar to C/C++ Control flow: if, if-else, if-else if switch for, while, do-while break continue Statements Separation with ; Blocks with {... } Comments with // or /*... */ Operators arthmetic: + - * / % ++ -- logical (for booleans): & ^! && bit (for integer types): & ^ ~ << >> >>> relational: ==!= < > <= >=

Good Practice: Single-Statement Conditionals Always include body of if-else in braces, even if it is a single statement The following is correct, but discouraged: if (!isdone) retry = true; Instead, write: if (!isdone) { } retry = true;

Supplemental Reading Sun trails Getting Started Learning the Java Language > Language Basics Java overview white paper http://java.sun.com/docs/white/langenv/ Another walk-through of simple application Essentials of the Java Programming Language, Part 1 http://developer.java.sun.com/developer/onlinetr aining/programming/basicjava1/compile.html Lessons 1 and 2

Summary Main course learning objective Applying solid SE principles in Java programming Course content Language, tools, good practices JVM.java (source) vs.class (bytecode) javac (compiler) vs java (interpretter) Environment configuration Setting class and classpath Sample program: Hello World