in class practice for exam 1

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

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

View Full Document Right Arrow Icon
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 markl@cs.ucf.edu HEC 236, 407-823-2790 http://www.cs.ucf.edu/courses/cop3330/sum2011
Background image of page 1

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

View Full DocumentRight Arrow Icon
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.
Background image of page 2
COP 3330 : EXAM 1 REVIEW Page 3 © Dr. Mark Llewellyn public class
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 / 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 Right Arrow Icon
Ask a homework question - tutors are online