11-feb25

11-feb25 - COMP110 InformationHidingand Encapsulation...

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

View Full Document Right Arrow Icon
COMP 110 Information Hiding and Encapsulation Tabitha Peck M.S. February 25, 2008 MWF 3-3:50 pm Philips 367 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
Announcements Late days Do you have any left? 2
Background image of page 2
Questions? What is the difference = == .equals() 3
Background image of page 3

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

View Full DocumentRight Arrow Icon
Class and Primitive Types In memory Primitive types store value Class types store address to data Why? 4
Background image of page 4
How big is a String? int 4 bytes float 4 bytes double 8 bytes String ? bytes “hello” “How are you doing today” 5
Background image of page 5

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

View Full DocumentRight Arrow Icon
Types in memory 5 3.14159 2078 1056 “hello” “A string” int num float num2 String s1 String s2 s1 = s2; s1 = “how are you?” System.out.print(s2); “How are  you?” 6
Background image of page 6
Today in COMP 110 Writing a class with good programming practices Monopoly 7
Background image of page 7

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

View Full DocumentRight Arrow Icon
Why classes? boardwalk.buyHouse(); if (!hotelOwned || !mortgaged) { if (numHouses == 4) { hotelOwned = true ; numHouses = 0; } if (numHouses < 4) numHouses++; } 8
Background image of page 8
Information Hiding Method can be used without understanding detail of code A.K.A. - abstraction Programmer’s job becomes simpler Code is easy to read 9
Background image of page 9

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

View Full DocumentRight Arrow Icon
Before You Start Define the problem Write a class for a property in Monopoly UML diagram 10
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 26

11-feb25 - COMP110 InformationHidingand Encapsulation...

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

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