Centre for Computer Technology ICT214 Object Oriented Design and Programming Week 1 - Introduction Richard Salomon and Umesh Patel Centre for Information.

Slides:



Advertisements
Similar presentations
Introduction to Programming G51PRG University of Nottingham Revision 1
Advertisements

1 pritisajja.info Unlocking the World of Java Programming….. Priti Srinivas Sajja February, 2014 Visit pritisajja.info for detail Future Technology for.
CS0007: Introduction to Computer Programming Console Output, Variables, Literals, and Introduction to Type.
Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming.
Lab Information Security Using Java (Review) Lab#0 Omaima Al-Matrafi.
The Web Warrior Guide to Web Design Technologies
MC697 Object-Oriented Programming Using Java. In this class, we will cover: How the class will be structured Difference between object-oriented programming.
 2005 Pearson Education, Inc. All rights reserved Introduction.
Object Oriented Programming in JAVA
A Review. a review of lessons learned so far… ( 2 steps forward - 1 step back) Software Development Cycle: design, implement, test, debug, document Large.
Lab#1 (14/3/1431h) Introduction To java programming cs425
Object Orientated Programming
1 Java Basics. 2 Compiling A “compiler” is a program that translates from one language to another Typically from easy-to-read to fast-to-run e.g. from.
Introduction to Java Programming
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 2 - Java Programming Fundamentals1 Chapter 2 Java Programming Fundamentals.
Chapter 1 Introduction.
Getting Started with Java
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
3.1 Documentation & Java Language Elements Purpose of documentation Assist the programmer with developing the program Assist other programers who.
Introduction to Programming Prof. Rommel Anthony Palomino Department of Computer Science and Information Technology Spring 2011.
Java: Chapter 1 Computer Systems Computer Programming II.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Programming Languages Machine.
Chapter 1: Introduction to Computers and Programming.
Java Language and SW Dev’t
Java Introduction Lecture 1. Java Powerful, object-oriented language Free SDK and many resources at
INTRODUCTION TO JAVA CHAPTER 1 1. WHAT IS JAVA ? Java is a programming language and computing platform first released by Sun Microsystems in The.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
The Java Programming Language
CSC204 – Programming I Lecture 4 August 28, 2002.
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
JAVA Tokens. Introduction A token is an individual element in a program. More than one token can appear in a single line separated by white spaces.
Introduction to Computer Systems and the Java Programming Language.
JAVA BASICS: Variables and References SYNTAX, ERRORS, AND DEBUGGING.
Intro and Review Welcome to Java. Introduction Java application programming Use tools from the JDK to compile and run programs. Videos at
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
 JAVA Compilation and Interpretation  JAVA Platform Independence  Building First JAVA Program  Escapes Sequences  Display text with printf  Data.
Using Data Within a Program Chapter 2.  Classes  Methods  Statements  Modifiers  Identifiers.
Centre for Computer Technology ICT214 Object Oriented Design and Programming Week 02 – Classes, Objects, Instances Richard Salomon and Umesh Patel Centre.
College Board A.P. Computer Science A Topics Program Design - Read and understand a problem's description, purpose, and goals. Procedural Constructs.
Copyright Curt Hill Variables What are they? Why do we need them?
Applied Computing Technology Laboratory QuickStart Java Learning to Program in Java Dr. Tom Way October 21, 2005.
Getting Started Java Fundamentals CSC207 – Software Design Summer 2011 – University of Toronto – Department of Computer Science.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
A Simple Java Program //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { public static void main(String[]
1 The JAVA Language Object Oriented Technology Mithani Binjan M.
Developed at Sun Microsystems in 1991 James Gosling, initially named “OAK” Formally announced java in 1995 Object oriented and cant write procedural.
Aside: Running Supplied *.java Programs Just double clicking on a *.java file may not be too useful! 1.In Eclipse, create a project for this program or.
Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.
JAVA Programming (Session 2) “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
Java Programming Fifth Edition Chapter 1 Creating Your First Java Classes.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
JAVA MULTIPLE CHOICE QUESTION.
Working with Java.
GC101 Introduction to computer and program
Chapter No. : 1 Introduction to Java.
Data types and variables
Java programming lecture one
Introduction to Python
Chapter 1: Computer Systems
Units with – James tedder
Units with – James tedder
Chap 2. Identifiers, Keywords, and Types
Computer Programming-1 CSC 111
JAVA. Java is a high-level programming language originally developed by Sun Microsystems and released in Java runs on a variety of platforms, such.
Presentation transcript:

Centre for Computer Technology ICT214 Object Oriented Design and Programming Week 1 - Introduction Richard Salomon and Umesh Patel Centre for Information and Communication Technology Box Hill Institute of TAFE

12 October October October 2015 Copyright Box Hill Institute Java Definition Java is: a simple, object oriented, network savvy, interpreted,robust, secure, architecture neutral,portable (platform independent), high performance, multi-threaded, dynamic language. Java is: a simple, object oriented, network savvy, interpreted,robust, secure, architecture neutral,portable (platform independent), high performance, multi-threaded, dynamic language.

12 October October October 2015 Copyright Box Hill Institute History Java was developed primarily by SUN engineers named James Gosling and Patrick Naughton. Java was developed primarily by SUN engineers named James Gosling and Patrick Naughton. Original focus was on small consumer devices Original focus was on small consumer devices Growth of the Web and its write once, run anywhere ability made it the ubiquitous internet language that it is today. Growth of the Web and its write once, run anywhere ability made it the ubiquitous internet language that it is today. It was named *7 and Oak before the name Java was settled. It was named *7 and Oak before the name Java was settled. Initial version fitted on a 1.4M floppy, now it occupies 50 MB + Initial version fitted on a 1.4M floppy, now it occupies 50 MB +

12 October October October 2015 Copyright Box Hill Institute What is Java? Java is an Object Oriented Programming [OOP] Language Java is a very popular language for building applications for the Web Java is robust, portable, architecture neutral, multithreaded “WORA” - Write Once Run Anywhere “WORM” – Write Once Run Many

12 October October October 2015 Copyright Box Hill Institute Java Byte-Code and Portability Java is and interpreted, application language J2SDK uses javac to compile the source code filename.java into bytecode file filename.class java runs the filename.class code on the JVM. Compile and Run Command

12 October October October 2015 Copyright Box Hill Institute Java Development and Runtime Environment Java Source Code (java) Java Byte Code (class) Java Compiler Java Byte Code moves locally to the JVM Java Class Loader and Byte Code Verifier Java Class Libraries Java Interpreter J-I-T Compiler Runtime System JVM Operating system Hardware

12 October October October 2015 Copyright Box Hill Institute Language Types Procedural - Basic, Pascal, C Event Driven – Visual Basic [VB] Object Oriented [OO] - C++, C#, Java Java’s major use - internet, web, e-commerce

12 October October October 2015 Copyright Box Hill Institute Objects and Actions object is anything world is a set of interacting objects objects have characteristics (attributes) and its value Instance – is an object that is used by an application objects have state with certain attributes and values objects have behaviour (actions - methods)

12 October October October 2015 Copyright Box Hill Institute Objects and Methods Method is a set of instruction describing the operations performed by an object An object is an entity that stores data and can take actions defined by methods A method is an action which can be performed by an object. The action takes place as the result of a method call also known a method invocation. The calling objects calls or invokes the method.

12 October October October 2015 Copyright Box Hill Institute Object-Oriented Programming java program – collection of classes class - collection of interacting objects object has its instances Encapsulation (Data Hiding) Inheritance Protection Reusability

12 October October October 2015 Copyright Box Hill Institute JDK/SDK Utilities Found in the \bin directory javac, java, javah (allows incorporation of a native part in the code), jdb, javadoc, jar We will use the IDE - BlueJ, Netbeans

12 October October October 2015 Copyright Box Hill Institute Basic Language Elements Punctuation - the symbols that are used by a computer language Punctuation - the symbols that are used by a computer language Syntax - construction rules to code in that language Syntax - construction rules to code in that language Vocabulary - the language keywords Vocabulary - the language keywords Operators - Symbols or commands for processing data Operators - Symbols or commands for processing data Identifiers - symbols to reference data stored in memory of the computer Identifiers - symbols to reference data stored in memory of the computer

12 October October October 2015 Copyright Box Hill Institute Java Program Example /** * * HelloWorld.java Richard 1.0 */ public class HelloWorld { public static void main(String args []) { String name = “ Richard Salomon” ; System.out.println(“Hello World“); System.out.println(“\nMy name is ” + name + “\n”); } }

12 October October October 2015 Copyright Box Hill Institute Documentation Documentation can impact the success or failure of a project Documentation does two things: aid the design process communicate your design and describe your implementation to other programmers

12 October October October 2015 Copyright Box Hill Institute Good Design Documentation Meaningful name for variables Use Comments according to Java Coding Standards Indentation Named Constants Simple Program Structure Reduce class load

12 October October October 2015 Copyright Box Hill Institute Design Process I. I. Comments serve as the first step of class design II. II. Turn comments into pseudocode III. III. Refine pseudocode into java code IV. IV. Comments help with debugging

12 October October October 2015 Copyright Box Hill Institute Comments // single line comment /* block comment over many lines */

12 October October October 2015 Copyright Box Hill Institute Comments /** java doc comment, used by the javadoc tool. Can include single line comments and html tags. eg monos paced text Some html tags cause problems in javadoc eg header and frame tags All javadoc comments must be placed before declarations. Javadoc comments placed within code braces will be ignored by the javadoc tool */

12 October October October 2015 Copyright Box Hill Institute Comments Best to start program development with comments rather than spending a lot of time after the code is written. Why? Best to start program development with comments rather than spending a lot of time after the code is written. Why? Java documentation is available at java.sun.com/docs and should be installed in the jdk#.#.#/doc directory Java documentation is available at java.sun.com/docs and should be installed in the jdk#.#.#/doc directory

12 October October October 2015 Copyright Box Hill Institute Elements Java is case sensitive; FRED differs from fred and also from Fred Keywords – must be lower case there are 48 keywords NB true, false, null are literals, not keywords Identifiers – labels for data – first character must be alpha – no space – case sensitive – no keywords

12 October October October 2015 Copyright Box Hill Institute Elements Operators braces { } brackets[ ] parenthesis( ) white space Operators braces { } brackets[ ] parenthesis( ) white space e.g. int myInteger = 27 ; e.g. int myInteger = 27 ; keyword identifier assignment operator literal terminator

12 October October October 2015 Copyright Box Hill Institute Data Storage Registers -space within CPU Registers -space within CPU The stack -method variables in RAM The stack -method variables in RAM The heap -objects in RAM The heap -objects in RAM Static storage – shared method or variable Static storage – shared method or variable Constant - non-changing variable in RAM Constant - non-changing variable in RAM Non-RAM storage – disk space Non-RAM storage – disk space

12 October October October 2015 Copyright Box Hill Institute Variables Variables represent data in storage locations in memory The data stored by a variable is called its value The value is stored in the memory location The value can be changed. Variable consist of 5 parts - identifier (name) - reference (memory address) - data type - scope (lifespan) - value (literal)

12 October October October 2015 Copyright Box Hill Institute Data Type Data type tells the compiler how to interpret and store the data. Data type tells the compiler how to interpret and store the data. It described the type of an attribute (field) It described the type of an attribute (field) Java allocates a set amount of storage to each type of data. Thus Java is strongly typed – Assignment Compatibilities Java allocates a set amount of storage to each type of data. Thus Java is strongly typed – Assignment Compatibilities

12 October October October 2015 Copyright Box Hill Institute Java Data Types Primitive data types Reference booleancharnumeric Integral floating point byteshortlongint floatdouble

12 October October October 2015 Copyright Box Hill Institute Data Type Storage boolean – 1 bit true/false boolean – 1 bit true/false char - 16 bits unicode char - 16 bits unicode byte - 8 bits -128 to +127 byte - 8 bits -128 to +127 short - 16 bits to short - 16 bits to int - 32 bits to int - 32 bits to long - 64 bits -9 x to +9 x long - 64 bits -9 x to +9 x float - 32 bits up to 7 decimal places float - 32 bits up to 7 decimal places double - 64 bits up to 14 decimal places double - 64 bits up to 14 decimal places

12 October October October 2015 Copyright Box Hill Institute Object data default values Data typeDefault values byte0 short0 int0 long0 float0.0 double0.0 booleanfalse char\u0000 referencenull

12 October October October 2015 Copyright Box Hill Institute Assignment assignment statement used to assign a value to a variable Operator is “=“ example lastName = ‘citizen’; special operators can be combined with arithmetic operators (+, -, *, %)

12 October October October 2015 Copyright Box Hill Institute Naming Conventions Class types begin with an uppercase letter Primitive types begin with a lowercase letter Variables of both class and primitive types begin with a lowercase letters Java Class Naming Conventions Must begin with a letter of any alphabet Can contain only letters, digits, underscores, or $ signs Can not be a Java keyword or literal Case sensitive Start with an upper case letter and then use lower case letters, with the first character of a new word capitalised e.g. Person, MotorVehicle a file may have many classes but only one public class file name must match the public class name

12 October October October 2015 Copyright Box Hill Institute Other Issues Simple Input / Output Named and Numbered Constants Initialisation Parenthesis and Precedence Increment / Decrement Operators