carfield.com.hk JavaClass.java 2001-12-26T16:00:00Z 2001-12-26T16:00:00Z <br/><TEXTAREA name="code" class="java" rows="16" cols="100">//: c09:javaclass:JavaClass.java package c09.javaclass; import com.bruceeckel.test.*; import com.bruceeckel.util.*; public class JavaClass { private String s = &quot;&quot;; public JavaClass() { System.out.println(&quot;JavaClass()&quot;); } public JavaClass(String a) { s = a; System.out.println(&quot;JavaClass(String)&quot;); } public String getVal() { System.out.println(&quot;getVal()&quot;); return s; } public void setVal(String a) { System.out.println(&quot;setVal()&quot;); s = a; } public Character[] getChars() { System.out.println(&quot;getChars()&quot;); Character[] r = new Character[s.length()]; for(int i = 0; i &lt; s.length(); i++) r[i] = new Character(s.charAt(i)); return r; } public static class Test extends UnitTest { JavaClass x1 = new JavaClass(), x2 = new JavaClass(&quot;UnitTest&quot;); public void test1() { System.out.println(x2.getVal()); x1.setVal(&quot;SpamEggsSausageAndSpam&quot;); Arrays2.print(x1.getChars()); } } public static void main(String[] args) { Test test = new Test(); test.test1(); } } ///:~ </TEXTAREA><br><br/><script type="text/javascript"><!--google_ad_client = "pub-9426659565807829";google_ad_slot = "9359905831";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script> 2001-12-26T16:00:00Z makefile 2001-12-26T16:00:00Z 2001-12-26T16:00:00Z <br/><TEXTAREA name="code" class="" rows="16" cols="100"># From Thinking in Patterns (with Java) by Bruce Eckel # At http://www.BruceEckel.com # (c)2001 Bruce Eckel # Copyright notice in Copyright.txt # Automatically-generated MAKEFILE # For examples in directory .\c09\javaclass # using the JDK 1.3 compiler # Invoke with: make HOME := ../../ ifndef MAKECMDGOALS MAKECMDGOALS := javac endif # Command.com is too weak to build this under Windows NT/2000: ifeq ($(OS),Windows_NT) COMSPEC=$(SYSTEMROOT)\system32\cmd.exe endif ifneq ($(MAKECMDGOALS),clean) include $(HOME)/$(MAKECMDGOALS).mac endif .SUFFIXES : .class .java .java.class : $(JVC) $(JVCFLAGS) $&lt; javac: \ JavaClass.class jikes: \ JavaClass.class clean: ifeq ($(notdir $(SHELL)),COMMAND.COM) del *.class else rm -f *.class endif JavaClass.class: JavaClass.java $(JVC) $(JVCFLAGS) $&lt; java com.bruceeckel.test.RunUnitTests c09.javaclass.JavaClass </TEXTAREA><br><br/><script type="text/javascript"><!--google_ad_client = "pub-9426659565807829";google_ad_slot = "9359905831";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script> 2001-12-26T16:00:00Z