73752
73752
https://ebookultra.com/download/beginning-java-7-1st-edition-jeff-
friesen/
https://ebookultra.com/download/beginning-joomla-from-novice-to-
professional-dan-rahmel/
https://ebookultra.com/download/beginning-ruby-from-novice-to-
professional-3rd-edition-peter-cooper/
Beginning Databases with PostgreSQL From Novice to
Professional 2nd Edition Matthew
https://ebookultra.com/download/beginning-databases-with-postgresql-
from-novice-to-professional-2nd-edition-matthew/
https://ebookultra.com/download/beginning-portable-shell-scripting-
from-novice-to-professional-1st-edition-peter-seebach/
https://ebookultra.com/download/beginning-openoffice-3-from-novice-to-
professional-1st-edition-andy-channelle-auth/
https://ebookultra.com/download/beginning-microsoft-word-business-
documents-beginning-from-novice-to-professional-1st-edition-james-j-
marshall/
https://ebookultra.com/download/beginning-sql-server-2000-dba-from-
novice-to-professional-1st-edition-tony-bain/
Beginning Java SE 6 Platform From Novice to
Professional 1st Edition Jeff Friesen Digital Instant
Download
Author(s): Jeff Friesen
ISBN(s): 9781590598306, 159059830X
Edition: 1
File Details: PDF, 2.94 MB
Year: 2007
Language: english
CYAN YELLOW
MAGENTA BLACK
PANTONE 123 C
Empowering Productivity for the JavA™ Developer The EXPERT’s VOIce ® in Java™ Technology
Companion eBook
Author of Available
Includes
Includes
Java 2 By Example,
Second Edition
Beginning Java SE 6 Platform: ™
Java™™ SE 7
Beginning Preview
From Novice to Professional
Java SE 6 Platform
Dear Reader,
Every two years or so, Sun releases a major update to the Java™ platform, and
Beginning
Java SE 6
each update introduces new features and improves on existing features. This
book covers the key new features in Java SE 6—ranging from the core libraries
to security and web services.
As a busy professional, you need easy access to key information. This book
tells you precisely what distinguishes Java SE 6 from its predecessors. In the ™
first chapter, I introduce you to Java SE 6 in a broad sweep. The following chap-
ters drill down to specific features of Java SE 6 by topic areas, such as JDBC™,
™
scripting, Swing, and the Abstract Windowing Toolkit (AWT). Each chapter
wraps up with a “Test Your Understanding” section, which challenges your
Platform
grasp of its topic area. An appendix provides complete answers to those ques-
tions. Other appendices summarize Java SE 6 annotation types, tools, and per-
formance enhancements.
While you’re here to learn about the features of Java SE 6, you may also want
to get an idea of what’s coming up in Java SE 7. So I include a preview of Java SE
7. You’ll find out about upcoming language features such as closures, and API
changes such as the Swing Application Framework.
My goal is to give you a fast and secure knowledge of Java SE 6 today, and
insight into what you can expect in the future, so you can feel confident with
Java for the years to come. From Novice to Professional
Jeff Friesen
US $39.99
Shelve in
Java Programming
this print for content only—size & color not accurate spine = 0.969" 512 page count
830-X FM.qxd 10/2/07 9:11 PM Page i
Beginning Java™ SE 6
Platform
From Novice to Professional
Jeff Friesen
830-X FM.qxd 10/2/07 9:11 PM Page ii
Contents at a Glance
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi
About the Technical Reviewers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
v
7f672e752e259312b9d0e126a4b50034
830-X FM.qxd 10/2/07 9:11 PM Page vi
830-X FM.qxd 10/2/07 9:11 PM Page vii
Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi
About the Technical Reviewers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
viii ■CONTENTS
■CONTENTS ix
x ■CONTENTS
■CONTENTS xi
xii ■CONTENTS
■CONTENTS xiii
■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
830-X FM.qxd 10/2/07 9:11 PM Page xiv
830-X FM.qxd 10/2/07 9:11 PM Page xv
Preface
xv
830-X FM.qxd 10/2/07 9:11 PM Page xvi
■JEFF FRIESEN has been actively involved with Java since the late 1990s. Jeff has worked
with Java in various companies, including a health-care–oriented consulting firm, where
he created his own Java/C++ software for working with smart cards. Jeff has written about
Java in numerous articles for JavaWorld.com, informit.com, and java.net, and has
authored Java 2 by Example, Second Edition (Que Publishing). Jeff has also taught Java in
university and college continuing education classes. He has a Bachelor of Science degree
in mathematics and computer science from Brandon University in Brandon, Manitoba,
Canada.
xvi
830-X FM.qxd 10/2/07 9:11 PM Page xvii
■JOHN ZUKOWSKI performs strategic Java consulting for JZ Ventures, Inc. He regularly con-
tributes to Sun’s monthly Tech Tips column and Java Technology Fundamentals
newsletter. In addition, John monitors IBM’s client-side Java programming forum at
developerWorks. Since the beginning of Java time, John has authored ten books solo and
contributed to several others. His best sellers include three editions each of the Definitive
Guide to Swing (Apress) and Mastering Java 2 (Sybex), and his latest, the predecessor to
this book, Java 6 Platform Revealed (Apress).
xvii
830-X FM.qxd 10/2/07 9:11 PM Page xviii
Acknowledgments
I thank Steve Anglin for giving me the opportunity to continue my exploration of Java SE 6
via this book. I also thank Richard Dal Porto for guiding me through various aspects of
the writing process. Thank you Sumit and John for your diligence in catching various
flaws (including some embarrassing ones) that would otherwise have made it into this
book. Finally, I thank Marilyn Smith, Elizabeth Berry, and April Eddy for making the
book’s content look good.
xviii
830-X FM.qxd 10/2/07 9:11 PM Page xix
Introduction
W elcome to Beginning Java SE 6 Platform. Contrary to its title, this is not another
beginner-oriented book on Java. You will not learn about classes, threads, file I/O, and
other fundamental topics. If learning Java from scratch is your objective, you will need
to find another book. But if you need to know (or if you just happen to be curious about)
what makes Java SE 6 stand apart from its predecessors, this book is for you.
This book starts you on a journey of exploration into most of Java SE 6’s new and
improved features. Unfortunately, various constraints kept me from covering every fea-
ture, including the JavaBeans Activation Framework (<<sigh>>).
While you learn about these features, you’ll also encounter exciting technologies,
such as JRuby and JavaFX, and even catch a glimpse of Java SE 7. You’ll also find numer-
ous questions and exercises that challenge your understanding of Java SE 6, and
numerous links to web resources for continuing this journey.
Beginning Java SE 6 Platform is a must-have resource if you want to quickly upgrade
your skills. It is also the right choice if you need information about performance and
other important topics before deciding if your company should upgrade to Java SE 6. This
book will save you from wading through Java SE Development Kit (JDK) documentation
and performing a lot of Internet searches.
Authors have idiosyncrasies; I am no different. For starters, although you’ll often find
links to various resources, I do not include links to entries in Sun’s Bug Database. Rather
than present individual links, I present bug identifiers and their names (Bug 6362451
“The string returned by toString() shows the bridge methods as having the volatile modi-
ficator,” for example). If you want to find information about a bug, point your browser to
http://bugs.sun.com/bugdatabase/index.jsp, enter the bug identifier in the appropriate
field, and perform a search. In addition to the appropriate database entry appearing at
the start of the search results, other results point you to related items that can enhance
your understanding of a particular bug topic.
Other idiosyncrasies that you’ll discover include my placing a // filename.java com-
ment at the start of a source file (I forget the reason why I started to do this; old habits die
hard), placing space characters between method names and their argument/parameter
lists in source listings, importing everything from a package (import java.awt.*;, for
example), limiting my comments in source listings, bolding certain parts of source list-
ings to emphasize them, and adding the package name (unless the package is java.lang)
to the first mention of a class or an interface in the text.
xix
Other documents randomly have
different content
millions,) is a fearful tax to fall at hap-hazard on their heads. The
debt which purchased our independence was but of eighty millions,
of which twenty years of taxation had in 1809 paid but the one half.
And what have we purchased with this tax of two hundred millions
which we are to pay by wholesale but usury, swindling, and new
forms of demoralization. Revolutionary history has warned us of the
probable moment when this baseless trash is to receive its fiat.
Whenever so much of the precious metals shall have returned into
the circulation as that every one can get some in exchange for his
produce, paper, as in the revolutionary war, will experience at once
an universal rejection. When public opinion changes, it is with the
rapidity of thought. Confidence is already on the totter, and every
one now handles this paper as if playing at Robin's alive. That in the
present state of the circulation the banks should resume payments
in specie, would require their vaults to be like the widow's cruise.
The thing to be aimed at is, that the excesses of their emissions
should be withdrawn as gradually, but as speedily, too, as is
practicable, without so much alarm as to bring on the crisis dreaded.
Some banks are said to be calling in their paper. But ought we to let
this depend on their discretion? Is it not the duty of the legislature
to endeavor to avert from their constituents such a catastrophe as
the extinguishment of two hundred millions of paper in their hands?
The difficulty is indeed great; and the greater, because the patient
revolts against all medicine. I am far from presuming to say that any
plan can be relied on with certainty, because the bubble may burst
from one moment to another; but if it fails, we shall be but where
we should have been without any effort to save ourselves. Different
persons, doubtless, will devise different schemes of relief. One would
be to suppress instantly the currency of all paper not issued under
the authority of our own State or of the General Government; to
interdict after a few months the circulation of all bills of five dollars
and under; after a few months more, all of ten dollars and under;
after other terms, those of twenty, fifty, and so on to one hundred
dollars, which last, if any must be left in circulation, should be the
lowest denomination. These might be a convenience in mercantile
transactions and transmissions, and would be excluded by their size
from ordinary circulation. But the disease may be too pressing to
await such a remedy. With the legislature I cheerfully leave it to
apply this medicine, or no medicine at all. I am sure their intentions
are faithful; and embarked in the same bottom, I am willing to swim
or sink with my fellow citizens. If the latter is their choice, I will go
down with them without a murmur. But my exhortation would rather
be "not to give up the ship."
I am a great friend to the improvements of roads, canals, and
schools. But I wish I could see some provision for the former as solid
as that of the latter,—something better than fog. The literary fund is
a solid provision, unless lost in the impending bankruptcy. If the
legislature would add to that a perpetual tax of a cent a head on the
population of the State, it would set agoing at once, and forever
maintain, a system of primary or ward schools, and an university
where might be taught, in its highest degree, every branch of
science useful in our time and country; and it would rescue us from
the tax of toryism, fanaticism, and indifferentism to their own State,
which we now send our youth to bring from those of New England.
If a nation expects to be ignorant and free, in a state of civilization,
it expects what never was and never will be. The functionaries of
every government have propensities to command at will the liberty
and property of their constituents. There is no safe deposit for these
but with the people themselves; nor can they be safe with them
without information. Where the press is free, and every man able to
read, all is safe. The frankness of this communication will, I am sure,
suggest to you a discreet use of it. I wish to avoid all collisions of
opinion with all mankind. Show it to Mr. Maury, with expressions of
my great esteem. It pretends to convey no more than the opinions
of one of your thousand constituents, and to claim no more
attention than every other of that thousand.
I will ask you once more to take care of Miller and our College, and
to accept assurances of my esteem and respect.
TO CHARLES THOMPSON.
TO JOHN ADAMS.
Dear Sir,—Of the last five months I have passed four at my other
domicil, for such it is in a considerable degree. No letters are
forwarded to me there, because the cross post to that place is
circuitous and uncertain; during my absence, therefore, they are
accumulating here, and awaiting acknowledgments. This has been
the fate of your favor of November 13th.
I agree with you in all its eulogies on the eighteenth century. It
certainly witnessed the sciences and arts, manners and morals,
advanced to a higher degree than the world had ever before seen.
And might we not go back to the æra of the Borgias, by which time
the barbarous ages had reduced national morality to its lowest point
of depravity, and observe that the arts and sciences, rising from that
point, advanced gradually through all the sixteenth, seventeenth and
eighteenth centuries, softening and correcting the manners and
morals of man? I think, too, we may add to the great honor of
science and the arts, that their natural effect is, by illuminating
public opinion, to erect it into a censor, before which the most
exalted tremble for their future, as well as present fame. With some
exceptions only, through the seventeenth and eighteenth centuries,
morality occupied an honorable chapter in the political code of
nations. You must have observed while in Europe, as I thought I did,
that those who administered the governments of the greater powers
at least, had a respect to faith, and considered the dignity of their
government as involved in its integrity. A wound indeed was inflicted
on this character of honor in the eighteenth century by the partition
of Poland. But this was the atrocity of a barbarous government
chiefly, in conjunction with a smaller one still scrambling to become
great, while one only of those already great, and having character to
lose, descended to the baseness of an accomplice in the crime.
France, England, Spain, shared in it only inasmuch as they stood
aloof and permitted its perpetration.
How then has it happened that these nations, France especially and
England, so great, so dignified, so distinguished by science and the
arts, plunged all at once into all the depths of human enormity,
threw off suddenly and openly all the restraints of morality, all
sensation to character, and unblushingly avowed and acted on the
principle that power was right? Can this sudden apostasy from
national rectitude be accounted for? The treaty of Pilnitz seems to
have begun it, suggested perhaps by the baneful precedent of
Poland. Was it from the terror of monarchs, alarmed at the light
returning on them from the west, and kindling a volcano under their
thrones? Was it a combination to extinguish that light, and to bring
back, as their best auxiliaries, those enumerated by you, the
Sorbonne, the Inquisition, the Index Expurgatorius, and the knights
of Loyola? Whatever it was, the close of the century saw the moral
world thrown back again to the age of the Borgias, to the point from
which it had departed three hundred years before. France, after
crushing and punishing the conspiracy of Pilnitz, went herself deeper
and deeper into the crimes she had been chastising. I say France
and not Bonaparte; for, although he was the head and mouth, the
nation furnished the hands which executed his enormities. England,
although in opposition, kept full pace with France, not indeed by the
manly force of her own arms, but by oppressing the weak and
bribing the strong. At length the whole choir joined and divided the
weaker nations among them. Your prophecies to Dr. Price proved
truer than mine; and yet fell short of the fact, for instead of a
million, the destruction of eight or ten millions of human beings has
probably been the effect of these convulsions. I did not, in '89,
believe they would have lasted so long, nor have cost so much
blood. But although your prophecy has proved true so far, I hope it
does not preclude a better final result. That same light from our
west seems to have spread and illuminated the very engines
employed to extinguish it. It has given them a glimmering of their
rights and their power. The idea of representative government has
taken root and growth among them. Their masters feel it, and are
saving themselves by timely offers of this modification of their
powers. Belgium, Prussia, Poland, Lombardy, &c., are now offered a
representative organization; illusive probably at first, but it will grow
into power in the end. Opinion is power, and that opinion will come.
Even France will yet attain representative government. You observe
it makes the basis of every constitution which has been demanded
or offered,—of that demanded by their Senate; of that offered by
Bonaparte; and of that granted by Louis XVIII. The idea then is
rooted, and will be established, although rivers of blood may yet
flow between them and their object. The allied armies now couching
upon them are first to be destroyed, and destroyed they will surely
be. A nation united can never be conquered. We have seen what the
ignorant, bigoted and unarmed Spaniards could do against the
disciplined veterans of their invaders. What then may we not expect
from the power and character of the French nation? The oppressors
may cut off heads after heads, but like those of the Hydra they
multiply at every stroke. The recruits within a nation's own limits are
prompt and without number; while those of their invaders from a
distance are slow, limited, and must come to an end. I think, too, we
perceive that all these allies do not see the same interest in the
annihilation of the power of France. There are certainly some
symptoms of foresight in Alexander that France might produce a
salutary diversion of force were Austria and Prussia to become her
enemies. France, too, is the neutral ally of the Turk, as having no
interfering interests, and might be useful in neutralizing and perhaps
turning that power on Austria. That a re-acting jealousy, too, exists
with Austria and Prussia, I think their late strict alliance indicates;
and I should not wonder if Spain should discover a sympathy with
them. Italy is so divided as to be nothing. Here then we see new
coalitions in embryo, which, after France shall in turn have suffered
a just punishment for her crimes, will not only raise her from the
earth on which she is prostrate, but give her an opportunity to
establish a government of as much liberty as she can bear—enough
to ensure her happiness and prosperity. When insurrection begins,
be it where it will, all the partitioned countries will rush to arms, and
Europe again become an arena of gladiators. And what is the
definite object they will propose? A restoration certainly of the status
quo prius, of the state of possession of '89. I see no other principle
on which Europe can ever again settle down in lasting peace. I hope
your prophecies will go thus far, as my wishes do, and that they, like
the former, will prove to have been the sober dictates of a superior
understanding, and a sound calculation of effects from causes well
understood. Some future Morgan will then have an opportunity of
doing you justice, and of counterbalancing the breach of confidence
of which you so justly complain, and in which no one has had more
frequent occasion of fellow-feeling than myself. Permit me to place
here my affectionate respects to Mrs. Adams, and to add for yourself
the assurances of cordial friendship and esteem.
TO DABNEY CARR.
Sir,—Of the last five months, I have been absent four from home,
which must apologize for so very late an acknowledgment of your
favor of November 22d, and I wish the delay could be compensated
by the matter of the answer. But an unfortunate accident puts that
out of my power. During the course of my public life, and from a
very early period of it, I omitted no opportunity of procuring
vocabularies of the Indian languages, and for that purpose formed a
model expressing such objects in nature as must be familiar to every
people, savage or civilized. This being made the standard to which
all were brought, would exhibit readily whatever affinities of
language there be between the several tribes. It was my intention,
on retiring from public business, to have digested these into some
order, so as to show not only what relations of language existed
among our own aborigines, but by a collation with the great Russian
vocabulary of the languages of Europe and Asia, whether there were
any between them and the other nations of the continent. On my
removal from Washington, the package in which this collection was
coming by water, was stolen and destroyed. It consisted of between
thirty and forty vocabularies, of which I can, from memory, say
nothing particular; but that I am certain more than half of them
differed as radically, each from every other, as the Greek, the Latin,
and Islandic. And even of those which seemed to be derived from
the same radix, the departure was such that the tribes speaking
them could not probably understand one another. Single words, or
two or three together, might perhaps be understood, but not a
whole sentence of any extent or construction. I think, therefore, the
pious missionaries who shall go to the several tribes to instruct them
in the Christian religion, will have to learn a language for every tribe
they go to; nay, more, that they will have to create a new language
for every one, that is to say, to add to theirs new words for the new
ideas they will have to communicate. Law, medicine, chemistry,
mathematics, every science has a language of its own, and divinity
not less than others. Their barren vocabularies cannot be vehicles
for ideas of the fall of man, his redemption, the triune composition
of the Godhead, and other mystical doctrines considered by most
Christians of the present date as essential elements of faith. The
enterprise is therefore arduous, but the more inviting perhaps to
missionary zeal, in proportion as the merit of surmounting it will be
greater. Again repeating my regrets that I am able to give so little
satisfaction on the subject of your inquiry, I pray you to accept the
assurance of my great consideration and esteem.
And if the Wise be the happy man, as these sages say, he must be
virtuous too; for, without virtue, happiness cannot be. This then is
the true scope of all academical emulation.
You request something in the handwriting of General Washington. I
enclose you a letter which I received from him while in Paris,
covering a copy of the new Constitution; it is offered merely as what
you ask, a specimen of his handwriting.
On the subject of your Museum, I fear I cannot flatter myself with
being useful to it. Were the obstacle of distance out of the way, age
and retirement have withdrawn me from the opportunities of
procuring objects in that line. With every wish for the prosperity of
your institution, accept the assurances of my great esteem and
respect.
TO NATHANIEL MACON.
TO JOSEPH C. CABELL.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookultra.com