1 60-212 Programming in Java This is a one semester course. You will learn the language and some basic programming skills. You are expected to read, program,

Slides:



Advertisements
Similar presentations
 2005 Pearson Education, Inc. All rights reserved Introduction.
Advertisements

1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line.
Introduction to Computer Programming in C
Visual and Internet Programming using JAVA
 2003 Prentice Hall, Inc. All rights reserved. 1 Introduction to C++ Programming Outline History of C and C++ C++ Standard Library Object Technology Basics.
Object Orientated Programming
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 1 – Introduction to Computers, the Internet, and the Web Outline 1.1 Introduction 1.2 What Is.
Introduction to Computer Programming CSC 1401: Introduction to Programming with Java Lecture 2 Wanda M. Kunkle.
 2003 Prentice Hall, Inc. All rights reserved. 1 Machine Languages, Assembly Languages, and High-level Languages Three types of computer languages 1.Machine.
 2002 Prentice Hall. All rights reserved. Week 1 - Introduction to Object- Oriented Programming Outline 1.1 Machine Languages, Assembly Languages and.
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to Python Programming Outline 2.1 Introduction 2.2 First Program in Python: Printing.
Java How to Program, 9/e Instructor: José M. Reyes Álamo © by Pearson Education, Inc. All Rights Reserved.
Java PAL.  Contains the development kit and the runtime environment ( aka the Java Virtual Machine )  Download Link:
 2003 Prentice Hall, Inc. All rights reserved. Chapter 1 – Introduction to Computers, the Internet, and the Web Outline 1.1 Introduction 1.2 What Is a.
Computer Programming-1 CSC 111 Chapter 1 : Introduction.
COMPUTER SCIENCE I C++ INTRODUCTION
1 1 1 Introduction to Java. 2 History of Java Java – Originally for intelligent consumer-electronic devices – Then used for creating Web pages with dynamic.
Introduction COMP104: Fundamentals and Methodology.
 2005 Pearson Education, Inc. All rights reserved. 1 Introduction & The Java Virtual Machine Small Java Chapter 1 1.
Object Oriented Programming Lecturer: Andreas P. Adi
(C) 2010 Pearson Education, Inc. All rights reserved.  Java programs normally go through five phases  edit  compile  load  verify  execute.
 2003 Prentice Hall, Inc. All rights reserved. 1 Java Training Course Dr. H.E. Dunsmore Purdue University Java – How to Program, Deitel (5 th Edition)
 2005 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and the World Wide Web.
 2002 Prentice Hall. All rights reserved. Chapter 1 – Introduction to Computers, the Internet, and the Web Outline 1.1 Introduction 1.2 What Is a Computer?
1.8History of Java Java –Based on C and C++ –Originally developed in early 1991 for intelligent consumer electronic devices Market did not develop, project.
1 Chapter 1 Java –Originally for intelligent consumer-electronic devices –Then used for creating Web pages with dynamic content –Now also used for: Develop.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 2 Chapter 2 - Introduction to C Programming.
 Pearson Education, Inc. All rights reserved Introduction to Java Applications.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
Object Oriented Programming (OOP) Design Lecture 1 : Course Overview Bong-Soo Sohn Associate Professor School of Computer Science and Engineering Chung-Ang.
1 COMP 241: Object-Oriented Programming with Java Fall 2004 Lecture 1 September 27, 2004 Serdar Taşıran.
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Computer Science 1 Lecture 1: administrative details and Professor: Evan Korth New York University 1.
CT1513 Introduction To java © A.AlOsaimi.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 2 - Introduction to C Programming Outline.
Java How to Program, 9/e Presented by: José M. Reyes Álamo © by Pearson Education, Inc. All Rights Reserved.
1 Introduction Read D&D Sec 1.8; Sec 1.13 THE Java tutorial -
 2003 Prentice Hall, Inc. All rights reserved Basics of a Typical C++ Environment C++ systems –Program-development environment –Language –C++
1 Chapter 1 Java –Originally for intelligent consumer-electronic devices –Then used for creating Web pages with dynamic content –Now also used for: Develop.
1 1 1 Introduction to Java. 2 History of Java Java – Originally for intelligent consumer-electronic devices – Then used for creating Web pages with dynamic.
Chapter 1 – Introduction to Computers, the Internet, and the Web Outline 1.1 Introduction 1.2 What Is a Computer? 1.3 Computer Organization 1.4 Evolution.
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
Chapter 1 Introduction 2nd Semester H
Introduction to Computers, the Internet and the World Wide Web
Chapter 1: Introduction to computers and C++ Programming
Chapter 1 – Introduction to Computers, the Internet, and the Web
Lecture 1: Introduction to JAVA
Chapter 2 - Introduction to C Programming
2.5 Another Java Application: Adding Integers
Chapter 2 - Introduction to C Programming
Programming COMP104: Fundamentals and Methodology Introduction.
Chapter 1 – Introduction to Computers, the Internet, and the Web
Chapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming
1.13 The Key Software Trend: Object Technology
Chapter 2 - Introduction to Java Applications
Chapter 2 - Introduction to C Programming
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Chapter 1 – Introduction to Computers, the Internet, and the Web
Chapter 2 - Introduction to C Programming
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Programs written in C and C++ can run on many different computers
Capitolo 1 – Introduction C++ Programming
Chapter 2 - Introduction to C Programming
Chapter 1 – Introduction to Computers, the Internet, and the Web
Computer Programming-1 CSC 111
Introduction to C Programming
Presentation transcript:

Programming in Java This is a one semester course. You will learn the language and some basic programming skills. You are expected to read, program, read, program, read, program, …. Code-oriented teaching

: Highlight of the course outline Lecture Hours –Section 30 – Thursdays, , Room: TC104 –Tutorial (Open to all sections) – Fridays, , Room: DH361 Office hours –Thursdays, , Exams –Midterm 1: Sat, Oct. 22, 2005, , LC: TC 200 –Midterm 2: Sat, Nov. 26, 2005, , LC: TC 200 –Final Examination: Friday, December 16, 2005, , Exam Slot: TBA

: Highlight of the course outline Labs –Students MUST register in one of the following sections. Section Wednesdays 1600 – 1720, ER 3119 Section 54 – Thursdays 1600 – 1720, ER 3119 Section Wednesdays 1730 – 1850, WL 305 Section Wednesdays 2030 – 2150, WL 305 –Note: Lab attendance is mandatory. All students must check the SIS to ensure that they are enrolled in a lab section as well as in a lecture section. Students who registered in lab sections 51, 52, 56 or 57 must register in one of the lab sections shown above.

: Highlight of the course outline Evaluation scheme 4.5% 9 Laboratory 10% 2 Laboratory tests 5.5% 1 Project 25% Midterm #1, Sat, Oct. 22, % Midterm #2, Sat, Nov. 26, % Final Exam, Fri, Dec 16,

: Highlight of the course outline Grading Scheme  93< 100 A+,  86< 93 A,  80< 86 A-  77< 80 B+,  73< 77 B,  70< 73 B-  67< 70 C +,  63< 67 C,  60< 63 C-  57< 60 D+,  53< 57 D,  50< 53 D-  35< 50 F, <35 F- Read through the course outline to familiarize yourself with the rules regarding for example:

: Highlight of the course outline –Missed labs, midterms, and final…, –Appeal your marks for lab and project…, –Late submission for labs, project… –Doctor’s note –Academic misconduct –see course outline, for more details, …..

: Resources Textbook –Lecture notes (courseware) –Deitel, “Java How to program, 5 th or 6 th ed.” –Find a used one at » » » –Bruce Eckel, “Thinking in Java”. It is FREE. » Do I have to have textbooks? –For your exams

: Resources Hardware Environment –Unix workstation at school, ER3119, WL305 – At home, your choice ! Software –J2SE 1.4.2, or J2SE 1.5 already installed at school –Can be downloaded for home use, free again: –Command line vs. IDE Eclipse, a very nice IDE for java programmingwww.eclipse.org

: Resources Do you have a computer science account for using computing facilities at the School of Compute Science? –How to find out? A website for the course will be available this weekend. A discussion group probably will be set up in two weeks. More details will be announced. Java Lab, ie. ER3150 will start to open on Sept 12, 9am-10pm.

10 Thinking About Objects Objects –Reusable software components that model real-world items –Look all around you People, animals, plants, cars, etc. –Attributes Size, shape, color, weight, etc. –Behaviors Babies cry, crawl, sleep, etc.

11 Java Class Libraries Classes –Include methods that perform tasks Return information after task completion –Used to build Java programs Java contains class libraries –Known as Java APIs (Application Programming Interfaces)

12 Basics of a Typical Java Environment Java programs normally undergo five phases –Edit Programmer writes program (and stores program on disk) –Compile Compiler creates bytecodes from program –Load Class loader stores bytecodes in memory –Verify Verifier ensures bytecodes do not violate security requirements –Execute Interpreter translates bytecodes into machine language

13 Typical Java environment. Primary Memory Disk Editor Compiler Class Loader Program is created in an editor and stored on disk in a file ending with.java. Compiler creates bytecodes and stores them on disk in a file ending with.class. Class loader reads.class files containing bytecodes from disk and puts those bytecodes in memory. Phase 1 Phase 2 Phase 3 Primary Memory Bytecode Verifier Bytecode verifier confirms that all bytecodes are valid and do not violate Java’s security restrictions. Phase 4 Primary Memory Interpreter Interpreter reads bytecodes and translates them into a language that the computer can understand, possibly storing data values as the program executes. Phase 5

14 Thinking About Objects Object-oriented design (OOD) –Models real-world objects –Models communication among objects –Encapsulates attributes and operations (behaviors) Information hiding Communication through well-defined interfaces Object-oriented language –Programming in object oriented languages is called object-oriented programming (OOP) –Java

15 Thinking About Objects Object-Oriented Analysis and Design (OOA/D) –Essential for large programs –Analyze program requirements, then develop solution –UML Unified Modeling Language

16 Week 1 Programs A First Program in Java: Printing a Line of Text Modifying Our First Java Program Displaying Text in a Dialog Box Another Java Application: Adding Integers Memory Concepts Arithmetic Decision Making: Equality and Relational Operators

17 Discuss four small Java programs Welcome1.java Welcome2.java Welcome3.java Welcome4.java

18 Escape characters –Backslash ( \ ) –Indicates special characters be output

19 Another Java Application: Adding Integers Addition.java

20 Memory Concepts Visual Representation –Sum = 0; number1 = 1; number2 = 2; –Sum = number1 + number2; after execution of statement sum0 3

21 Arithmetic Arithmetic calculations used in most rograms –Usage * for multiplication / for division +, - No operator for exponentiation (more in Chapter 5) –Integer division truncates remainder 7 / 5 evaluates to 1 –Remainder operator % returns the remainder 7 % 5 evaluates to 2

22 Arithmetic Operator precedence –Some arithmetic operators act before others (i.e., multiplication before addition) Use parenthesis when needed –Example: Find the average of three variables a, b and c Do not use: a + b + c / 3 Use: ( a + b + c ) / 3 –Follows PEMDAS Parentheses, Exponents, Multiplication, Division, Addition, Subtraction

23 Arithmetic

24 Decision Making: Equality and Relational Operators

25 Precedence of operators