introduction.html

来自「java 是一个很好的网络开发环境。由于它是通过解释的方法」· HTML 代码 · 共 824 行 · 第 1/4 页

HTML
824
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<!--
This document was converted from RTF source: 
By rtftohtml 4.19
See http://www.sunpack.com/RTF
Filename:Tjava14.rtf
Application Directory:c:\TOOLS\RTF2HTML\
Subject:
Author:Bruce Eckel
Operator:Bruce Eckel
Document Comments:
Version Comments:
Comments:
Keywords:
Translation Date:02/04/2000
Translation Time:23:24:29
Translation Platform:Win32
Number of Output files:27
This File:Introduction.html
SplitDepth=1
SkipNavPanel=1
SkipLeadingToc=1
SkipTrailingToc=1
GenContents=1
GenFrames=1
GenIndex=1
-->
<HEAD lang="en"><META http-equiv="Content-Type" content="text/html">
<TITLE>Introduction</TITLE>
</HEAD>

<BODY  BGCOLOR="#FFFFFF"><DIV ALIGN="CENTER">
  <a href="http://www.MindView.net">
  <img src="mindview-head.gif" alt="MindView Inc." BORDER = "0"></a>
  <CENTER>
    <FONT FACE="Verdana" size = "-1">
    [ <a href="README-HTML.txt">Viewing Hints</a> ]
    [ <a href="http://www.mindview.net/TIJ2/index.html">2nd Edition</a> ]
    [ <a href="http://www.mindview.net/MailingList.html">Free Newsletter</a> ] <br>
    [ <a href="http://www.mindview.net/Training.html">Seminars</a> ]
    [ <a href="http://www.mindview.net/javaCD2.html">Seminars on CD ROM</a> ]
    [ <a href="http://www.mindview.net/CPPServices/#ConsultingServices">Consulting</a> ]
    </FONT>
  <H2><FONT FACE="Verdana">
  Thinking in Java, 1st edition</FONT></H2>
  <H3><FONT FACE="Verdana">&copy;1998 by Bruce Eckel</FONT></H3>
  
    <FONT FACE="Verdana" size = "-1">
     [ <a href="Foreword.html">Previous Chapter</a> ] 
    [ <a href="SimpleContents.html">Short TOC</a> ] 
    [ <a href="Contents.html">Table of Contents</a> ] 
    [ <a href="DocIndex.html">Index</a> ]
     [ <a href="Chapter01.html">Next Chapter</a> ] 
    </FONT>
    
  </CENTER>
  </P></DIV><A NAME="_Toc407441444"></A><A NAME="_Toc408018369"></A><A NAME="Heading2"></A><FONT FACE = "Verdana"><H1 ALIGN="LEFT">
Introduction</H1></FONT>
<DIV ALIGN="LEFT"><P><FONT FACE="Verdana" SIZE=4>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><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">You can&#8217;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 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><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">Throughout, I&#8217;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&#8217;ll be able to feed it to your model and deduce the
answer.</FONT><A NAME="_Toc312373769"></A><A NAME="_Toc375545177"></A><A NAME="_Toc408018370"></A><BR></P></DIV>
<A NAME="Heading3"></A><FONT FACE = "Verdana"><H2 ALIGN="LEFT">
Prerequisites</H2></FONT>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">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
&#8220;if&#8221; and looping constructs such as &#8220;while,&#8221; 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&#8217;ve
programmed to the point where you feel comfortable with the basic ideas of
programming, you&#8217;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,
but don&#8217;t count yourself out if you&#8217;re not experienced with those
languages (but come willing to work hard). I&#8217;ll be introducing the
concepts of object-oriented programming and Java&#8217;s basic control
mechanisms, so you&#8217;ll be exposed to those, and the first exercises will
involve the basic control-flow statements.</FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">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><A NAME="_Toc312373770"></A><A NAME="_Toc375545178"></A><A NAME="_Toc408018371"></A><BR></P></DIV>
<A NAME="Heading4"></A><FONT FACE = "Verdana"><H2 ALIGN="LEFT">
Learning Java</H2></FONT>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">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&#8217;ve seen nodding heads, blank faces, and puzzled expressions in audiences
all over the world since 1989. 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
chairing the C++ track at the <A NAME="Index1"></A><A NAME="Index2"></A>Software
Development Conference for the past few years (and now also the Java track),
that I and other speakers tended to give the typical audience too many topics
too fast. 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&#8217;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><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">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 &#8211; one that I would be happy giving for a long time. 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. I now give this course in
<A NAME="Index3"></A><A NAME="Index4"></A>public Java seminars, which you can
find out about at <I>http://www.BruceEckel.com</I>. (The introductory seminar is
also available as a CD ROM. Information is available at the same Web
site.)</FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">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&#8217;t just a seminar handout &#8211; 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><A NAME="_Toc312373771"></A><A NAME="_Toc375545179"></A><A NAME="_Toc408018372"></A><BR></P></DIV>
<A NAME="Heading5"></A><FONT FACE = "Verdana"><H2 ALIGN="LEFT">
Goals</H2></FONT>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">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><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">My goals in this book are
to:</FONT><BR></P></DIV>
<OL>
<LI><FONT FACE="Verdana" SIZE=5>	</FONT><FONT FACE="Georgia">Present
the material one simple step at a time so that you can easily digest each
concept before moving
on.</FONT><LI><FONT FACE="Verdana" SIZE=5>	</FONT><FONT FACE="Georgia">Use
examples that are as simple and short as possible. This sometimes prevents me
from tackling &#8220;real world&#8221; problems, but I&#8217;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&#8217;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
&#8220;toy examples,&#8221; but I&#8217;m willing to accept that in favor of
producing something pedagogically
useful.</FONT><LI><FONT FACE="Verdana" SIZE=5>	</FONT><FONT FACE="Georgia">Carefully
sequence the presentation of features so that you aren&#8217;t seeing something
that you haven&#8217;t been exposed to. Of course, this isn&#8217;t always
possible; in those situations, a brief introductory description is
given.</FONT><LI><FONT FACE="Verdana" SIZE=5>	</FONT><FONT FACE="Georgia">Give
you what I think is important for you to understand about the language, rather
than everything I know. I believe there is an information importance hierarchy,
and that there are some facts that 95 percent of programmers will never need to
know and just confuses people and adds to their perception of the complexity of
the language. To take an example from C, if you memorize the operator precedence
table (I never did), you can write clever code. But if you need to think about
it, it will also confuse the reader/maintainer of that code. So forget about
precedence, and use parentheses when things aren&#8217;t clear.
</FONT><LI><FONT FACE="Verdana" SIZE=5>	</FONT><FONT FACE="Georgia">Keep
each section focused enough so that the lecture time &#8211; and the time
between exercise periods &#8211; is small. Not only does this keep the
audience&#8217;s minds more active and involved during a hands-on seminar, but
it gives the reader a greater sense of
accomplishment.</FONT><LI><FONT FACE="Verdana" SIZE=5>	</FONT><FONT FACE="Georgia">Provide
you with a solid foundation so that you can understand the issues well enough to
move on to more difficult coursework and
books.</FONT><A NAME="_Toc312373772"></A><A NAME="_Toc375545180"></A><A NAME="_Toc408018373"></A></OL><A NAME="Heading6"></A><FONT FACE = "Verdana"><H2 ALIGN="LEFT">
Online documentation</H2></FONT>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">The Java language and libraries
from Sun Microsystems (a free download) come with documentation in electronic
form, readable using a Web browser, and virtually every third party
implementation of Java has this or an equivalent documentation system. Almost
all the books published on Java have duplicated this documentation. So you
either already have it or you can download it, and unless necessary, this book
will not repeat that documentation because it&#8217;s usually much faster if you
find the class descriptions with your Web browser than if you look them up in a
book. (Plus it will be up-to-date.) This book will provide extra descriptions of
the classes only when it&#8217;s necessary to supplement the documentation so
you can understand a particular
example.</FONT><A NAME="_Toc408018374"></A><BR></P></DIV>
<A NAME="Heading7"></A><FONT FACE = "Verdana"><H2 ALIGN="LEFT">
Chapters</H2></FONT>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">This book was designed with one
thing in mind: the way people learn the Java language. Seminar audience feedback
helped me understand which parts were difficult and needed illumination. In the
areas where I got ambitious and included too many features all at once, I came
to know &#8211; through the process of presenting the material &#8211; that if
you include a lot of new features, you need to explain them all, and this easily

⌨️ 快捷键说明

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