quiz 4 - Gerardo Cervantes Name _ CMPS 11 Quiz4 This is a...

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

View Full Document Right Arrow Icon
Name _______________________ CMPS 11 Quiz4 May 12, 2010 This is a closed notes, closed book exam. THERE ARE MORE QUESTIONS ON THE BACK class ClassOne { int data = 123; public void fun1() { System.out.println( "ClassOne:fun1:" + data); } public void fun2() { System.out.println( "ClassOne:fun2"); fun1(); } } class ClassTwo extends ClassOne { int data = 456; public void fun1() { System.out.println( "ClassTwo:fun1:" + data); } } 1. What does the following program print? class Quiz4P1 { public static void main(String[] args) { someFunc(new ClassOne()); } static void someFunc(ClassOne one) { one.fun1(); one.fun2(); } } 2. What does the following program print? class Quiz4P2 { public static void main(String[] args) { someFunc(new ClassTwo()); } static void someFunc(ClassOne one) { one.fun1(); one.fun2(); } } 3. What does the following program print? class Quiz4P3 { public static void main(String[] args) { someFunc(new ClassTwo()); } static void someFunc(ClassTwo two) { two.fun1(); two.fun2();
Background image of page 1

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

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

This document was uploaded on 05/16/2011.

Page1 / 2

quiz 4 - Gerardo Cervantes Name _ CMPS 11 Quiz4 This is a...

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

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