Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.

Slides:



Advertisements
Similar presentations
STRING AN EXAMPLE OF REFERENCE DATA TYPE. 2 Primitive Data Types  The eight Java primitive data types are:  byte  short  int  long  float  double.
Advertisements

1 pritisajja.info Unlocking the World of Java Programming….. Priti Srinivas Sajja February, 2014 Visit pritisajja.info for detail Future Technology for.
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
1 Chapter 4 Language Fundamentals. 2 Identifiers Program parts such as packages, classes, and class members have names, which are formally known as identifiers.
Java Syntax Primitive data types Operators Control statements.
Outline Java program structure Basic program elements
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
Chapter 2 - Java Programming Fundamentals1 Chapter 2 Java Programming Fundamentals.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
Applying OO Concepts Using Java. In this class, we will cover: Overriding a method Overloading a method Constructors Mutator and accessor methods The.
Chapter 1 Introduction.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
CMSC 341 Introduction to Java Based on tutorial by Rebecca Hasti at
Java Course Outline Kumar Harshit, USW. Course Description Teaches students to program using the Java programming language with the help of the Netbeans.
Principles of Computer Programming (using Java) Review Haidong Xue Summer 2011, at GSU.
3.1 Documentation & Java Language Elements Purpose of documentation Assist the programmer with developing the program Assist other programers who.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
High-Level Programming Languages: C++
CIS Computer Programming Logic
DAT602 Database Application Development Lecture 5 JAVA Review.
Java Language and SW Dev’t
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 CST 221 OBJECT ORIENTED PROGRAMMING(OOP) ( 2 CREDITS.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
Session One Introduction. Personal Introduction Role of programmers Robot Examination HUD & HID Uploading Code.
1 Computer Systems -- Introduction  Chapter 1 focuses on:  the structure of a Java application  basic program elements  preparing and executing a program.
Lecture 2 Object Oriented Programming Basics of Java Language MBY.
Introduction to Computer Systems and the Java Programming Language.
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.
CS591x A very brief introduction to Java. Java Developed by Sun Microsystems was intended a language for embedded applications became a general purpose.
Java Programming Presented by Daniel Rosenthal Friday, November 30 th, 2007.
Spring 09- ICE0124 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 2.
CPS120: Introduction to Computer Science
 JAVA Compilation and Interpretation  JAVA Platform Independence  Building First JAVA Program  Escapes Sequences  Display text with printf  Data.
Chapter 2: Java Fundamentals
Chapter 1: Introduction Java Programming Language How the Java Virtual Machine Works (compiling, etc…) Update by: Dan Fleck Coming up: The Java Programming.
Group 4 Java Compiler Group Members: Atul Singh(Y6127) Manish Agrawal(Y6241) Mayank Sachan(Y6253) Sudeept Sinha(Y6483)
An Introduction to Java – Part 1 Dylan Boltz. What is Java?  An object-oriented programming language  Developed and released by Sun in 1995  Designed.
Java development environment and Review of Java. Eclipse TM Intergrated Development Environment (IDE) Running Eclipse: Warning: Never check the “Use this.
1 Programming Java Java Basics. 2 Java Program Java Application Program Application Program written in general programming language Applet Program running.
Introduction to Java Java Translation Program Structure
Fall 2015CISC124 - Prof. McLeod1 CISC124 Have you filled out the lab section survey? (As of last night 54 left to fill out the survey.) TA names have been.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Getting Started Java Fundamentals CSC207 – Software Design Summer 2011 – University of Toronto – Department of Computer Science.
Final Jeopardy Fundamen tal Java Numerical Data type Boolean Expressi on If/THEN/ WHILE Miscellan eous
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
CPS120: Introduction to Computer Science Variables and Constants.
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
1 Lecture # 2. * Introducing Programming with an Example * Identifiers, Variables, and Constants * Primitive Data Types * Byte, short, int, long, float,
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.
XuanTung Hoang 1 Something to discuss Feedbacks on Midterm Exam Final exam and term project  Final exam requires solid knowledge/skills in Java  Be more.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
JAVA MULTIPLE CHOICE QUESTION.
SSD1 – Introduction to Information Systems
Chapter No. : 1 Introduction to Java.
Java Primer 1: Types, Classes and Operators
Internet and Java Foundations, Programming and Practice
Data types and variables
Java package classes Java package classes.
Java programming lecture one
Introduction to the C Language
Principles of Computer Programming (using Java) Chapter 2, Part 1
An Introduction to Java – Part I, language basics
Sridhar Narayan Java Basics Sridhar Narayan
Chap 1 Chap 2 Chap 3 Chap 5 Surprise Me
Applying OO Concepts Using Java
In this class, we will cover:
Review of Java Fundamentals
Presentation transcript:

Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8

Review

XuanTung Hoang 3 Introduction to Computers Computer :  Hardware 6 logical units: Input, output, CPU, ALU, memory, secondary storage  Software: Computer programs that command computer hardware to for solving computing tasks Programming languages: For writing computer software  Machine language  assembly language  High-level languages  High level language needs translator or compiler

XuanTung Hoang 4 Java Programming Language A high level language  Use both interpreter and compiler Compiler: Source code  byte code Interpreter: byte code  machine language J2SE Java Platform  JRE – Java Runtime Environment: Java Virtual Machine (JVM): interpreter, java.exe Libraries  JDK – Java Development Kits JRE Compiler: javac.exe Library + other tools

XuanTung Hoang 5 Java Language: Things to remember Java is case-sensitive Statements end with “ ; ” Comments: //, /* … */ Block of code: { … } Array: [ ] Keywords: class, this, public, private, static, final, int, double, float, short, long, boolean, true, false, if, for, while, do, switch, case, break, continue, new, return, …

XuanTung Hoang 6 Java Language: Things to remember One file = one class  File name = class name Compile: javac Run: java Identifiers (class/method/variable name):  Comprise of: lower case chars (a – z), upper-case char ( A – Z), numeric char (0 – 9), _ int number_Of_people1 = 0; // valid int = 5; // invalid

XuanTung Hoang 7 Java Language: Important concepts Data type:  Primitive data type: int, short, long, float, double, boolean, char, byte Built-int data type  class (object/reference): Provided by class libraries (E.g.: String) or made by users Object: instance of a class  Created with new  Accessed through reference Using “.”

XuanTung Hoang 8 Java Language: Important concepts Variable:  4 properties: Name: identifier Type: Primitive data type or reference (class, object reference) Size: depends on type Value: specific value in a certain context  Two type of variables Instance variable: member of a class  Non-static instance variable is associated with a specific object  Static instance variable is associated with a class (do not need a specific object) Local variable  Declaration and initialization Non-static instance variable can ONLY be initialized in constructor  Scope of a variable Variable can be shadowed by other variable (with the same name)

XuanTung Hoang 9 Java Language: Important concepts Class:  Instance variables Static/non-static Constants: define with final  Methods Static/non-static 3 ways to call a methods Static methods cannot “directly call” non-static methods Return type and return expression agreement Constructors: special method for initializing object’s instance variabl es (no return type, name = class name) Get/set methods Why main method should be static?

XuanTung Hoang 10 Java Language: Operator Arithmetic: +, -, *, /, %, ++, --, +=, -=, *=, /=, %=  For integers  For floating point numbers Relational: >, =, <=, ==, !=  Be careful when using = = with floating point numbers Logical: &, &&, |, ||, ^^, !  !(2 >4)  (3 3)) new operator

XuanTung Hoang 11 Java language: Control statements if, if … else switch … case  Only for integer expression for, while, do … while  Empty statement can be allowed Be careful when putting “;”  if( x < 2) ; { … }  for (int k ; k < 10; k++) ; { … }  …

XuanTung Hoang 12 Arrays Declaration / creation / initialization Array of primitive type Array of object references  When an array of references is created, each element of the array will be a reference that is pointing to null Multi dimensional array  Array of arrays