theclapp

Search theclapp.blog-city.com

 

Chapter 4, ex 10, Java version

posted Monday, 13-Jan-2003
16:13 -- Starting 4.10,Java version
16:24 -- done. Got hung up on correct syntax to call a constructor via this. Tried this.ch04_ex10(...). That don't work! Eventually went back and took another look at the section called (wait for it) Calling constructors from constructors, and that cleared me up. *sigh* As my mother used to say, "When all else fails, read the directions."
---
// ch04_ex10.java

class ch04_ex10 {
double quantity;

ch04_ex10( double d ) {
quantity = d;
}

ch04_ex10( int i ) {
this( i * 1.0 );
}

public static void main(String[] args) {
ch04_ex10 obj = new ch04_ex10( 1 );
}
}
---

16:28 -- Starting 4.10, Lisp version
16:40 -- gotta split. Kinda stalled on how to do the initialize-instance.

links: digg this    del.icio.us    technorati    reddit