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

📄 intro.htm

📁 Thinking in Java, 2nd edition
💻 HTM
📖 第 1 页 / 共 5 页
字号:
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’t clear. 

</backtalk:display>
[&nbsp;<a href='http://www.mindview.net/backtalk/CommentServlet?ID=TIJ3_INTRO_I34' 
  target="_blank">Add&nbsp;Comment</a>&nbsp;]

<backtalk:display ID=TIJ3_INTRO_I35>
</FONT><LI><FONT FACE="Verdana">	</FONT><FONT FACE="Georgia">Keep
each section focused enough so that the lecture time&#8212;and the time between
exercise periods&#8212;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.

</backtalk:display>
[&nbsp;<a href='http://www.mindview.net/backtalk/CommentServlet?ID=TIJ3_INTRO_I35' 
  target="_blank">Add&nbsp;Comment</a>&nbsp;]

<backtalk:display ID=TIJ3_INTRO_I36>
</FONT><LI><FONT FACE="Verdana">	</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.

</backtalk:display>
[&nbsp;<a href='http://www.mindview.net/backtalk/CommentServlet?ID=TIJ3_INTRO_I36' 
  target="_blank">Add&nbsp;Comment</a>&nbsp;]

<backtalk:display ID=TIJ3_INTRO_I37>
</FONT><A NAME="_Toc312373772"></A><A NAME="_Toc375545180"></A><A NAME="_Toc481064454"></A></OL><A NAME="Heading9"></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 (and the
on-line documentation is probably more 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.
</backtalk:display>
[&nbsp;<a href='http://www.mindview.net/backtalk/CommentServlet?ID=TIJ3_INTRO_I37' 
  target="_blank">Add&nbsp;Comment</a>&nbsp;]

<backtalk:display ID=TIJ3_INTRO_I38>
</FONT><A NAME="_Toc481064455"></A><BR></P></DIV>
<A NAME="Heading10"></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 the difficult parts that needed illumination. In the areas where I
got ambitious and included too many features all at once, I came to
know&#8212;through the process of presenting the material&#8212;that if you
include a lot of new features, you need to explain them all, and this easily
compounds the student&#8217;s confusion. As a result, I&#8217;ve taken a great
deal of trouble to introduce the features as few at a time as
possible.
</backtalk:display>
[&nbsp;<a href='http://www.mindview.net/backtalk/CommentServlet?ID=TIJ3_INTRO_I38' 
  target="_blank">Add&nbsp;Comment</a>&nbsp;]

<backtalk:display ID=TIJ3_INTRO_I39>
</FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">The goal, then, is for each chapter to
teach a single feature, or a small group of associated features, without relying
on additional features. That way you can digest each piece in the context of
your current knowledge before moving
on.
</backtalk:display>
[&nbsp;<a href='http://www.mindview.net/backtalk/CommentServlet?ID=TIJ3_INTRO_I39' 
  target="_blank">Add&nbsp;Comment</a>&nbsp;]

<backtalk:display ID=TIJ3_INTRO_I40>
</FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">Here is a brief description of the
chapters contained in the book, which correspond to lectures and exercise
periods in my hands-on
seminars.
</backtalk:display>
[&nbsp;<a href='http://www.mindview.net/backtalk/CommentServlet?ID=TIJ3_INTRO_I40' 
  target="_blank">Add&nbsp;Comment</a>&nbsp;]

<backtalk:display ID=TIJ3_INTRO_I41>
</FONT><A NAME="OLE_LINK10"></A><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B><I>Chapter 1:	Introduction to
Objects</I></B></FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">This chapter is an overview of what
object-oriented programming is all about, including the answer to the basic
question &#8220;What&#8217;s an object?&#8221;, interface vs. implementation,
abstraction and encapsulation, messages and functions, inheritance and
composition, and the all-important polymorphism. You&#8217;ll also get an
overview of issues of object creation such as constructors, where the objects
live, where to put them once they&#8217;re created, and the magical garbage
collector that cleans up the objects that are no longer needed. Other issues
will be introduced, including error handling with exceptions, multithreading for
responsive user interfaces, and networking and the Internet. You&#8217;ll learn
what makes Java special, why it&#8217;s been so successful, and about
object-oriented analysis and design. </FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B><I>Chapter 2:	Everything is an
Object</I></B></FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">This chapter moves you to the point where
you can write your first Java program, so it must give an overview of the
essentials, including the concept of a <I>reference</I> to an object; how to
create an object; an introduction to primitive types and arrays; scoping and the
way objects are destroyed by the garbage collector; how everything in Java is a
new data type (class) and how to create your own classes; functions, arguments,
and return values; name visibility and using components from other libraries;
the <B>static</B> keyword; and comments and embedded
documentation.
</backtalk:display>
[&nbsp;<a href='http://www.mindview.net/backtalk/CommentServlet?ID=TIJ3_INTRO_I41' 
  target="_blank">Add&nbsp;Comment</a>&nbsp;]

<backtalk:display ID=TIJ3_INTRO_I42>
</FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B><I>Chapter 3:	Controlling Program
Flow</I></B></FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">This chapter begins with all of the
operators that come to Java from C and C++. In addition, you&#8217;ll discover
common operator pitfalls, casting, promotion, and precedence. This is followed
by the basic control-flow and selection operations that you get with virtually
any programming language: choice with if-else; looping with for and while;
quitting a loop with break and continue as well as Java&#8217;s labeled break
and labeled continue (which account for the &#8220;missing goto&#8221; in Java);
and selection using switch. Although much of this material has common threads
with C and C++ code, there are some differences. In addition, all the examples
will be full Java examples so you&#8217;ll get more comfortable with what Java
looks like. 
</backtalk:display>
[&nbsp;<a href='http://www.mindview.net/backtalk/CommentServlet?ID=TIJ3_INTRO_I42' 
  target="_blank">Add&nbsp;Comment</a>&nbsp;]

<backtalk:display ID=TIJ3_INTRO_I43>
</FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B><I>Chapter 4:	Initialization &amp;
Cleanup</I></B></FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">This chapter begins by introducing the
constructor, which guarantees proper initialization. The definition of the
constructor leads into the concept of function overloading (since you might want
several constructors). This is followed by a discussion of the process of
cleanup, which is not always as simple as it seems. Normally, you just drop an
object when you&#8217;re done with it and the garbage collector eventually comes
along and releases the memory. This portion explores the garbage collector and
some of its idiosyncrasies. The chapter concludes with a closer look at how
things are initialized: automatic member initialization, specifying member
initialization, the order of initialization, <B>static</B> initialization and
array initialization. 
</backtalk:display>
[&nbsp;<a href='http://www.mindview.net/backtalk/CommentServlet?ID=TIJ3_INTRO_I43' 
  target="_blank">Add&nbsp;Comment</a>&nbsp;]

<backtalk:display ID=TIJ3_INTRO_I44>
</FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B><I>Chapter 5:	Hiding the
Implementation</I></B></FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">This chapter covers the way that code is
packaged together, and why some parts of a library are exposed while other parts
are hidden. It begins by looking at the <B>package</B> and <B>import</B>
keywords, which perform file-level packaging and allow you to build libraries of
classes. It then examines subject of directory paths and file names. The
remainder of the chapter looks at the <B>public</B>, <B>private,</B> and
<B>protected</B> keywords, the concept of &#8220;friendly&#8221; access, and
what the different levels of access control mean when used in various contexts.

</backtalk:display>
[&nbsp;<a href='http://www.mindview.net/backtalk/CommentServlet?ID=TIJ3_INTRO_I44' 
  target="_blank">Add&nbsp;Comment</a>&nbsp;]

<backtalk:display ID=TIJ3_INTRO_I45>
</FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B><I>Chapter 6:	Reusing Classes
</I></B></FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">The concept of inheritance is standard in
virtually all OOP languages. It&#8217;s a way to take an existing class and add
to its functionality (as well as change it, the subject of Chapter 7).
Inheritance is often a way to reuse code by leaving the &#8220;base class&#8221;
the same, and just patching things here and there to produce what you want.
However, inheritance isn&#8217;t the only way to make new classes from existing
ones. You can also embed an object inside your new class with
<I>composition</I>. In this chapter you&#8217;ll learn about these two ways to
reuse code in Java, and how to apply them.

</backtalk:display>
[&nbsp;<a href='http://www.mindview.net/backtalk/CommentServlet?ID=TIJ3_INTRO_I45' 
  target="_blank">Add&nbsp;Comment</a>&nbsp;]

<backtalk:display ID=TIJ3_INTRO_I46>
</FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B><I>Chapter
7:	Polymorphism</I></B></FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">On your own, you might take nine months
to discover and understand polymorphism, a cornerstone of OOP. Through small,
simple examples you&#8217;ll see how to create a family of types with
inheritance and manipulate objects in that family through their common base
class. Java&#8217;s polymorphism allows you to treat all objects in this family
generically, which means the bulk of your code doesn&#8217;t rely on specific
type information. This makes your programs extensible, so building programs and
code maintenance is easier and
cheaper.
</backtalk:display>
[&nbsp;<a href='http://www.mindview.net/backtalk/CommentServlet?ID=TIJ3_INTRO_I46' 
  target="_blank">Add&nbsp;Comment</a>&nbsp;]

<backtalk:display ID=TIJ3_INTRO_I47>
</FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B><I>Chapter 8:	Interfaces &amp; Inner
Classes</I></B></FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">Java provides a third way to set up a
reuse relationship, through the <I>interface</I>, which is a pure abstraction of
the interface of an object. The <B>interface </B>is more than just an abstract
class taken to the extreme, since it allows you to perform a variation on
C++&#8217;s &#8220;multiple inheritance,&#8221; by creating a class that can be
upcast to more than one base
type.<A NAME="Intro"></A>
</backtalk:display>
[&nbsp;<a href='http://www.mindview.net/backtalk/CommentServlet?ID=TIJ3_INTRO_I47' 
  target="_blank">Add&nbsp;Comment</a>&nbsp;]

<backtalk:display ID=TIJ3_INTRO_I48>
</FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">At first, inner classes look like a
simple code hiding mechanism: you place classes inside other classes.
You&#8217;ll learn, however, that the inner class does more than that&#8212;it
knows about and can communicate with the surrounding class&#8212;and that the
kind of code you can write with inner classes is more elegant and clear,
although it is a new concept to most and takes some time to become comfortable
with design using inner
classes.
</backtalk:display>
[&nbsp;<a href='http://www.mindview.net/backtalk/CommentServlet?ID=TIJ3_INTRO_I48' 
  target="_blank">Add&nbsp;Comment</a>&nbsp;]

<backtalk:display ID=TIJ3_INTRO_I49>
</FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B><I>Chapter 9:	Holding your Objects
</I></B></FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">It&#8217;s a fairly simple program that
has only a fixed quantity of objects with known lifetimes. In general, your
programs will always be creating new objects at a variety of times that will be
known only while the program is running. In addition, you won&#8217;t know until
run-time the quantity or even the exact type of the objects you need. To solve
the general programming problem, you need to create any number of objects,
anytime, anywhere. This chapter explores in depth the container library that
Java 2 supplies to hold objects while you&#8217;re working with them: the simple

⌨️ 快捷键说明

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