0918 - Introduction to Programming Languages and Techniques...

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

View Full Document Right Arrow Icon
Introduction to Programming Languages and Techniques Abstraction, Interfaces, Subtyping
Background image of page 1

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

View Full DocumentRight Arrow Icon
NOTES ON HW2 9/18/08 CIS 120 2
Background image of page 2
“Can’t find the Tester” 9/18/08 CIS 120 3 C:\Users\Alexey\Desktop\export>java -cp .:hw2.jar Tester Exception in thread "main" java.lang.NoClassDefFoundError: Tester Caused by: java.lang.ClassNotFoundException: Tester at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang. .loadClassInternal(Unknown Source) Could not find the main class: Tester. Program will exit. We’re still investigating why this happens for some people. Workarounds: • Transfer your files to ENIAC and run tests there • Run Tester from within DrJava
Background image of page 3

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

View Full DocumentRight Arrow Icon
“Incompatible argument. ..” 9/18/08 CIS 120 4 java.lang.VerifyError: (class: Tester$8, method: runTest signature: ()V) Incompatible argument to function at Tester.formTest(Tester.java:115) at cse1xxTester.JavaTester.loadClass(JavaTester.java:168) at cse1xxTester.JavaTester.<init>(JavaTester.java:31) at cse1xxTester.JavaTester.main(JavaTester.java:129) at Tester.test(Tester.java:249) at Tester.main(Tester.java:244) This indicates a problem with your code — one of your classes does not implement precisely the methods / constructors specified in the javadocs (or your Room class does not extend Containable)
Background image of page 4
A subtlety about equality What will DrJava print? Why? 9/18/08 CIS 120 5 > String v = "foo"; > String u = "foo"; > v == u false
Background image of page 5

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

View Full DocumentRight Arrow Icon
ABSTRACTION, INTERFACES, SUBTYPING. .. 9/18/08 CIS 120 6
Background image of page 6
9/18/08 CIS 120 7 Relationships between objects Many situations involve multiple interacting parts in software and in the real world!
Background image of page 7

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

View Full DocumentRight Arrow Icon
9/18/08 CIS 120 8 public class Point { private double x , y ; public Point(double anX , double aY ) { x = anX ; y = aY ; } public double getX () { return x ; } public double getY () { return y ; } public void move (double dx , double dy ) { x += dx ; y += dy ; } } Point again
Background image of page 8
9/18/08 CIS 120 9 Building on Point A circle is defined by its center (a point) and its radius (a double) public class Circle {
Background image of page 9

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

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

Page1 / 32

0918 - Introduction to Programming Languages and Techniques...

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

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