in class practice for exam 1

# in class practice for exam 1 - COP 3330 Object-Oriented...

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

COP 3330 : EXAM 1 REVIEW Page 1 © Dr. Mark Llewellyn COP 3330: Object-Oriented Programming Summer 2011 EXAM #1 – In Class Practice Department of Electrical Engineering and Computer Science Computer Science Division University of Central Florida Instructor : Dr. Mark Llewellyn [email protected] HEC 236, 407-823-2790 http://www.cs.ucf.edu/courses/cop3330/sum2011

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

View Full Document
COP 3330 : EXAM 1 REVIEW Page 2 © Dr. Mark Llewellyn public class Example1 { public static void main(String args[]){ C1 o1, o2; C1. y = 10; C1.x = 10; C1. printY (); C1.setX(10); o1 = new C1(); o2 = new C1(); o1.x = 2; o2.x = 3; o1. y = 4; C1. y = 6; o1.setX(7); o2.setX(8); C1. printY (); o2. printY (); } } class C1 { public int x; public static int y = 5; public C1() { x = 1;} public void setX( int val) {x = val;} public static void printY() {System. out .println("y: " + y );} } Static vs. Class Variables and Methods – In-Class Practice Problem First – identify which statements are legal and which are illegal. Second – fix the illegal statements. Third – trace the program execution and show the output.
COP 3330 : EXAM 1 REVIEW Page 3 © Dr. Mark Llewellyn public class

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 11

in class practice for exam 1 - COP 3330 Object-Oriented...

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

View Full Document
Ask a homework question - tutors are online