lecture3 - Administrative Issues Objects, Variables, and...

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

View Full Document Right Arrow Icon
1 Objects, Variables, and Types Lecture 3 Administrative Issues • Due Today – Program 0 • Due at 11pm • Submit via Blackboard • Try to submit well before 11pm • You can submit multiple times You’ll need time to figure out how to turn in your project! • Ongoing – Homework 0 • No new assignments! (Except reading…) What are Objects? • Java is an Object-Oriented Language • What the heck does that mean? • What is an object? – Quoting the text: a “fundamental entity in a Java program.” – The building blocks of your program Example Objects • Program for bank accounting software • Possible objects – One object for each bank account – Object for each branch office – Each customer represented by an object – Each teller is an object – Each ATM an object – Headquarters is an object Primitive Data • Common, fundamental values – Numbers: 1534 – Characters: ‘ a • More specialized values are represented as objects • Values belong to a Data Type – Defines a set of values – Defines possible operations on those values Classes •C l a s s e s – Think of “Data type” for Objects – Defines a set of values – Defines possible operations on those values • Example: BankAccount class
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 BankAccount Class • Many people have bank accounts • Each bank account is an object – My bank account – Your bank account – Michael Jordan’s bank account • All bank accounts type of information and services: they are of the same class. Encapsulation • Encapsulation means each object handles its own data • Details are hidden from the outside • Example: – Deposit to bank account – You just drop off a check and see your balance – Do you know what happens to that check? Inheritance and BankAccounts • But are all bank accounts really the same? • No, but similar! Inheritance •Mo r e in chap. 7 CheckingAccount IRAccount Four01KAccount SavingsAccount BankAccount Classes: Chapter 4 • Coverage of classes in Chapter 4 • Key points – Primitive data is defined by a data type •‘ a ’ is a char – Objects are defined by a class davesAccount is a BankAccount • Today: – Predefined objects – Using objects Using Objects System.out.println(“Go Heels!”); • Invoked the println method through the object System.out . • The object represents an output device – By default, the monitor – Predefined in standard Java programs println() is a service, or “method” • Request service via dot notation Calling a method System.out.println(“Go Heels!”); Object Dot Notation Method Parameter or
Background image of page 2
3 Calling a method In general: object.service(argument list); Example: myBankAccount.deposit(125.00); Back to System.out • Object that represents output • Mapped to monitor by default – Could be disk, printer, etc. • Provides many
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 / 10

lecture3 - Administrative Issues Objects, Variables, and...

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