Lec 03 Introduction_to_Classes_and_Objects_revised

Lec 03 Introduction_to_Classes_and_Objects_revised -...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
FIT1002 Computer Programming 2010 Module 3 Introduction to Classes and Objects www.monash.edu.au FIT1002 Computer Programming Semester 1, 2010 Module 3 – Introduction to Objects, Classes and I/O COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University pursuant to Part VB of the Copyright Act 1968 (the Act). The material in this communication may be subject to copyright under the Act. Any further reproduction or communication of this material by you may be the subject of copyright protection under the Act. Do not remove this notice. The authors acknowledge that material in these modules has been adapted from slides produced by Lewis, DePasquale and Chase for Java Foundations: Introduction to Programming and Data Structures , Addison-Wesley, 2007 2 Assumed Knowledge Before the beginning of this lecture, students should be familiar with: – the declaration of basic data types – how to compile and execute a Java program – the components of an algorithm and how to develop algorithms Before the beginning of this lecture, students should have read over: – Lewis et. al. Chapter 2: Section 2.6 – Lewis et. al. Chapter 3: Sections 3.1 – 3.3 and 3.5 – the entire set of lecture notes up to this point 3 Objectives Understand the difference between objects and classes Be able to create and initialize objects Be able to read in data from the keyboard and output to screen Be able to format output to screen Be able to use the methods available from the String and Math classes
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
FIT1002 Computer Programming 2010 Module 3 Introduction to Classes and Objects 4 Recall: Primitive Data Types in Java When we declare a variable in Java, the type of a variable tells Java what can be done with it and the memory that needs to be put aside We need to specify: – the type of the value we want to put in there, and – the name we will use for that variable So far, we have declared primitive data types, e.g. int age; A Declaration like this effectively allocates the memory space required to store a value of an integer type 5 Object Oriented Programming Why Object Oriented Programming? – It helps you break up your program into all its different components – You begin to think about what data you will have in your program and what things you can do to that data – It helps you to reuse your code by creating “templates” for things 6 Object Oriented Programming Java is an object-oriented (OO) programming language OO languages centre the description or coding of algorithms around the description of objects that are handled in the algorithm An object is a basic entity in a Java program Objects can be used to represent real-world entities
Background image of page 2
FIT1002 Computer Programming 2010 Module 3 Introduction to Classes and Objects 7 Objects Objects have a state and can have behaviours The state of an object characterizes the object, it describes the
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 15

Lec 03 Introduction_to_Classes_and_Objects_revised -...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online