Introduction_Part_9

Introduction_Part_9 - ADT Example public interface Device...

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

View Full Document Right Arrow Icon
Last Updated: January 5, 2012 CSE 2011 Prof. J. Elder ADT Example public interface Device { public String make (); public String model (); } public class Camera implements Device { private String cameraMake ; private String cameraModel ; private int numPix ; Camera(String mk, String mdl, int n) { //constructor cameraMake = mk; cameraModel = mdl; numPix = n; } public String make () { return cameraMake ; } public String model () { return cameraModel ; } public int numberOfPixels () { return numPix ; } } Camera myCam = new Camera( "Nikon", "D90", 12000000 ); implements instantiates Interface Device Class Camera Object myCam
Background image of page 1

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

View Full DocumentRight Arrow Icon
January 5, 2012 CSE 2011 Prof. J. Elder Multiple Inheritance In Java, a class can have at most one direct parent class. Thus classes must form trees. This avoids the ambiguity that would arise if two parents defined methods with the same signature. Device
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/14/2012 for the course CSE 2011Z taught by Professor Elder during the Fall '11 term at York University.

Page1 / 5

Introduction_Part_9 - ADT Example public interface Device...

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

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