⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tij302.htm

📁 这也是我们java老师给我们的thinking in java的一些资料
💻 HTM
📖 第 1 页 / 共 5 页
字号:
sites), where it is freely available under the terms stated
above.

If you think you've found an error in the Source Code,
please submit a correction using the URL marked <font color=#004488>"feedback"</font>
in the electronic version of the book, nearest the error
you've found.</PRE></FONT></BLOCKQUOTE><p><br></p>
<p>You may use the code in your projects and in the classroom (including your presentation materials) as long as the copyright notice that appears in each source file is retained. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_70" title="Send BackTalk Comment">Feedback</a></font><br></p>
<h3>
<a name="_Toc312373775"></a><a name="_Toc375545183"></a><a name="_Toc24775507"></a><a name="Heading952"></a>Coding
standards<br></h3>
<p><a name="Index15"></a><a name="Index16"></a>In the text of this book, identifiers (method, variable, and class names) are set in <b>bold</b>. Most keywords are also set in bold, except for those keywords that are used so much that the bolding can become tedious, such as &#147;class.&#148; <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_71" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>I use a particular coding style for the examples in this book. This style follows the style that Sun itself uses in virtually all of the code you will find at its site (see <i>java.sun.com/docs/codeconv/index.html</i>), and seems to be supported by most Java development environments. If you&#146;ve read my other works, you&#146;ll also notice that Sun&#146;s coding style coincides with mine&#151;this pleases me, although I had nothing to do with it. The subject of formatting style is good for hours of hot debate, so I&#146;ll just say I&#146;m not trying to dictate correct style via my examples; I have my own motivation for using the style that I do. Because Java is a free-form programming language, you can continue to use whatever style you&#146;re comfortable with. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_72" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>The programs in this book are files that are included by the word processor in the text, directly from compiled files. Thus, the code files printed in the book should all work without compiler errors. The errors that <i>should</i> cause compile-time error messages are commented out with the comment <b>//! </b>so they can be easily discovered and tested using automatic means. Errors discovered and reported to the author will appear first in the distributed source code and later in updates of the book (which will also appear on the Web site <a name="Index17"></a><a name="Index18"></a><i>www.BruceEckel.com</i>). <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_73" title="Send BackTalk Comment">Feedback</a></font><br></p>
<h2>
<a name="_Toc312373778"></a><a name="_Toc375545184"></a><a name="_Toc24775508"></a><a name="Heading956"></a>Java
versions<br></h2>
<p><a name="Index19"></a><a name="Index20"></a>I generally rely on the Sun implementation of Java as a reference when determining whether behavior is correct. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_74" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>This book focuses on and is tested with Java 2, JDK 1.4. If you need to learn about earlier releases of the language that are not covered in this edition, the first edition and second editions of the book are freely downloadable at <i>www.BruceEckel.com</i> and are also contained on the CD that is bound in with this book. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_76" title="Send BackTalk Comment">Feedback</a></font><br></p>
<h2>
<a name="_Toc312373779"></a><a name="_Toc375545185"></a><a name="_Toc24775509"></a><a name="Heading959"></a>Errors<br></h2>
<p><a name="Index21"></a><a name="Index22"></a><a name="Index23"></a>No matter how many tricks a writer uses to detect errors, some always creep in and these often leap off the page for a fresh reader. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_80" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>Because the feedback provided by astute readers has been so valuable to me, I&#146;ve developed several versions of a feedback system called <i>BackTalk </i>(conceived with the aid of Bill Venners, and implemented with the help of numerous others, using several different technologies). In the electronic version of this book, freely downloadable from <i>www.BruceEckel.com</i>,<i> </i>each paragraph in the text has its own unique URL that will produce an email that will register your comment in the BackTalk system, for that particular paragraph. This way it&#146;s very easy to track and update corrections. If you discover anything you believe to be an error, please use the BackTalk system to submit the error along with your suggested correction. Your help is appreciated. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_81" title="Send BackTalk Comment">Feedback</a></font><br></p>
<h2>
<a name="_Toc312373780"></a><a name="_Toc375545186"></a><a name="_Toc24775510"></a><a name="Heading962"></a>Note
on the cover design</h2>
<p>The cover of <i>Thinking in Java</i> is inspired by the American Arts &amp; Crafts Movement that began near the turn of the century and reached its zenith between 1900 and 1920. It began in England as a reaction to both the machine production of the Industrial Revolution and the highly ornamental style of the Victorian era. Arts &amp; Crafts emphasized spare design, the forms of nature as seen in the art nouveau movement, hand-crafting, and the importance of the individual craftsperson, and yet it did not eschew the use of modern tools. There are many echoes with the situation we have today: the turn of the century, the evolution from the raw beginnings of the computer revolution to something more refined and meaningful to individual persons, and the emphasis on software craftsmanship rather than just manufacturing code. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_82" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>I see Java in this same way: as an attempt to elevate the programmer away from an operating-system mechanic and toward being a &#147;software craftsman.&#148; <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_83" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>Both the author and the book/cover designer (who have been friends since childhood) find inspiration in this movement, and both own furniture, lamps, and other pieces that are either original or inspired by this period. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_84" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>The other theme in this cover suggests a collection box that a naturalist might use to display the insect specimens that he or she has preserved. These insects are objects that are placed within the box objects. The box objects are themselves placed within the &#147;cover object,&#148; which illustrates the fundamental concept of aggregation in object-oriented programming. Of course, a programmer cannot help but make the association with &#147;bugs,&#148; and here the bugs have been captured and presumably killed in a specimen jar, and finally confined within a small display box, as if to imply Java&#146;s ability to find, display, and subdue bugs (which is truly one of its most powerful attributes). <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_85" title="Send BackTalk Comment">Feedback</a></font><br></p>
<h2>
<a name="_Toc24775511"></a><a name="Heading967"></a>Acknowledgements</h2>
<p>First, thanks to associates who have worked with me to give seminars, provide consulting, and develop teaching projects: Andrea Provaglio, Dave Bartlett, Bill Venners, Chuck Allison, Jeremy Meyer, and Larry O&#146;Brien. I appreciate your patience as I continue to try to develop the best model for independent folks like us to work together. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]A0665" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>Recently, no doubt because of the Internet, I have become associated with a surprisingly large number of people who assist me in my endeavors, usually working from their own home offices. In the past, I would have had to pay for a pretty big office space to accommodate all these folks, but because of the net and Fedex and occasionally the telephone, I&#146;m able to benefit from their help without the extra costs. In my attempts to learn to better &#147;play well with others,&#148; you have all been very helpful, and I hope to continue learning how to make my own work better through the efforts of others. Paula Steuer has been invaluable in taking over my haphazard business practices and making them sane (thanks for prodding me when I don&#146;t want to do something, Paula). Jonathan Wilcox, Esq., has sifted through my corporate structure and turned over every possible rock that might hide scorpions, and frog-marched us through the process of putting everything straight, legally. Thanks for your care and persistence. Sharlynn Cobaugh (who discovered Paula) has made herself an expert in sound processing and an essential part of creating the multimedia training CD ROMs, as well as tackling other problems. Thanks for your perseverance when faced with intractable computer problems. Evan Cofsky (Evan@TheUnixMan.com) has become an essential part of my development process, taking to the Python programming language like a duck (Hmm. Such a mixed metaphor could produce a fat Python) and solving all kinds of difficult problems, including the (final?) re-architecting of BackTalk into an email-driven XML database. The folks at Amaio in Prague have helped me out with several projects. Daniel Will-Harris was the original work-by-Internet inspiration, and he is of course fundamental to all my design solutions. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]A0666" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>For this project, I took another step that had been fermenting in the back of my mind for awhile. For the summer of 2002, I created an internship program in Crested Butte, Colorado, initially looking for two interns and ending up with 5 (two volunteers). Not only did they contribute to the book but they helped keep me focused on the project. Thanks to JJ Badri, Ben Hindman, Mihajlo Jovanovic, Mark Welsh. Chintan Thakker was able to stay for a second internship through the end of the book process and beyond, and since I had to rent the intern condo in Mount Crested Butte anyway, we advertised for volunteers and got Mike Levin, Mike Shea, and Ian Phillips, who all made contributions. Someday I may do another internship program; visit www.MindView.net for news. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]A0667" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>Thanks to the Doyle Street Cohousing Community for putting up with me for the two years that it took me to write the first edition of this book (and for putting up with me at all). Thanks very much to Kevin and Sonda Donovan for subletting their great place in gorgeous Crested Butte, Colorado for the summer while I worked on the first edition of the book (and to Kevin for all the great remodeling on my place in CB). Also thanks to the friendly residents of Crested Butte and the Rocky Mountain Biological Laboratory who make me feel so welcome. My yoga teachers in CB, Maria and Brenda, were instrumental in keeping me sane during the development of the 3<sup>rd</sup> edition. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_87" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>Camp4 Coffee in Crested Butte, Colorado has become the standard hangout when teachers have come up to give seminars, and during seminar breaks it is the best and cheapest catering I&#146;ve ever had. Thanks to my buddy Al Smith for creating it and making it such a great place, and for being such an interesting and entertaining part of the Crested Butte experience. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]A0664" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>Thanks to Claudette Moore at Moore Literary Agency for her tremendous patience and perseverance in getting me exactly what I wanted. Thanks to Paul Petralia at Prentice Hall for continuing to <i>give</i> me what I want, and for going out of his way to make things run smoothly for me (and for putting up with all my special requirements). <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_88" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>My first two books were published with Jeff Pepper as editor at Osborne/McGraw-Hill. Jeff appeared at the right place and the right time at Prentice Hall to lay the original groundwork for these books, before passing the responsibility on to Paul. Thanks, Jeff. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_89" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>Thanks to Rolf Andr&eacute; Klaedtke (Switzerland); Martin Vlcek, Vlada &amp; Pavel Lahoda, (Prague); and Marco Cantu (Italy) for hosting me on my first self-organized European seminar tour. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_86" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>Thanks to Gen Kiyooka and his company Digigami, who graciously provided my Web server for the first several years of my presence on the Web. This was an invaluable learning aid. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_90" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>Special thanks to Larry and Tina O&#146;Brien, who helped turn my seminar into the first edition of the <i>Hands-On Java </i>CD ROM. (You can find out more at <i>www.BruceEckel.com</i>.) <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_93" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>Certain open-source tools have proved invaluable during my development process and I am very grateful to the creators every time I use these. Cygwin (<i>http://www.cygwin.com</i>) has solved innumerable problems for me that Windows can&#146;t/won&#146;t and I become more attached to it each day (if I only had this 15 years ago when my brain was still hard-wired with Gnu Emacs). CVS and Ant have become essential to my Java development process and I couldn&#146;t go back now. I&#146;ve even become fond of JUnit (<i>http://www.junit.org</i>) now that they&#146;ve <i>actually</i> made it &#147;the simplest thing that could possibly work.&#148; IBM&#146;s Eclipse (<i>http://www.eclipse.org</i>) is a truly wonderful contribution to the development community, and I expect to see great things from it as it continues to evolve (how did IBM become hip? I must have missed a memo). Linux was used daily during the development process, especially by the interns. And of course, if I don&#146;t say it enough everywhere else, I use Python (www.Python.org) constantly to solve problems, the brainchild of my buddy Guido Van Rossum and the goofy geniuses at PythonLabs with whom I spent a few great days doing XP on Zope 3 (Tim, I&#146;ve now framed that mouse you borrowed, officially named the &#147;TimMouse&#148;). You guys need to find healthier places to eat lunch. (Also, thanks to the entire Python community, an amazing bunch of people). <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]A0668" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>Lots of people sent in corrections and I am indebted to them all, but particular thanks go to (for the first edition): Kevin Raulerson (found tons of great bugs), Bob Resendes (simply incredible), John Pinto, Joe Dante, Joe Sharp (all three were fabulous), David Combs (many grammar and clarification corrections), Dr. Robert Stephenson, John Cook, Franklin Chen, Zev Griner, David Karr, Leander A. Stroschein, Steve Clark, Charles A. Lee, Austin Maher, Dennis P. Roth, Roque Oliveira, Douglas Dunn, Dejan Ristic, Neil Galarneau, David B. Malkovsky, Steve Wilkinson, and a host of others. Prof. Ir. Marc Meurrens put in a great deal of effort to publicize and make the electronic version of the first edition of the book available in Europe. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_94" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>Thanks to those who helped me rewrite the examples to use the Swing library (for the 2<sup>nd</sup> edition), and for other assistance: Jon Shvarts, Thomas Kirsch, Rahim Adatia, Rajesh Jain, Ravi Manthena, Banu Rajamani, Jens Brandt, Nitin Shivaram, Malcolm Davis, and everyone who expressed support. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_102" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>There have been a spate of smart technical people in my life who have become friends and have also been both influential and unusual in that they do yoga and practice other forms of spiritual enhancement, which I find quite inspirational and instructional. They are Kraig Brockschmidt, Gen Kiyooka, and Andrea Provaglio (who helps in the understanding of Java and programming in general in Italy, and now in the United States as an associate of the MindView team). <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_95" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>It&#146;s not that much of a surprise to me that understanding Delphi helped me understand Java, since there are many concepts and language design decisions in common. My Delphi friends provided assistance by helping me gain insight into that marvelous programming environment. They are Marco Cantu (another Italian&#151;perhaps being steeped in Latin gives one aptitude for programming languages?), Neil Rubenking (who used to do the yoga/vegetarian/Zen thing until he discovered computers), and of course Zack Urlocker (Delphi product manager), a long-time pal whom I&#146;ve traveled the world with. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_96" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>My friend Richard Hale Shaw&#146;s insights and support have been very helpful (and Kim&#146;s, too). Richard and I spent many months giving seminars together and trying to work out the perfect learning experience for the attendees. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_97" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>The book design, cover design, and cover photo were created by my friend Daniel Will-Harris, noted author and designer (<i>www.Will-Harris.com</i>), who used to play with rub-on letters in junior high school while he awaited the invention of computers and desktop publishing, and complained of me mumbling over my algebra problems. However, I produced the camera-ready pages myself, so the typesetting errors are mine. Microsoft<sup>&reg;</sup> Word XP for Windows was used to write the book and to create camera-ready pages in Adobe Acrobat; the book was created directly from the Acrobat PDF files. As a tribute to the electronic age, I happened to be overseas when the final version of the first and second editions of the book was produced&#151;the first edition was sent from Capetown, South Africa and the second edition was posted from Prague. The third was from Crested Butte, Colorado. The body typeface is <i>Georgia </i>and the headlines are in <i>Verdana</i>. The cover typeface is <i>ITC Rennie Mackintosh. </i><font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_98" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>A special thanks to all my teachers and all my students (who are my teachers as well). The most fun writing teacher was Gabrielle Rico (author of <i>Writing the Natural Way</i>, Putnam, 1983). I&#146;ll always treasure the terrific week at Esalen. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_100" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>My sweetie Dawn McGee took the back cover photo, and makes me smile that way.<br></p>
<p>The supporting cast of friends includes, but is not limited to: Andrew Binstock, Steve Sinofsky, JD Hildebrandt, Tom Keffer, Brian McElhinney, Brinkley Barr, Bill Gates at <i>Midnight Engineering Magazine</i>, Larry Constantine and Lucy Lockwood, Greg Perry, Dan Putterman, Christi Westphal, Gene Wang, Dave Mayer, David Intersimone, Andrea Rosenfield, Claire Sawyers, more Italians (Laura Fallai, Corrado, Ilsa, and Cristina Giustozzi), Chris and Laura Strand, the Almquists, Brad Jerbic, Marilyn Cvitanic, the Mabrys, the Haflingers, the Pollocks, Peter Vinci, the Robbins Families, the Moelter Families (and the McMillans), Michael Wilk, Dave Stoner, Laurie Adams, the Cranstons, Larry Fogg, Mike and Karen Sequeira

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -