📄 tij302.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html lang="en">
<!--
This document was converted from RTF source:
By r2net 5.8 r2netcmd Windows
See http://www.logictran.com
-->
<head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Thinking in Java, 3rd ed. Revision 4.0: Introduction</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css"></head>
<body >
<CENTER> <a href="http://www.MindView.net"> <img src="mindview.gif" alt="MindView Inc." BORDER = "0"></a> <Font FACE="Verdana, Tahoma, Arial, Helvetica, Sans"> <h2>Thinking in Java, 3<sup>rd</sup> ed. Revision 4.0</h2> <FONT size = "-1"><br> [ <a href="README.txt">Viewing Hints</a> ] [ <a href="http://www.mindview.net/Books/TIJ/">Book Home Page</a> ] [ <a href="http://www.mindview.net/Etc/MailingList.html">Free Newsletter</a> ] <br> [ <a href="http://www.mindview.net/Seminars">Seminars</a> ] [ <a href="http://www.mindview.net/CDs">Seminars on CD ROM</a> ] [ <a href="http://www.mindview.net/Services">Consulting</a> ] <br><br> </FONT></FONT> </CENTER>
<font face="Georgia"><div align="CENTER"><a href="TIJ301.htm" target="RightFrame"><img src="./prev.gif" alt="Previous " border="0"></a>
<a href="TIJ303.htm" target="RightFrame"><img src="./next.gif" alt="Next " border="0"></a>
<a href="TIJ3_t.htm"><img src="./first.gif" alt="Title Page " border="0"></a>
<a href="TIJ3_i.htm"><img src="./index.gif" alt="Index " border="0"></a>
<a href="TIJ3_c.htm"><img src="./contents.gif" alt="Contents " border="0"></a>
</div>
<hr>
<h1>
<a name="_Toc24272639"></a><a name="_Toc24775498"></a><a name="Heading792"></a>Introduction</h1>
<p class="Intro">“He gave man speech, and speech created thought, Which is the measure of the Universe”—<i>Prometheus Unbound</i>, Shelley<br></p>
<p><i>Human beings ... are very much at the mercy of the particular language which has become the medium of expression for their society. It is quite an illusion to imagine that one adjusts to reality essentially without the use of language and that language is merely an incidental means of solving specific problems of communication and reflection. The fact of the matter is that the "real world" is to a large extent unconsciously built up on the language habits of the group.</i><br></p>
<p><i>The Status Of Linguistics As A Science</i>, 1929, Edward Sapir <br></p>
<p>Like any human language, Java provides a way to express concepts. If successful, this medium of expression will be significantly easier and more flexible than the alternatives as problems grow larger and more complex. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]A0663" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>You can’t look at Java as just a collection of features—some of the features make no sense in isolation. You can use the sum of the parts only if you are thinking about <i>design</i>, not simply coding. And to understand Java in this way, you must understand the problems with it and with programming in general. This book discusses programming problems, why they are problems, and the approach Java has taken to solve them. Thus, the set of features that I explain in each chapter are based on the way I see a particular type of problem being solved with the language. In this way I hope to move you, a little at a time, to the point where the Java mindset becomes your native tongue. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_22" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>Throughout, I’ll be taking the attitude that you want to build a model in your head that allows you to develop a deep understanding of the language; if you encounter a puzzle, you’ll be able to feed it to your model and deduce the answer. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_23" title="Send BackTalk Comment">Feedback</a></font><br></p>
<h2>
<a name="_Toc312373769"></a><a name="_Toc375545177"></a><a name="_Toc24775499"></a><a name="Heading799"></a>Prerequisites</h2>
<p>This book assumes that you have some programming familiarity: you understand that a program is a collection of statements, the idea of a subroutine/function/macro, control statements such as “if” and looping constructs such as “while,” etc. However, you might have learned this in many places, such as programming with a macro language or working with a tool like Perl. As long as you’ve programmed to the point where you feel comfortable with the basic ideas of programming, you’ll be able to work through this book. Of course, the book will be <i>easier</i> for the C programmers and more so for the C++ programmers, so don’t count yourself out if you’re not experienced with those languages—but come willing to work hard (also, the multimedia CD that accompanies this book will bring you up to speed in the fundamentals necessary to learn Java). However, I will be introducing the concepts of object-oriented programming (OOP) and Java’s basic control mechanisms. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_24" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>Although references will often be made to C and C++ language features, these are not intended to be insider comments, but instead to help all programmers put Java in perspective with those languages, from which, after all, Java is descended. I will attempt to make these references simple and to explain anything that I think a non- C/C++ programmer would not be familiar with. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_25" title="Send BackTalk Comment">Feedback</a></font><br></p>
<h2>
<a name="_Toc312373770"></a><a name="_Toc375545178"></a><a name="_Toc24775500"></a><a name="Heading802"></a>Learning
Java</h2>
<p>At about the same time that my first book <i>Using C++</i> (Osborne/McGraw-Hill, 1989) came out, I began teaching that language. Teaching programming languages has become my profession; I’ve seen nodding heads, blank faces, and puzzled expressions in audiences all over the world since 1987. As I began giving in-house training with smaller groups of people, I discovered something during the exercises. Even those people who were smiling and nodding were confused about many issues. I found out, by creating and chairing the C++ track at the Software Development Conference for a number of years (and later creating and chairing the Java track), that I and other speakers tended to give the typical audience too many topics too quickly. So eventually, through both variety in the audience level and the way that I presented the material, I would end up losing some portion of the audience. Maybe it’s asking too much, but because I am one of those people resistant to traditional lecturing (and for most people, I believe, such resistance results from boredom), I wanted to try to keep everyone up to speed. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_26" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p><a name="Index6"></a><a name="Index7"></a>For a time, I was creating a number of different presentations in fairly short order. Thus, I ended up learning by experiment and iteration (a technique that also works well in Java program design). Eventually, I developed a course using everything I had learned from my teaching experience. It tackles the learning problem in discrete, easy-to-digest steps, and in a hands-on seminar (the ideal learning situation), there are exercises following each of the short lessons. My company MindView, Inc. now gives this as the public and in-house <a name="Index8"></a><a name="Index9"></a><i>Thinking in Java</i> seminar; this is our main introductory seminar that provides the foundation for our more advanced seminars. You can find details at <i>www.MindView.net</i>. (The introductory seminar is also available as the <i>Hands-On Java </i>CD ROM. Information is available at the same Web site.) <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_27" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>The feedback that I get from each seminar helps me change and refocus the material until I think it works well as a teaching medium. But this book isn’t just seminar notes; I tried to pack as much information as I could within these pages, and structured it to draw you through onto the next subject. More than anything, the book is designed to serve the solitary reader who is struggling with a new programming language. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_28" title="Send BackTalk Comment">Feedback</a></font><br></p>
<h2>
<a name="_Toc312373771"></a><a name="_Toc375545179"></a><a name="_Toc24775501"></a><a name="Heading806"></a>Goals</h2>
<p>Like my previous book <i>Thinking in C++</i>, this book has come to be structured around the process of teaching the language. In particular, my motivation is to create something that provides me with a way to teach the language in my own seminars. When I think of a chapter in the book, I think in terms of what makes a good lesson during a seminar. My goal is to get bite-sized pieces that can be taught in a reasonable amount of time, followed by exercises that are feasible to accomplish in a classroom situation. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_29" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>My goals in this book are to: <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_30" title="Send BackTalk Comment">Feedback</a></font><br></p>
<ol>
<li>Present the material one simple step at a time so that you can easily digest
each concept before moving on. <font size="-2"><a
href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Intro_31" title="Send BackTalk
Comment">Feedback</a></font></li>
<li>Use examples that are as simple and short as possible. This sometimes
prevents me from tackling “real world” problems, but I’ve
found that beginners are usually happier when they can understand every detail
of an example rather than being impressed by the scope of the problem it solves.
Also, there’s a severe limit to the amount of code that can be absorbed in
a classroom situation. For this I will no doubt receive criticism for using
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -