100% found this document useful (1 vote)
21 views

Java For Dummies 4th Edition Barry Burd - The 2025 ebook edition is available with updated content

The document provides information on how to download the 4th edition of 'Java For Dummies' by Barry Burd, along with links to other related ebooks and textbooks. It includes details about the author, the book's content, and its organization, covering topics from basic Java programming to advanced techniques. Additionally, it outlines the book's publication details and copyright information.

Uploaded by

zadiantcach
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
21 views

Java For Dummies 4th Edition Barry Burd - The 2025 ebook edition is available with updated content

The document provides information on how to download the 4th edition of 'Java For Dummies' by Barry Burd, along with links to other related ebooks and textbooks. It includes details about the author, the book's content, and its organization, covering topics from basic Java programming to advanced techniques. Additionally, it outlines the book's publication details and copyright information.

Uploaded by

zadiantcach
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

Visit https://ebookultra.

com to download the full version and


explore more ebooks or textbooks

Java For Dummies 4th Edition Barry Burd

_____ Click the link below to download _____


https://ebookultra.com/download/java-for-dummies-4th-
edition-barry-burd/

Explore and download more ebooks or textbooks at ebookultra.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Beginning Programming with Java For Dummies 4th Edition


Barry Burd

https://ebookultra.com/download/beginning-programming-with-java-for-
dummies-4th-edition-barry-burd/

Beginning Programming with Java for Dummies 5th Edition


Barry Burd

https://ebookultra.com/download/beginning-programming-with-java-for-
dummies-5th-edition-barry-burd/

Ruby on Rails For Dummies 1st Edition Burd

https://ebookultra.com/download/ruby-on-rails-for-dummies-1st-edition-
burd/

Java All in One For Dummies 4th Edition Lowe

https://ebookultra.com/download/java-all-in-one-for-dummies-4th-
edition-lowe/
Wireless Networks For Dummies 1st Edition Barry D. Lewis

https://ebookultra.com/download/wireless-networks-for-dummies-1st-
edition-barry-d-lewis/

Technical Math For Dummies 1. Auflage Edition Barry


Schoenborn

https://ebookultra.com/download/technical-math-for-dummies-1-auflage-
edition-barry-schoenborn/

Java For Dummies Quick Reference 1st Edition Doug Lowe

https://ebookultra.com/download/java-for-dummies-quick-reference-1st-
edition-doug-lowe/

Bartending For Dummies 4E For Dummies Cooking 4th Edition


Ray Foley

https://ebookultra.com/download/bartending-for-dummies-4e-for-dummies-
cooking-4th-edition-ray-foley/

CISSP For Dummies 4th Edition Miller

https://ebookultra.com/download/cissp-for-dummies-4th-edition-miller/
Java For Dummies 4th Edition Barry Burd Digital
Instant Download
Author(s): Barry Burd
ISBN(s): 9780470087169, 0470087161
Edition: 4
File Details: PDF, 5.44 MB
Year: 2006
Language: english
JavaFOR

DUMmIES

4TH EDITION

by Barry Burd
Java™ For Dummies®, 4th Edition
Published by
Wiley Publishing, Inc.
111 River Street
Hoboken, NJ 07030-5774
www.wiley.com
Copyright © 2007 by Wiley Publishing, Inc., Indianapolis, Indiana
Published by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any
means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under
Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the
Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center,
222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permis-
sion should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis,
IN 46256, (317) 572-3447, fax (317) 572-4355, or online at http://www.wiley.com/go/permissions.
Trademarks: Wiley, the Wiley Publishing logo, For Dummies, the Dummies Man logo, A Reference for the Rest of
Us!, The Dummies Way, Dummies Daily, The Fun and Easy Way, Dummies.com, and related trade dress are trade-
marks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates in the United States and other
countries, and may not be used without written permission. Java is a trademark or registered trademark of Sun
Microsystems, Inc. in the United States and other countries. All other trademarks are the property of their
respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book.

LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESEN-
TATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF
THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES
OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR
PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR
EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED
IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE
IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE
PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN
ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE
OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFOR-
MATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER,
READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DIS-
APPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ.

For general information on our other products and services, please contact our Customer Care Department
within the U.S. at 800-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002.
For technical support, please visit www.wiley.com/techsupport.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be
available in electronic books.
Library of Congress Control Number: 2006934836
ISBN-13: 978-0-470-08716-9
ISBN-10: 0-470-08716-1
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
4O/RX/RR/QW/IN
About the Author
Dr. Barry Burd received an M.S. degree in Computer Science at Rutgers
University and a Ph.D. in Mathematics at the University of Illinois. As a teach-
ing assistant in Champaign-Urbana, Illinois, he was elected five times to the
university-wide List of Teachers Ranked as Excellent by their Students.

Since 1980, Dr. Burd has been a professor in the Department of Mathematics
and Computer Science at Drew University in Madison, New Jersey. When
he’s not lecturing at Drew University, Dr. Burd leads training courses for pro-
fessional programmers in business and industry. He has lectured at confer-
ences in the United States, Europe, Australia, and Asia. He is the author of
several articles and books, including Eclipse For Dummies and Beginning
Programming with Java For Dummies, both from Wiley Publishing, Inc.

Dr. Burd lives in Madison, New Jersey, with his wife and two children. In his
spare time, he enjoys being a workaholic.
Dedication
for

Jennie, Sam, and Harriet,

Ruth and Sam,

Jennie and Benjamin, Katie and Abram,

and Basheva

Author’s Acknowledgments
Thank you again. (You know who you are.)

—Barry Burd
Publisher’s Acknowledgments
We’re proud of this book; please send us your comments through our online registration form
located at www.dummies.com/register/.
Some of the people who helped bring this book to market include the following:

Acquisitions, Editorial, and Media Composition Services


Development Project Coordinator: Erin Smith
Project Editor: Paul Levesque Layout and Graphics: Carl Byers,
Acquisitions Editor: Katie Feltman Lavonne Cook, Denny Hager, Clint Lahnen,
Copy Editor: Mary Lagu and Heidi Unger Barbara Moore, Barry Offringa,
Rashell Smith, Alicia B. South, Ronald Terry
Technical Editor: John Purdum
Proofreaders: Jessica Kramer,
Editorial Manager: Leah Cameron Ethel M. Winslow
Media Development Specialists: Angela Denny, Indexer: Techbooks
Kate Jenkins, Steven Kudirka, Kit Malone
Anniversary Logo Design: Richard Pacifico
Media Development Coordinator: Laura
Atkinson Special Help: Mary Lagu

Media Project Supervisor: Laura Moss


Media Development Manager: Laura
VanWinkle
Editorial Assistant: Amanda Foxworth
Sr. Editorial Assistant: Cherie Case
Cartoons: Rich Tennant (www.the5thwave.com)

Publishing and Editorial for Technology Dummies


Richard Swadley, Vice President and Executive Group Publisher
Andy Cummings, Vice President and Publisher
Mary Bednarek, Executive Acquisitions Director
Mary C. Corder, Editorial Director
Publishing for Consumer Dummies
Diane Graves Steele, Vice President and Publisher
Joyce Pepple, Acquisitions Director
Composition Services
Gerry Fahey, Vice President of Production Services
Debbie Stailey, Director of Composition Services
Contents at a Glance
Introduction .................................................................1
Part I: Getting Started ..................................................9
Chapter 1: All about Java.................................................................................................11
Chapter 2: Running Canned Java Programs..................................................................23
Chapter 3: Using the Basic Building Blocks ..................................................................45

Part II: Writing Your Own Java Programs .....................71


Chapter 4: Making the Most of Variables and Their Values ........................................73
Chapter 5: Controlling Program Flow with Decision-Making Statements ...............101
Chapter 6: Controlling Program Flow with Loops......................................................123

Part III: Working with the Big Picture:


Object-Oriented Programming....................................143
Chapter 7: Thinking in Terms of Classes and Objects ...............................................145
Chapter 8: Saving Time and Money: Reusing Existing Code.....................................173
Chapter 9: Constructing New Objects .........................................................................205

Part IV: Savvy Java Techniques .................................227


Chapter 10: Putting Variables and Methods Where They Belong ............................229
Chapter 11: Using Arrays and Collections to Juggle Values......................................257
Chapter 12: Looking Good When Things Take Unexpected Turns ..........................289

Part V: The Part of Tens ............................................315


Chapter 13: Ten Ways to Avoid Mistakes ....................................................................317
Chapter 14: Ten Sets of Web Resources for Java........................................................323
Appendix A: Using the CD-ROM....................................................................................329

Index .......................................................................339
Bonus Content on the CD
Chapter 15: Sharing Names among the Parts of a Java Program ............................CD1
Chapter 16: Responding to Keystrokes and Mouse Clicks.....................................CD25
Chapter 17: Writing Java Applets ..............................................................................CD39
Chapter 18: Using Java Database Connectivity .......................................................CD51
Appendix B: When to Use Words like “public” and “private” ................................CD63
Table of Contents
Introduction ..................................................................1
How to Use This Book .....................................................................................1
Conventions Used in This Book .....................................................................2
What You Don’t Have to Read ........................................................................2
Foolish Assumptions .......................................................................................3
How This Book Is Organized...........................................................................4
Part I: Getting Started ............................................................................4
Part II: Writing Your Own Java Programs ............................................4
Part III: Working with the Big Picture: Object-Oriented
Programming .......................................................................................4
Part IV: Savvy Java Techniques ............................................................5
Part V: The Part of Tens.........................................................................5
Part VI: Appendices................................................................................5
Bonus Chapters on the CD-ROM!..........................................................5
Icons Used in This Book..................................................................................6
Where to Go from Here....................................................................................7

Part I: Getting Started ...................................................9


Chapter 1: All about Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11
What You Can Do with Java ..........................................................................12
Why You Should Use Java .............................................................................13
Getting Perspective: Where Java Fits In ......................................................14
Object-Oriented Programming (OOP) .........................................................15
Object-oriented languages ..................................................................16
Objects and their classes ....................................................................16
What’s so good about an object-oriented language? .......................18
Refining your understanding of classes and objects .......................20
What’s Next? ...................................................................................................22

Chapter 2: Running Canned Java Programs . . . . . . . . . . . . . . . . . . . . . .23


Downloading and Installing the Java Development Kit (JDK) ..................23
Downloading Java.................................................................................25
Installing Java on your computer.......................................................27
Preparing to Use an Integrated Development Environment.....................30
JCreator .................................................................................................31
Running JCreator for the first time ....................................................31
xii Java For Dummies, 4th Edition

Running Java Programs .................................................................................33


Running a text-based program............................................................34
Running a GUI on its own ....................................................................38
Running a GUI on a Web page (a Java applet) ..................................41

Chapter 3: Using the Basic Building Blocks . . . . . . . . . . . . . . . . . . . . .45


Speaking the Java Language .........................................................................45
The grammar and the common names..............................................46
The words in a Java program..............................................................47
Checking Out Java Code for the First Time ................................................49
Understanding a Simple Java Program........................................................50
The Java class .......................................................................................51
The Java method ..................................................................................52
The main method in a program ..........................................................53
How you finally tell the computer to do something ........................54
Curly braces ..........................................................................................57
And Now, a Few Comments...........................................................................59
Adding comments to your code .........................................................60
What’s Barry’s excuse? ........................................................................63
Finding javadoc pages .........................................................................63
Using comments to experiment with your code ..............................64
Typing Your Own Code..................................................................................65

Part II: Writing Your Own Java Programs ......................71


Chapter 4: Making the Most of Variables and Their Values . . . . . . . .73
Varying a Variable ..........................................................................................73
Assignment Statements .................................................................................75
Understanding the Types of Values That Variables May Have.................76
An Import Declaration ...................................................................................79
Displaying Text ...............................................................................................80
Numbers without Decimal Points ................................................................80
Combining Declarations and Initializing Variables ....................................82
The Atoms: Java’s Primitive Types ..............................................................83
The char type........................................................................................84
The boolean type..................................................................................86
The Molecules and Compounds: Reference Types....................................88
Creating New Values by Applying Operators .............................................92
Initialize once, assign often.................................................................94
The increment and decrement operators .........................................95
Assignment operators .........................................................................99
Table of Contents xiii
Chapter 5: Controlling Program Flow with
Decision-Making Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .101
Making Decisions (Java if Statements)......................................................102
Guess the number ..............................................................................102
She controlled keystrokes from the keyboard................................103
Creating randomness .........................................................................104
The if statement..................................................................................105
The double equal sign .......................................................................106
Brace yourself.....................................................................................107
Indenting if statements in your code ...............................................107
Elseless in Ifrica ..................................................................................108
Forming Conditions with Comparisons and Logical Operators.............109
Comparing numbers; comparing characters..................................109
Comparing objects .............................................................................110
Importing everything in one fell swoop ..........................................113
Java’s logical operators .....................................................................113
Building a Nest..............................................................................................115
Choosing among Many Alternatives (Java switch Statements) .............116
Your basic switch statement.............................................................117
To break or not to break....................................................................121

Chapter 6: Controlling Program Flow with Loops . . . . . . . . . . . . . . . .123


Repeating Instructions Over and Over Again (Java while
Statements) ...............................................................................................124
Repeating a Certain Number of Times (Java for Statements) ................127
The anatomy of a for statement .......................................................128
The world premiere of “Al’s All Wet” ...............................................130
Repeating Until You Get What You Want (Java do Statements) .............131
Reading a single character ................................................................134
File handling in Java...........................................................................135
Variable declarations and blocks .....................................................135
Loops Made Painless ...................................................................................136
Don’t need no stinking counters ......................................................136
Grouping things together ..................................................................138
Anatomy of an enhanced for loop....................................................139

Part III: Working with the Big Picture:


Object-Oriented Programming ....................................143
Chapter 7: Thinking in Terms of Classes and Objects . . . . . . . . . . . .145
Defining a Class (What It Means to Be an Account) ................................145
Declaring variables and creating objects ........................................148
Initializing a variable..........................................................................150
Using variables ...................................................................................150
xiv Java For Dummies, 4th Edition

Compiling and Running More Than One Class.........................................151


Defining a Method within a Class (Displaying an Account) ...................152
An account that displays itself .........................................................153
The display method’s header ...........................................................155
Sending Values to and from Methods (Calculating Interest) ..................155
Passing a value to a method .............................................................158
Returning a value from the getInterest method .............................161
Making numbers look good...............................................................162
Hiding Details with Accessor Methods (Why You Shouldn’t
Micromanage a Bank Teller) ...................................................................165
Good programming ............................................................................166
Public lives and private dreams: Making a variable name
inaccessible .....................................................................................169
Enforcing rules with accessor methods ..........................................170

Chapter 8: Saving Time and Money: Reusing Existing Code . . . . . . .173


Defining a Class (What It Means to Be an Employee)..............................174
The last word on employees.............................................................175
Putting your class to good use .........................................................176
Cutting a check ...................................................................................178
Working with Disk Files (A Brief Detour) ..................................................178
Storing data in a file ...........................................................................179
Copying and pasting code.................................................................181
Reading from a file..............................................................................182
Who moved my file?...........................................................................185
Adding directory names to your filenames.....................................185
Reading a line at a time......................................................................186
Defining Subclasses (What It Means to Be a Full-Time Employee
or a Part-Time Employee) .......................................................................188
Creating a subclass ............................................................................190
Creating subclasses is habit-forming...............................................192
Using Subclasses ..........................................................................................193
A program for the minimalist............................................................194
A program for the maximalist...........................................................196
Overriding Existing Methods (Changing the Payments for Some
of Your Employees) ..................................................................................199

Chapter 9: Constructing New Objects . . . . . . . . . . . . . . . . . . . . . . . . . .205


Defining Constructors (What It Means to Be a Temperature)................206
What is a temperature?......................................................................206
What you can do with a temperature ..............................................208
Calling new Temperature (32.0): A case study ...............................209
enum types as first-class citizens.....................................................212
Some things never change ................................................................213
Table of Contents xv
More Subclasses (Doing Something about the Weather) .......................214
Building better temperatures ...........................................................214
Constructors for subclasses .............................................................216
Using all this stuff...............................................................................217
The default constructor ....................................................................218
An invisible constructor call.............................................................220
A Constructor That Does More ..................................................................222

Part IV: Savvy Java Techniques ..................................227


Chapter 10: Putting Variables and Methods Where They Belong . . . .229
Defining a Class (What It Means to Be a Baseball Player) ......................230
Another way to beautify your numbers ..........................................231
Using the Player class........................................................................231
Nine, count ’em, nine .........................................................................233
Don’t get all GUI on me ......................................................................234
Tossing an exception from method to method ..............................235
Making Static (Finding the Team Average) ...............................................236
Why is there so much static?............................................................238
Displaying the overall team average................................................239
Static is old hat ...................................................................................242
Could cause static; handle with care ...............................................242
Experiments with Variables ........................................................................243
Putting a variable in its place ...........................................................244
Telling a variable where to go...........................................................247
Passing Parameters......................................................................................250
Pass by value ......................................................................................250
Returning a result ...............................................................................252
Pass by reference ...............................................................................252
Returning an object from a method .................................................254
Epilogue ...............................................................................................256

Chapter 11: Using Arrays and Collections to Juggle Values . . . . . . .257


Getting Your Ducks All in a Row.................................................................257
Creating an array in two easy steps.................................................260
Storing values .....................................................................................261
Tab stops and other special things..................................................263
Using an array initializer ...................................................................264
Stepping through an array with the enhanced for loop ................264
Searching .............................................................................................266
Arrays of Objects .........................................................................................269
Using the Room class.........................................................................271
Yet another way to beautify your numbers ....................................274
The conditional operator ..................................................................275
xvi Java For Dummies, 4th Edition

Command Line Arguments..........................................................................275


Using command line arguments in a Java program .......................276
Checking for the right number of command line arguments........278
Setting up JCreator for command line arguments .........................279
Using Java Collections.................................................................................282
Collection classes to the rescue.......................................................283
Using an ArrayList ..............................................................................283
Using generics (hot stuff!) .................................................................286
Testing for the presence of more data.............................................286

Chapter 12: Looking Good When Things Take Unexpected Turns . . .289
Handling Exceptions ....................................................................................290
The parameter in a catch clause ......................................................294
Exception types ..................................................................................295
Who’s going to catch the exception? ...............................................297
Throwing caution to the wind ..........................................................304
Doing useful things.............................................................................304
Our friends, the good exceptions.....................................................306
Handle an Exception or Pass the Buck......................................................306
Finishing the Job with a finally Clause ......................................................311

Part V: The Part of Tens .............................................315


Chapter 13: Ten Ways to Avoid Mistakes . . . . . . . . . . . . . . . . . . . . . . .317
Putting Capital Letters Where They Belong .............................................317
Breaking Out of a switch Statement...........................................................318
Comparing Values with a Double Equal Sign ............................................318
Adding Components to a GUI .....................................................................318
Adding Listeners to Handle Events............................................................319
Defining the Required Constructors..........................................................319
Fixing Non-Static References ......................................................................319
Staying within Bounds in an Array ............................................................320
Anticipating Null Pointers...........................................................................320
Helping Java Find Its Files ...........................................................................321

Chapter 14: Ten Sets of Web Resources for Java . . . . . . . . . . . . . . . .323


The Horse’s Mouth.......................................................................................323
Finding News, Reviews, and Sample Code ................................................324
Improving Your Code with Tutorials .........................................................324
Finding Help on Newsgroups......................................................................324
Checking the FAQs for Useful Info..............................................................325
Reading Documentation with Additional Commentary ..........................325
Opinions and Advocacy ..............................................................................325
Table of Contents xvii
Looking for Java Jobs ..................................................................................326
Becoming Certified in Java .........................................................................326
Everyone’s Favorite Sites ............................................................................326

Appendix A: Using the CD-ROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .329


What You Can Expect to Find on the CD-ROM .........................................329
System Requirements ..................................................................................330
Using the CD with Microsoft Windows......................................................331
Using the CD with Mac OS...........................................................................332
Running the Java Code That’s in This Book .............................................333
Freeware, Shareware, and Just Plain Ware................................................334
JCreator ...............................................................................................334
Adobe Acrobat Reader ......................................................................335
Jindent .................................................................................................336
NetCaptor ............................................................................................336
WinOne ................................................................................................336
And, If You Run into Any Trouble . . ..........................................................337

Index........................................................................339

End-User License Agreement ......................................361

Bonus Content on the CD


Chapter 15: Sharing Names among the Parts of a Java Program . . .CD1
Access Modifiers .........................................................................................CD2
Classes, Access, and Multipart Programs................................................CD3
Members versus classes ..................................................................CD3
Access modifiers for members........................................................CD4
Putting a drawing on a frame...........................................................CD7
Directory structure ...........................................................................CD9
Using Java packages in JCreator ...................................................CD10
Making a frame ................................................................................CD12
Sneaking Away from the Original Code ..................................................CD13
Default access ..................................................................................CD15
Crawling back into the package ....................................................CD17
Protected Access ......................................................................................CD19
Putting non-subclasses in the same package ..............................CD20
Access Modifiers for Java Classes ..........................................................CD22
Public classes ..................................................................................CD23
Nonpublic classes ...........................................................................CD23
xviii Java For Dummies, 4th Edition

Chapter 16: Responding to Keystrokes and Mouse Clicks . . . . . . .CD25


Go On . . . Click That Button ....................................................................CD25
Events and event handling.............................................................CD28
The Java interface ...........................................................................CD28
Threads of execution ......................................................................CD30
The keyword this.............................................................................CD31
Inside the actionPerformed method.............................................CD32
Responding to Things Other Than Button Clicks .................................CD32

Chapter 17: Writing Java Applets . . . . . . . . . . . . . . . . . . . . . . . . . . . .CD39


Applets 101 ................................................................................................CD39
Waiting to be called.........................................................................CD41
A public class...................................................................................CD41
The Java API (again) .......................................................................CD42
Making Things Move.................................................................................CD43
The methods in an applet ..............................................................CD45
What to put into all these methods ..............................................CD45
Responding to Events in an Applet.........................................................CD47

Chapter 18: Using Java Database Connectivity . . . . . . . . . . . . . . . .CD51


Telling the System about Your Database ...............................................CD51
Creating Data .............................................................................................CD55
Using SQL commands .....................................................................CD57
Connecting and disconnecting ......................................................CD57
Retrieving Data ..........................................................................................CD59

Appendix B: When to Use Words like “public” and “private” . . .CD63


Members versus Classes..........................................................................CD63
Access Modifiers for Members................................................................CD64
Default access ..................................................................................CD65
Protected access .............................................................................CD68
Access Modifiers for Classes ...................................................................CD71
Introduction
J ava is good stuff. I’ve been using it for years. I like Java because it’s very
orderly. Almost everything follows simple rules. The rules can seem intim-
idating at times, but this book is here to help you figure them out. So, if you
want to use Java and want an alternative to the traditional techie, soft-cover
book, sit down, relax, and start reading Java For Dummies, 4th Edition.

How to Use This Book


I wish I could say, “Open to a random page of this book and start writing Java
code. Just fill in the blanks and don’t look back.” In a sense, this is true. You
can’t break anything by writing Java code, so you’re always free to experiment.

But let me be honest. If you don’t understand the bigger picture, writing a
program is difficult. That’s true with any computer programming language —
not just Java. If you’re typing code without knowing what it’s about, and the
code doesn’t do exactly what you want it to do, you’re just plain stuck.

So, in this book, I divide Java programming into manageable chunks. Each
chunk is (more or less) a chapter. You can jump in anywhere you want —
Chapter 5, Chapter 10, or wherever. You can even start by poking around in
the middle of a chapter. I’ve tried to make the examples interesting without
making one chapter depend on another. When I use an important idea from
another chapter, I include a note to help you find your way around.

In general, my advice is as follows:

⻬ If you already know something, don’t bother reading about it.


⻬ If you’re curious, don’t be afraid to skip ahead. You can always sneak a
peek at an earlier chapter if you really need to do so.
2 Java For Dummies, 4th Edition

Conventions Used in This Book


Almost every technical book starts with a little typeface legend, and Java For
Dummies, 4th Edition, is no exception. What follows is a brief explanation of
the typefaces used in this book:

⻬ New terms are set in italics.


⻬ If you need to type something that’s mixed in with the regular text, the
characters you type appear in bold. For example: “Type MyNewProject
in the text field.”
⻬ You also see this computerese font. I use computerese for Java code,
filenames, Web page addresses (URLs), on-screen messages, and other
such things. Also, if something you need to type is really long, it appears
in computerese font on its own line (or lines).
⻬ You need to change certain things when you type them on your own
computer keyboard. For instance, I may ask you to type
public class Anyname
which means that you type public class and then some name that you
make up on your own. Words that you need to replace with your own
words are set in italicized computerese.

What You Don’t Have to Read


Pick the first chapter or section that has material you don’t already know and
start reading there. Of course, you may hate making decisions as much as I
do. If so, here are some guidelines that you can follow:

⻬ If you already know what kind of an animal Java is and know that you
want to use Java, skip Chapter 1 and go straight to Chapter 2. Believe
me, I won’t mind.
⻬ If you already know how to get a Java program running, skip Chapter 2
and start with Chapter 3.
⻬ If you write programs for a living but use any language other than C or
C++, start with Chapter 2 or 3. When you reach Chapters 5 and 6, you’ll
probably find them to be easy reading. When you get to Chapter 7, it’ll
be time to dive in.
⻬ If you write C (not C++) programs for a living, start with Chapters 3 and 4
but just skim Chapters 5 and 6.
Introduction 3
⻬ If you write C++ programs for a living, glance at Chapter 3, skim Chapters
4 through 6, and start reading seriously in Chapter 7. (Java is a bit differ-
ent from C++ in the way it handles classes and objects.)
⻬ If you write Java programs for a living, come to my house and help me
write Java For Dummies, 5th Edition.

If you want to skip the sidebars and the Technical Stuff icons, please do. In
fact, if you want to skip anything at all, feel free.

Foolish Assumptions
In this book, I make a few assumptions about you, the reader. If one of these
assumptions is incorrect, you’re probably okay. If all these assumptions are
incorrect . . . well, buy the book anyway.

⻬ I assume that you have access to a computer. Here’s the good news:
You can run the code in this book on almost any computer. The only
computers that you can’t use to run this code are ancient things that are
more than six years old (give or take a few years).
⻬ I assume that you can navigate through your computer’s common
menus and dialog boxes. You don’t have to be a Windows, Unix, or
Macintosh power user, but you should be able to start a program, find a
file, put a file into a certain directory . . . that sort of thing. Most of the
time, when you practice the stuff in this book, you’re typing code on
your keyboard, not pointing and clicking your mouse.
On those rare occasions when you need to drag and drop, cut and paste,
or plug and play, I guide you carefully through the steps. But your com-
puter may be configured in any of several billion ways, and my instructions
may not quite fit your special situation. So, when you reach one of these
platform-specific tasks, try following the steps in this book. If the steps
don’t quite fit, consult a book with instructions tailored to your system.
⻬ I assume that you can think logically. That’s all there is to programming
in Java — thinking logically. If you can think logically, you’ve got it made.
If you don’t believe that you can think logically, read on. You may be
pleasantly surprised.
⻬ I make very few assumptions about your computer programming
experience (or your lack of such experience). In writing this book, I’ve
tried to do the impossible. I’ve tried to make the book interesting for
experienced programmers, yet accessible to people with little or no pro-
gramming experience. This means that I don’t assume any particular
programming background on your part. If you’ve never created a loop or
indexed an array, that’s okay.
4 Java For Dummies, 4th Edition

On the other hand, if you’ve done these things (maybe in Visual Basic,
COBOL, or C++), you’ll discover some interesting plot twists in Java. The
developers of Java took the best ideas in object-oriented programming,
streamlined them, reworked them, and reorganized them into a sleek,
powerful way of thinking about problems. You’ll find many new, thought-
provoking features in Java. As you find out about these features, many of
them will seem very natural to you. One way or another, you’ll feel good
about using Java.

How This Book Is Organized


This book is divided into subsections, which are grouped into sections, which
come together to make chapters, which are lumped finally into six parts.
(When you write a book, you get to know your book’s structure pretty well.
After months of writing, you find yourself dreaming in sections and chapters
when you go to bed at night.) The parts of the book are listed here.

Part I: Getting Started


This part is your complete, executive briefing on Java. It includes a “What is
Java?” chapter and a complete set of instructions on installing and running
Java. It also has a jump-start chapter — Chapter 3. In this chapter, you visit
the major technical ideas and dissect a simple program.

Part II: Writing Your Own Java Programs


Chapters 4 through 6 cover the basic building blocks. These chapters describe
the things that you need to know so you can get your computer humming along.

If you’ve written programs in Visual Basic, C++, or any another language,


some of the material in Part II may be familiar to you. If so, you can skip some
sections or read this stuff quickly. But don’t read too quickly. Java is a little
different from some other programming languages, especially in the things
that I describe in Chapter 4.

Part III: Working with the Big Picture:


Object-Oriented Programming
Part III has some of my favorite chapters. This part covers the all-important
topic of object-oriented programming. In these chapters, you find out how to
Introduction 5
map solutions to big problems. (Sure, the examples in these chapters aren’t
big, but the examples involve big ideas.) In bite-worthy increments, you dis-
cover how to design classes, reuse existing classes, and construct objects.

Have you read any of those books that explain object-oriented programming
in vague, general terms? I’m very proud to say that Java For Dummies, 4th
Edition, isn’t like that. In this book, I illustrate each concept with a simple-yet-
concrete program example.

Part IV: Savvy Java Techniques


If you’ve tasted some Java and want more, you can find what you need in this
part of the book. This part’s chapters are devoted to details — the things that
you don’t see when you first glance at the material. So, after you read the ear-
lier parts and write some programs on your own, you can dive in a little
deeper by reading Part IV.

Part V: The Part of Tens


The Part of Tens is a little Java candy store. In the Part of Tens, you can find
lists — lists of tips for avoiding mistakes, resources, and all kinds of interest-
ing goodies.

Appendices
The book has two appendices. One appendix tells you all about this book’s
CD-ROM (what’s on the CD, how to use the CD, how to make the CD look like
a UFO at night, and so on). The other appendix (housed on the CD, as a
matter of fact) summarizes some important rules for writing Java programs.
To find out which parts of your code spill over automatically into other peo-
ples’ code, read the second appendix.

Additional Bonus Chapters on the CD-ROM!


You’ve read the Java For Dummies book, seen the Java For Dummies movie,
worn the Java For Dummies T-shirt, and eaten the Java For Dummies candy.
What more is there to do?

That’s easy. Just pop in the book’s CD-ROM and you can find four additional
chapters:
6 Java For Dummies, 4th Edition

⻬ In Chapter 15, you combine several smaller programs to create a bigger


program. As part of that process, you find out which parts of one pro-
gram are of use to any other program. You get an expanded description
of the material in Appendix B.
⻬ In Chapter 16, you handle button clicks, keystrokes, and other such
things. You find out about one additional Java language feature (some-
thing like a Java class) called an interface.
⻬ In Chapter 17, you deal with Java applets. You put applets on Web
pages, draw things, and make things move. You create a small game that
visitors to your site can play.
⻬ In Chapter 18, you see an example of Java database handling. The exam-
ple takes you from start to finish — from establishing a connection and
creating a table to adding rows and making queries.

Note: For you Web fanatics out there, you can also read the bonus chapters
on the Web at www.dummies.com/go/javafordummies4e.

Icons Used in This Book


If you could watch me write this book, you’d see me sitting at my computer,
talking to myself. I say each sentence in my head. Most of the sentences I
mutter several times. When I have an extra thought, a side comment, or
something that doesn’t belong in the regular stream, I twist my head a little
bit. That way, whoever’s listening to me (usually nobody) knows that I’m off
on a momentary tangent.

Of course, in print, you can’t see me twisting my head. I need some other way
of setting a side thought in a corner by itself. I do it with icons. When you see
a Tip icon or a Remember icon, you know that I’m taking a quick detour.

Here’s a list of icons that I use in this book.

A tip is an extra piece of information — something helpful that the other


books may forget to tell you.

Everyone makes mistakes. Heaven knows that I’ve made a few in my time.
Anyway, when I think people are especially prone to make a mistake, I mark it
with a Warning icon.

Question: What’s stronger than a Tip, but not as strong as a Warning?


Answer: A Remember icon.
Other documents randomly have
different content
limestone and a kind of jasper rock of a reddish colour are prized for certain
positions, slabs of a dark green colour seemed to come from the vicinity of
Lake Biwa, and volcanic rock and honeycombed sea-rocks are valuable for
water scenes. It would only weary the reader if I were to attempt to describe
the endless combinations of stones as laid down by the unbending laws, or
to give all the names applied to the various sets of stones known as Hill
Stones, Lake and River Stones, Cascade Stones, Island Stones, Valley
Stones, Water-basin Stones, Tea-garden Stones, and, finally, Stepping-
Stones. Often did I regret that my knowledge of the art was not sufficient to
enable me to recognise all these various stones. How intensely it would add
to one’s appreciation of these perfect specimens of artificial scenery if one
could at once among the Hill Stones point out the “Mountain Summit
Stone” and the poetical “Propitious Cloud Stone,” or the “Mist-enveloped
Stone”; or among the River and Lake Stones find the “Sentinel Stone,”
which, as its name suggests, should be placed in the position of a look-out
man near the edge of the water; or the “Wave-receiving Stone” hidden in
the current of the stream. So often the water scenery of the garden is
intended to represent sea-views, the favourite being a portion of the scenery
of Matsushima with its countless islets, that many of these Lake Stones
have names suggestive of the sea; such as the “Sea-gull Resting Stone,”
situated on a stony beach, or the “Wild Wave Stone,” placed so as to meet
the current of the water.
Next come the Cascade Stones, which do not seem quite so numerous,
and among them one at least forms so important a feature in every garden
that it is easy to distinguish—the “Guardian Stone,” which should form the
main part of the rocky cliff over which the water falls; it is also sometimes
called the “Cascade-supporting Stone.” “The Stone of Fudo,” named after a
Buddhist god, and its eight small attendants, the “Children Stones,” are
among the more important features of the cascade or waterfall.
The Island Stones are perhaps more interesting still, as they are such
important features in the landscape. The “Elysian Isle,” the “Master’s Isle,”
and the “Guest’s Isle” are the most favourite trio of islands, and are formed
of combinations of stones. That of the “Elysian Isle,” whose origin comes
from China, is a combination of four stones suggesting
AZALEAS IN A KYOTO GARDEN

the different members of a tortoise’s body, and a pine-tree of carefully


trained form should grow, as it were, out of the back of the animal. The
“Master’s Isle” has three principal stones—the “Stone of Easy Rest,” which
speaks for itself; the “Stone of Amusement,” suggesting the best spot for
fishing; and finally the “Seat Stone.” The “Guest’s Isle” has five important
stones—the “Guest-honouring Stone”; the “Interviewing Stone”; “Shoe-
removing Stone,” on which the clogs or sandals are changed; the “Water-
fowl Stone”; and again the “Sea-gull Resting Stone.”
Among the Valley Stones many have a religious suggestion; but under
this head we find the important “Stone of Worship,” a broad flat stone upon
which one has to assume an attitude of veneration; it should be in front of
the garden, at the point from which the best view is obtained. The Water-
basin Stones are not those which form the basin itself, but may merely serve
as a base for the actual water receptacle, and either act as an embellishment,
or perform certain functions in connection with the basin. The Tea-garden
Stones have the “Kettle Stone,” the “Candlestick Stone,” and many others
suggestive of the tea-drinking ceremonies—merely fanciful in their names,
as these ceremonies invariably take place in a room, and therefore the
stones are never used to fulfil their supposed functions.
Finally we come to the Stepping-Stones, and the art of the Japanese in
placing these stones cannot fail to strike any one who has any interest in the
making of an ordinary rock garden. Their presence in all gardens in Japan is
essential, as the use of turf being almost, if not entirely, unknown for paths
and open spaces, it is replaced by firmly beaten earth, or, for larger spaces,
by fine sand carefully raked into patterns; as footmarks, and more
especially the marks of wooden clogs, would destroy the symmetry of these
patterns, and in damp weather cut up the beaten earth, the use of stones for
crossing the spaces or taking a walk round the garden is an absolute
necessity. The alternative name for these stones is Flying Stones or
Scattered Islands, which at once suggests how gracefully and artistically
they are placed. Nothing, as a rule, could be less artistic than the way
stepping-stones are placed in English gardens; they seem at once to bring to
my mind visions of people trying to keep a steady gait, a feat which it is
positively difficult to accomplish where the stones are laid in an almost
straight row. In commenting on this fact Mr. Conder says:—
It is not, therefore, surprising to find that the Japanese gardener follows carefully
devised rules for the distribution of “Stepping-Stones.” He uses certain special stones and
combinations, having definite shapes and approximate dimensions assigned to them, and
he connects these with secondary blocks, the whole being arranged with a studied
irregularity, both for comfort in walking and artistic grace. This is attained by the
employment of ragged slabs of slate, schist, or flint, flat water-worn rocks or boulders, and
hewn slabs or discs of granite or some other hard stone. The natural boulders are placed in
zigzags of fours and threes, or sometimes in threes and twos, artificially hewn slabs, discs,
or strips intervening. Though uniformity of tread is carefully calculated, the different sizes
of the stones cause the intervals to vary considerably, and any apparent regularity is
avoided. The distance between “Stepping-Stones” should not, however, be less than four
inches, to allow of the intermediate spaces being kept clean. The smaller stones are of
sufficient size for the foot to rest firmly upon, and should not, as a general rule, be higher
than two inches from the soil. In ancient times it is said that “Stepping-Stones” for the
Emperor’s gardens were made six inches high, those for a Daimyo four inches, those for
ordinary Samurai nearly three inches, and for common folk an inch and a half in height.
The larger stones are intended as a rest for both feet, and two of them should never be used
consecutively. In some cases several continuous pathways formed of “Stepping-Stones”
may be seen. When such walks branch off in two directions a larger and higher stone,
called the “Step-dividing Stone,” will be placed at the point of divergence.

The stones leading to the house end usually in a high slab of granite
which forms the step on to the verandah. It is no exaggeration to say that
the Stepping-Stones of a well-planned garden, besides being of strict utility,
are a great ornament to the garden.
Probably the garden ornaments which will first attract the eye of the
visitor are the stone lanterns, which are to be found in almost every garden,
however humble. These lanterns appear to be of purely Japanese origin; no
record of them is to be found in the history of Chinese gardens, though the
introduction of miniature stone pagodas as garden ornaments came to Japan
from China through the medium of Korea, for which reason they are still
called “Korean Towers.” The use of stone lanterns as a decoration for
gardens seems to date from the days when the Professors of Tea-ceremonial
turned their attention to landscape gardening. The custom of presenting
votive offerings of lanterns in bronze or stone, large or small, plain or
decorated, dates from early days, and no Buddhist temple or shrine is
complete without its moss-grown lanterns adorning the courts and grounds.
The correct placing of stone lanterns in the landscape garden is almost as
complex as the placing of stones. They should be used in combination with
rocks, shrubs and trees, and water-basins. They have no use except as
ornaments, as seldom, if ever, did I see one with a light in its fire-box
except in temple grounds. They appeared to be almost more valued for their
age than their form, as new ones can be easily procured of any desired
shape; but however ingenious the devices may be for imparting a look of
age to new specimens, it is time, and time alone, which will bring that thick
green canopy of velvet moss on their roof, and the granite will only become
toned down to the coveted mellow hue by long exposure to the weather.
Roughly speaking, garden lanterns are divided into two classes, the
Standard and the Legged class, though many others of fanciful design may
sometimes be seen. The origin of the Standard class was known as the
“Kasuga” shape, after a Shinto god to whom the well-known Nara temple is
dedicated. Thousands of these Kasuga lanterns adorn the temple grounds,
and the exact form is that of “a high cylindrical standard, with a small
amulet in the centre, erected on a base and plinth of hexagonal plan, and
supporting an hexagonal head crowned with a stone roof of double curve,
having corner scrolls. The top is surmounted with a ball drawn to a point
above. The head of the lantern, which is technically called the fire-box, is
hollowed out, two of its faces having a square opening large enough to
admit an oil lamp; and the remaining four sides being carved respectively
with representations of a stag, a doe, the sun, and the moon.” These lanterns
may vary in size, from six to as much as eighteen feet, and in this colossal
size make a most imposing decoration for a large garden. There are several
other designs which closely resemble the true Kasuga shape. Many others
there are which still belong to the Standard class: some with the standards
shortened and the heads elongated; others with flat saucer-shaped caps or
wide mushroom-shaped roofs—in fact, an infinite variety; and even in
humble gardens rude specimens are seen built of natural mossy stones
chosen to resemble as closely as possible the regulation form, and the fire-
box made of wood. Another form of the Standard shape is suggestive of
glorified lamp-posts; these lanterns are mostly used in the approach to
gardens or near the tea-rooms. Some of them are very quaint and quite
rustic in appearance, being always made of wood. The square wooden
lantern on a tall post is covered by either a wooden or thatched roof with
AZALEAS, KYOTO

wide-projecting eaves. One of these is called the Who goes there? shape,
and derives its original name from the fact that the dim light seen through
its paper doors is only sufficient to enable a person to vaguely distinguish
an approaching form; and the Thatched Hut shape is in the form of a little
thatched cottage.
The class known as Legged lanterns have the alternative name of Snow
Scene lanterns, as the very wide umbrella-shaped roof or cap, by which they
are invariably covered, makes a broad surface for snow to rest upon. To the
eye of a Japanese the effect of snow is almost more beautiful than any of
their floral displays, and a snow-clad scene gives them infinite pleasure.
The position of these lanterns in the garden should be partly overshadowed
by the crooked branch of a spreading pine-tree, and certainly after a fall of
snow the effect is one of great beauty.
Ornamental bronze or iron lanterns are hung by a chain from the eaves
of the verandah of either the principal house or tea-room, and, like the
water-basin, are often very beautiful in design. Bronze Standard lanterns
are never seen in landscape gardens, only as votive offerings to temples; but
occasionally an iron lantern with no standard, only resting on low feet, may
be placed on a flat stone near the water’s edge, or nestling in the shadow of
a group of evergreen shrubs. Near the larger Kasuga-shaped lanterns a
stepping-stone (or even two, if the lantern be unusually large) should be
placed higher than the surrounding ones; these are called Lamp-lighting
Stones, as by their aid the fire-box can be conveniently reached for lighting
the lamp.
A garden water-basin may be either ornamental in form, or merely a very
plain hollowed-out stone with a strictly utilitarian aspect. Its position in the
garden is invariably the same, within easy reach of the verandah, so that the
water can be reached by the wooden ladle which is left by the side of the
basin; and usually an ornamental fence of bamboo or rush-work separates it
from that part of the house in its immediate neighbourhood. For a small
residence, and where the basin is for practical use, the distance from the
edge of the verandah should not be more than eighteen inches, and the
height three to four feet; but as the law of proportion applies to the water-
basin just as it applies to the rest of the composition, the ornamental basin
in front of a large house will have to be three or four feet away, and its
height seven or eight feet from the ground. In this case, in spite of the
stepping-stones, the basin becomes merely an ornament, as it is out of reach
for practical purposes, and even has to be protected by a separate decorative
roof to keep off the rain.
Each shape of basin has its own name, but perhaps one of the most
popular forms is that of a natural rock of some unusual shape, hollowed at
the top and covered with a delicate little wooden construction, like a tiny
shed or temple, to keep the water cool and unpolluted. The Running-water
Basins, as their name suggests, receive a stream of clear water by means of
a little bamboo aqueduct, and in that case arrangement has to be made for
the overflow of the water.
As water is so essential in the composition of all landscape gardens, it is
not surprising to find that the various styles of bridges which are employed
to cross the lake or miniature torrents, and connect the tiny islands with the
shore, are so graceful in design, and yet so simple, that they must certainly
be classed as ornaments to the garden. The more elaborate bridges of stone
or wood are only seen in large gardens. The semicircular arched bridge, of
which the best-known example is in the grounds of the Kameido temple in
Tokyo, where it forms a most picturesque object in connection with the
wistaria-clad trellises, is of Chinese origin, and is supposed to suggest a full
moon, as the reflection in the water below completes the circle. It was not
these elaborate bridges that I admired most, but rather the simpler forms
made out of a single slab of granite slightly carved, spanning a narrow
channel, or, more imposing still, two large parallel blocks, overlapping in
the middle of the stream, supported by a rock or by a wooden support.
Very attractive, too, are the little bridges made of bundles of faggots laid
on a wooden framework, covered with beaten earth, the edges formed of
turf, bound with split bamboo, to prevent the soil from crumbling away.
There is an infinite variety of these little fantastic bridges, and the
cleverness displayed in the placing of them was a never-failing source of
admiration to me. The common idea of a bridge being a means of crossing
water in the shortest and most direct manner is by no means the Japanese
conception of a bridge. Their fondness for water, and their love of lingering
while crossing it, in order to feed and gaze at the goldfish, or merely to
enjoy the scene, has no doubt been responsible for the position of many of
their bridges: one slab will connect the shore with a little rocky islet, and
then, instead of continuing in the most direct route to the opposite shore, as
often as not the next slab will branch away in an entirely different direction,
probably with the object of revealing a different view of the garden, or
merely in order to prolong the pleasure of crossing the lake or stream.
In most gardens, unless they are very diminutive in size, there is at least
one Arbour or Resting Shed. It may consist merely of a thick rustic post
supporting a thatched roof in the shape of a huge umbrella, with a few
movable seats, or its proportions may assume those of a miniature house
carefully finished in every detail. When they are of such an elaborate form
they partake more of the nature of the Tea-ceremony room, with raised
matted floors, plastered walls, and shoji on at least two sides of the room.
The open structures in various shapes, with rustic thatched roofs, some
fixed seats with a low railing or balustrade to lean against, are of more
common form; and if the Resting House is by the side of the lake, a
projecting verandah railed round is very popular, affording a comfortable
resting-place from which to gaze at the scene.
Decorative garden wells are picturesque objects, with their diminutive
roofs to protect the cord and pulley from the rain. As often as not they are
purely for ornament, but even in this case the cord, pulley, and bracket
should all look as antique as possible. A few stepping-stones should lead to
it, and a stone lantern should be at hand with a suitable group of trees or
shrubs.
Finally we come to garden fences and gateways, which again are
bewildering in their infinite variety and style. The Imperial gardens, and
even less imposing domains, are not enclosed by fences, but by solid walls
of clay and mud, plastered over, carrying a roof of ornamental tiles. Even
fences made of natural wood all carry a projecting roof to afford protection
from the rain, which adds very much to their picturesque effect. The
humblest garden must have two entrances, which therefore necessitates two
gateways—the principal entrance, by which the guests enter, and the back
entrance, called The Sweeping Opening from its practical use as a means of
egress for the rubbish of the garden. This gate will be made of wood or
bamboo, quite simple in style; but the Entrance Gate is a far more
important feature of the domain, and must be in character with the garden it
leads to. The actual garden doors are of
TIGER LILIES

natural wood, their panels decorated with either carving or lattice-work, and
set in a wooden frame which may vary considerably in style. Roofed
gateways are very common, and the practice of hanging a wooden tablet
between the lintels, with an inscription either describing the style of the
garden or merely conveying a pretty sentiment in keeping with its character,
is often seen. The fashion of planting a pine-tree of twisted and crooked
shape just inside the gateway so that its leaning branches may be seen
above the fence, is not only for artistic effect, but, the pine being an emblem
of good luck, it is supposed to bring long life and happiness to the owner of
the garden.
Mr. Conder tells us that over a hundred drawings exist of ornamental
Screen Fences, called by the Japanese Sleeve Fences. They may be used to
screen off some portion of the garden, but are mainly ornamental, and are
usually placed near the water-basin and a stone lantern. Without
illustrations it is hopeless to attempt to describe their fanciful shapes, each
again with a poetical name. The materials used in their construction consist
chiefly of bamboo tubes of various sizes, rushes and reeds tied with dyed
fibre, or even the tendrils of creepers or wistaria. In some of the simpler
forms the patterns are only made by the placing of the bamboo joints; but
others are much more elaborate, and have panels of lattice-work formed of
tied rushes or reeds, or openings of different shapes like windows. Mr.
Conder gives a detailed description of an immense number of these
fantastic screens, and one at least I must quote as an example.
The Moon-entering Screen Fence is about seven feet high and three feet wide, having
in the centre a circular hole, from which it receives its name. The vertical border on one
side is broken off at the edge of the orifice, so that the circle is not complete, and this gives
it the form of a three-quarter moon. Above the hole the bundles of reeds are arranged
vertically, like bars, and below in a diagonal lattice-work, tied with hemp cords.

Through the openings in these fences a branch of pine, or some creeper,


is often brought through and trained with excellent effect.
I feel I have said enough about the materials used for the construction of
a landscape garden, to convey to the mind of the reader something of the
difficulties which surround the correct combination of these materials, and
sufficient to make any one realise that the making of a Japanese garden is a
true art, which it is not surprising that it is impossible for a foreigner to
imitate, hence the lamentable failure of the so-called “Japanese gardens”
which it has been the fashion of late years to try and make in England
frequently by persons who have never even seen one of the gardens of
Japan. The owner of probably the best of these English “Japanese gardens”
was showing his garden, which was the apple of his eye, to a Japanese, who
with instinctive politeness was full of admiration, but had failed to
recognise the fact that it was meant to be a true landscape garden of his own
country, and therefore exclaimed, “It is very beautiful; we have nothing at
all like it in Japan!”
CHAPTER III

LANDSCAPE GARDENS

Having made some attempt to elucidate the mysterious and wonderful


construction of Japanese gardens, I feel the reader will expect to learn
something of their effect as a whole when completed. Unfortunately many
of the finest specimens of landscape gardens, the old Daimyos’ gardens in
Tokyo, have been swept away to make room for foreign houses, factories,
and breweries, and no trace of them remains; old drawings or photographs
alone tell of their departed glories. Probably the largest of these gardens
which still remains entire is the Koraku-en, or Arsenal Garden, as it is more
commonly called. It is now empty and deserted, and seems only filled with
sadness, its groves recalling days gone by, when succeeding Daimyos
entertained their friends in regal pomp, and the sound of revelry broke the
silence of the woods; to-day only the incessant sound of metal hammering
metal breaks the silence of the glades, and the sound of explosions from the
Arsenal near by might well rouse the dead. The garden covers a large extent
of ground, and is an example of a scheme in which many separate scenes
were skilfully worked together to form a perfect whole. Its fame dates from
early in the seventeenth century, when the Daimyo of Mito, who was a great
patron of landscape gardening, laid out the grounds. The fact that they are
remarkable for many Chinese characteristics is not surprising, when we
learn that the Shogun Iyemitsu took an interest in the work, and lent the aid
of a great Chinese artist called Shunseu, who completed the scheme. A
semicircular stone bridge of Chinese design, called a Full-moon Bridge,
spans a stretch of water in which, in the scorching heat of August mornings,
the great buds of white lotus flowers will crack and slowly open, their giant
leaves almost hiding the bridge; this important feature of the garden is
called Seiko Kutsumi, after a famous lotus lake in China. The island in the
lake is the Elysian Isle of Chinese fame, and formerly was connected with
the shore by a long wooden bridge, which has long since disappeared; but
the path wanders on, past the rocky shore, skirting the headland and high
wooded promontory, through the dense gloom of a forest, and by the time I
had made a complete tour of this garden I felt as though I had paid a flying
visit to half Japan.
There was an avenue of cherry-trees to recall the avenues of Koganei;
the river Tatsuda in miniature, its banks clothed with maples and other
reddening trees, to give colour to the garden in autumn, when the setting
sun will seem to light the torch and set all the trees ablaze; there also is the
Oi-gawa or Rapid River with its wide pebble-strewn bed, down which a
rapid-flowing stream is brought; then we are transported to scenes in China;
and beyond, again, the wanderer is reminded of the scenery of Yatsuhashi,
where one of the eight bridges crosses in zigzag fashion a marshy swamp
which in the month of June is a mass of irises, great gorgeous blossoms of
every conceivable shade of lilac and purple, completely hiding their foliage;
then this little valley becomes a stream of colour and recalls the more
extensive glories of Hori-kiri.
Perhaps most ingenious of all is that part of the garden where the cone of
Fuji-yama appears, snow-capped in May, as it is densely planted with
AN OLD GARDEN

white azaleas. Many other scenes there were—tiny shrines built in imitation
of great temples, cascades and waterfalls named after other celebrated falls,
rare rocks, moss-grown lanterns, bridges of all designs; in fact, the garden
seemed a perfect treasure-house, and I felt glad that this one garden has
escaped the hand of the destroyer and is left entire, a masterpiece of
conception and execution.
Of another Tokyo garden—which unfortunately has not been left
untouched, as it is shorn of half its former glories, a glaring red-brick
brewery covering half the area of the beautiful grounds formerly known as
Satake-no-niwa—only a portion remains, though a very lovely portion, and
as it seems complete in itself it is still worth a visit. Unlike the Koraku-en,
the Satake Garden was a rather artificial example of hill gardening, more
open, with no dense groves, but essentially a hill and water garden. The
large lake remains, and, like most of the gardens in the Honjo district of
Tokyo, its waters are salt and tidal, being connected with the neighbouring
river Sumida. Thus at high and low tide the shores of the lake present a very
different aspect; pebbly bays can only be crossed by stepping-stones at high
tide, and even some of the stone lanterns by the water’s edge have their
standards half submerged. The hills are closely planted with evergreen
bushes and shrubs, and most of the year the garden is all grey and green; the
island is reached by a grey stone bridge formed of two slabs of granite of
giant proportions, the grey lanterns stand among shrubs, cut into rounded
form, and the mossy rocks and boulders have still more neutral tones; so it
is only in spring when Nature asserts herself, and no gardener can prevent
the young leaves of the maples being a variety of vivid colouring, and the
grey rounded azalea bushes become perfect balls of scarlet, rosy-pink and
white blossoms, that the garden has any colour in it. But to the mind of the
Japanese all sense of repose and quiet charm would be gone if the eye were
always worried by a distracting mass of colour; so even if flowers were
grown in these more extensive gardens they had a special part of the
grounds set apart for their culture. In one corner of the lake a piece of
swampy ground was thickly planted with irises and water-plants, and a
wistaria trellis overhung the lake, otherwise no flowers entered into the
scheme; but it was a perfect specimen of the typical Japanese arrangement
of garden hills planted with rounded bushes and adorned with lanterns.
SATAKE GARDEN, TOKYO

A magnificent example of a modern landscape garden is that belonging


to Baron Iwasaki, made some forty years ago. The venerable pine-trees
supported by stout props overhanging the lake are suggestive of countless
ages; but in this garden old trees of gnarled and twisted growth, rare rocks,
and immense boulders were collected from all parts of the empire,
regardless of expense, and brought together to ensure the success of the
scheme. The grounds cover many acres, the one blot in the landscape being
the large red-brick foreign house; but luckily the most lovely part of the
garden is laid out in front of the perfect specimen of a Japanese gentleman’s
house, where the verandah of the cool matted rooms looks over a scene of
indescribable beauty. The large lake is cleverly divided, and the portion of
the garden in front of the foreign house is left behind; groves of evergreen
trees screen the house—the one jarring note; and here the lake becomes the
lagoon of Matsu-shima, tiny pine-clad islets rise from the water, and in the
distance rises the cone of Fuji from an undulating plain of close-mown turf
and groups of dwarfed pines. Here again flowers have no official existence;
azaleas there are in profusion, but they are only introduced as shrubs; so the
garden is not a flower garden, but a true landscape garden—the
reproduction in miniature of natural scenery. The lanterns and bridges near
the foreign house are of immense size, carrying out the law of proportion;
the rocks and boulders are large to correspond, and the whole effect is one
of great breadth; only near the tea-house and the main Japanese house does
the garden become more finished in style and on a smaller scale. The
balcony overhangs the rocky edge of the tidal lake; each rock has its history
and its especial place; but the laws which have governed the making of such
a garden are laws drawn up by great artists,—there is no false note, even the
grouping of the reeds and irises by the water’s edge has been planned by a
master hand, so the picture remains graven on one’s memory as that of an
ideal pleasaunce for leisure and repose.
In Kyoto there still remain the gardens of the Gold and Silver Pavilions
—gardens of much older date, the splendour of their pavilions dimmed by
age, more especially in the case of Kinkakuji, the Golden Pavilion. Mr.
Conder says, “Long neglect has converted what was once an elaborate
artificial landscape into a wild natural scene of great beauty.” The little
pine-clad islets remain, but they are now island wildernesses; the trees have
partially resumed their normal shapes; great leaning pines overhang the
shores of the Mirror Ocean, representing the Sea of Japan, and its three
islands suggesting the Empire of the Mikado. It was in the fourteenth
century that this quiet spot became the so-called retreat of the scheming
Yoshimitsu, who, pretending to have resigned the Shogunate in favour of
his son, here lived in the garb of a monk, but in reality directing the affairs
of State. The two-storied Pavilion itself, seen reflected in the Mirror Ocean,
is possibly more picturesque in decay than it was in the days of its
splendour; the gilding from which it takes its name has been partially
restored; it is backed by the wooded hill fancifully called the Silken Canopy
or Silk Hat Mountain, from the fact that the ex-Mikado Uda ordered it to be
covered with white silk on a scorching summer’s day, in order that his eyes
might enjoy the sensation of gazing on a cool, snow-covered scene. To this
day the garden of Kinkakuji under a light canopy of snow is one of the
favourite sights of the people of Kyoto. In days gone by there were smaller
arbours in which the Shogun, wearied with his walk among the groves of
the Silk Hat Pg089 Mountain, would rest, and compare the scene which the
garden was intended to represent, to the real Sea of Japan, whence the name
of one of the arbours, The House of the Sound of the Seashore.
To the north-east of Kyoto, nestling among the woods that clothe the
lower hills of Hiei-san, lie the grounds of Ginkakuji or the Silver Pavilion.
In imitation of his predecessor Yoshimitsu, the Shogun Yoshimasa after his
abdication retired from the affairs of the world, built himself a country
house with grounds of vast extent, even with despotic impatience sweeping
away a temple because it interfered with his plans,—though we are told he
was filled with remorse, and afterwards restored it at great expense. The
two-storied Pavilion was partly copied from its rival, the Golden Pavilion,
though it never seems to have attained to the same splendour; but here the
ex-Shogun and his boon companions, the philosopher Soami and Shuko the
Nara priest, held their æsthetic revels. They may be said to have laid down
the laws which raised the tea-ceremonial to the rank of a fine art. Mr. Farrar,
in writing of it, says:—
It has its prescribed ritual of appalling rigidity, this tea-ceremony, invented and
elaborated by a pious monk to

A TOKYO GARDEN
distract a young and giddy Shogun from his debaucheries. It was taken up as a political
weapon by the House of Tokugawa, and crystallised into its present adamantine form,
becoming a social engine of the most powerful nature in its power of bringing all the
nobles together. Here, then, is one of its temples where the rites were celebrated in their
due ordinance, with their prescribed compliments, obeisances, and admiring exclamations
over the prescribed flower, arranged in the prescribed spot, and indicated by the host in the
prescribed words, to be followed by the invariable litany of conversation and courtesy over
the cup of tea to be made, handed, accepted, and drunk all with remarks and gestures and
smiles of ancestral rubric.

Outside any tea-house built in accordance with these prescribed


regulations one sees “a row of stepping-stones, finishing beneath a little
œil-de-bœuf in the wall above, by which the visitors had to enter, ignoring
the thoroughly practical door. They approached, making the due bows upon
each stone, and at last their host was to fish them in through the window.”
Another ceremony inaugurated within these precincts was the
ceremonial of “incense sniffing,” to our minds merely an innocent, childish
game, the winner being the person possessing the keenest sense of smell, as
the pastime consisted of five or more different kinds of incense being burnt,
sniffed, given poetical names, then mixed up and sniffed again, and the man
who guesses best the names of the various kinds, is the winner. The boxes
which contained the incense, the burners in which it was burnt, were all
works of art, and the same grave etiquette which governed the tea-
ceremonial governed these incense-sniffing parties, in which poets, writers,
priests, philosophers, Daimyos, Shoguns, the greatest and most learned in
the land, took part. We can only gaze with wonder and perplexity—not
hoping to understand—at a “nation’s intellect going off on such devious
tracks as this incense-sniffing and the still more intricate tea-ceremonies,
and on bouquets arranged philosophically, and gardens representing the
cardinal virtues. Such strict rules, such grave faces, such endless
terminologies, so much ado about nothing!” (Professor Chamberlain’s
Things Japanese.)
To return to the garden proper, laid out with great elaboration by Soami.
Although it is now much neglected, the trees are not kept trimmed
according to the rigid laws, their stems are lichen-clad, and Nature has tried
to reassert herself over art, yet the beauty of the spot is great. The lake, of
ingenious form, backed on the north side by the thickly pine-clad hills and
to the west by the regulation grove of maples, is an admirable example of
the arrangement of garden stones, its shores being rich in rare and precious
rocks, each with its characteristic name. One of the principal stones lying in
the lake is the stone of Ecstatic Contemplation; the little bridge which
divides the lake is the Bridge of the Pillar of the Immortals; the water of the
cascade which fills the lake, being of exceptional purity, is called the Moon-
washing Fountain. In the foreground of many of these older gardens was an
open space covered with white sand, carefully raked into ornamental
patterns, and here is a large mound of the sand suggestive of a mammoth
sugar-loaf with a flattened top, called the Silver Sand Platform, the smaller
one of the same shape being the Mound facing the Moon; on these sat
Yoshimasa and his favourites, indulging in another favourite pastime of
moon-gazing, to our prosaic minds merely another elaborately conceived
method of killing time. I know no garden in Japan which seemed to take
one back so far into the world of the Old Japan as this little garden of
Ginkakuji, and no more peaceful spot to sit and enjoy the reddening maple
leaves on a bright evening in late autumn, when there is a touch of sadness
in the air, in keeping with the departed glories of the Pavilion and the fast-
fading beauties of the trees.
Many of the smaller and most interesting gardens in Japan are those
attached to tea-houses or small suburban houses, showing, as they do, the
ingenuity and resource of the landscape gardener in making a perfect
garden of any size, from ten acres to half an acre, or only a few square
yards. Among tea-house gardens, that attached to the Raku-raku-tei at
Hikone can hardly be counted, as it was formerly the garden of a great
Daimyo and is one of the finest gardens in the country. The numerous little
summer-houses built out on piles in the lake have been erected for the
entertainment of the guests of the tea-house, a gathering place for the most
élite, but otherwise the garden remains unchanged; the paths which wind
round the lake, across the bridges, past the Stone of Worship, from where
the beauties of the garden may be enjoyed to best advantage, are the same
paths which the feet of successive Daimyos trod in the feudal days of old.
It is rather to the Hira-niwa, or Flat Gardens, that I allude, made in the
small enclosures at the back of private houses or tea-houses in towns, or
even in the actual courts, no space being apparently too small for the
construction of one of these little fresh-looking and artistic gardens. How
superior to the dusty, neglected back garden or court of a European house,
too often only a piece of waste ground where the rubbish of the house
accumulates, the space being condemned as too small for a garden. I can
recall visions of many a tiny court no more than twenty feet square, within
whose limits were compressed a liliputian pond, fed with clear water by the
overflow of the water-basin; a dwarf pine, the soul of every Japanese
garden, which in conjunction with a few small evergreen shrubs sheltered a
moss-grown lantern. Some small rocks and a few foliage or water plants in
a tuft by the water’s edge, were the sole materials used for the making of
this court-garden. Stepping-stones, let into the beaten earth, led from the
step of the verandah to the edge of the pond, ending in one stone larger than
the rest, suggesting the Stone of Worship, or the Stone of Amusement, in
case there should be any goldfish in the pond. As these little courts are kept
profusely watered, being sprinkled out of a wooden ladle several times a
day in the hottest days of summer, the effect is always damp and cool, the
mossy stones are always fresh and green, however fierce the heat may be.
The variety in the actual form of these gardens seemed infinite; in some the
pond was omitted, and the suggestion of water and dampness came from the
rustic garden well or the ornamental water-basin, behind which always
stands a portion of screen-fencing of elaborate design. When the area is not
quite so limited, bridges will be introduced to cross the pond, possibly
consisting only of a single stone slab supported on a natural piece of rock,
or a granite bridge slightly curved in form, or perhaps only the suggestion
of a bridge, formed of a branch of juniper or some flat close-growing
evergreen trained in a curve across the water. According to the size of the
ground, so these gardens will increase in elaboration of their design, and
many an enclosure at the back of a merchant’s house in Kyoto or Osaka has
been transformed into a perfect specimen of Hira-niwa.
One I recall which always gave me as much pleasure as the most
extensive landscape garden in the country. The lake was of the prescribed
form known as the Running Water shape, fed by a fast-flowing stream
which came in at the far end of the garden over the regulation Cascade
Stones; a garden arbour of elaborate form overlooked the lake, in which
stood the “Elysian Isle” with its pine-tree
A LANDSCAPE GARDEN

growing out of the rock, and a few azalea bushes filling the interstices of
the stone, forming a most attractive feature of the garden; banks there were
planted with more azaleas; pines, kept dwarfed to about two feet in height,
grew out of cushions of thick moss; bridges crossed and re-crossed the
stream; stepping-stones, discs, and label stones guided our feet as we
wandered about at leisure. There were the two garden entrances, and even
the back entrance, or Sweeping Opening, was a thing of beauty. Every detail
of this garden had been first carefully thought out, and then as carefully
carried into execution.
The landscape gardener in Japan is no gardener in the sense that we
regard a gardener in the West—a cultivator of flowers: he is a garden artist;
he leaves none of his effects to chance; so carefully are his plans made that
before the first sod of the new garden has been turned, he knows exactly
how the garden will look when completed. He will see in his mind’s eye the
appointed place for every tree, every stone, which is to be used in its
composition. I could not help thinking that if more thought were given to
the planning of our English gardens there might be something more
complete and satisfying to the eye than the meaningless gardens—often laid
out by the owner of the house, who by the wildest stretch of imagination
could not be called a garden artist—which too often surround our English
homes. Our gardens are made beautiful in summer by the wealth and
profusion of their flowers; but when the winter comes and the beds are
shorn of their summer glories, the deficiencies of the plan of the garden are
laid bare, and might well give us food for thought through the long winter
months.
CHAPTER IV

NURSERY GARDENS—DWARF TREES AND HACHI-NIWA

A nursery garden in Japan may be called a revelation in the art of pruning.


A singular idea exists in the minds of many people, that all the trees in
Japan are like the dwarf specimens they have occasionally seen in England
on a nurseryman’s stand at a flower-show, and frequently they display
surprise, not unmixed with incredulity, when assured that such is not the
case. I would recommend those unbelievers to take a walk in the
cryptomeria avenues at Nikko, among the camphor groves of Atami, or to
wander through the pine-woods which clothe the hillsides above Kyoto,
when they would see for themselves the magnificence of the trees,
untouched by the pruning knife of the gardener. The Japanese bestow as
much time and care on the trees in their gardens as the Western gardener
would give to his choicest flowers. The gardener’s ideal tree is not the
ordinary tree of the forest, but the abnormal specimen which age and
weather have twisted and bent into quaint and unusual shapes. Here, in the
nursery garden, we shall find specimen trees; old trees it is true, but trees
giving proof that art has had to improve upon nature, as scarcely a single
tree in the whole collection—waiting, possibly, to transform the new garden
of a nouveau riche into an ancestral home—will have been allowed to
follow its own inclination of growth and shape.
The pine-tree is generally chosen as the subject for the operating knife,
and is cut and trained into all manner of shapes; an umbrella made of a
single tree of Pinus densiflora trained on a framework of light bamboo, or a
junk of perfect form, the reward of years of patience, will be waiting until it
is required to be the chief feature in a landscape garden. The curiously
twisted appearance characteristic of a Japanese pine-tree, in gardens and
temple grounds, is achieved by a clever system of pruning, and gives the
trees a stunted and venerable appearance, which they would otherwise not
attain for years. The leading shoot of each branch and most of the side ones
are removed, giving the branch a new direction, sometimes at right angles
to the previous year’s growth. This operation is repeated every year, and the
branches thinned out, so that every line of the stems can be followed.
Another favourite and very effective way of training a pine, is to carry a
long branch out over a stream or pond, and by skilful training and cutting to
give it the direction that, after a few years’ growth, will have become
natural to it, and the whole strength of the tree will seem concentrated in
that one branch. These trees should be placed by the water’s edge or on the
slope of a hill, and are often planted leaning at all manner of angles. The
gardener is never sparing in his use of stout bamboo props, which to our
Western ideas would appear unsightly.
It is not in these trees, interesting as they always are, that the admiration
of the visitor to a Japanese nursery garden will be centred; for how few
foreigners remain long enough in the country, or take sufficient interest in
their temporary home, to construct a new garden round it; yet how easy it
seems to accomplish, when old gnarled trees are ready grown. It would
appear as though a few hours’ planning and plotting, a few stones and trees,
a few days’ work for a few coolies, are all that is required, and the thing
would be done; but remember success depends upon the plan, one false
touch would set the whole conception ajar, so woe betide the foreigner if he
were to attempt to interfere with the making of his garden; left to himself a
Japanese is never guilty of that one false touch.
Arranged in rows on wooden platforms will be the object of our visit to
the nursery garden—the dwarf trees—whose fame has spread throughout
the world, and who seem to share with the cherry blossom the floral fame of
Japan. When first I visited the country I went prepared to be disappointed
with the dwarf trees; I had seen inferior specimens shipped to Europe no
doubt because of their inferiority, pining away a lingering life in a climate
unsuited to them, deprived of all care and attention; for an idea prevailed in
England when they were first imported, that these tiny trees, the result of
years of patient training, required no water, and either no fresh air or else
were equally indifferent to the fiery rays of the summer suns or the icy
blasts of the winter winds. A visit to a garden in their native country will
soon reveal that such is not the case. The trees are not coddled, it is true, but
the proper allowance of water, especially in their growing season, is most
important, and they are impatient of a draught; though many seem to stand
the full rays of the sun, the best specimens had generally some light canvas
or bamboo blinds, arranged so that they could be drawn over the stands
during the hottest hours of the scorching summer days. I have heard these
trees described as tortured trees; to me, good specimens never gave that
impression, their charm took possession of me, and a grand old pine or
juniper whose gnarled and twisted trunk suggested a giant of the forest, and
yet was under three feet in height, standing in a soft-coloured porcelain
bowl, gave me infinite pleasure. I could see no fault in them, they are
completely satisfying and give a strange feeling of repose.
Their variety is infinite, from six inches in height to as many feet; pines,
junipers, thujas, maples, larch, willows, and, among the flowering trees,
pink and white plum, single and double cherries, tiny peach-trees,
smothered by their blossoms, pyrus trained in fantastic shapes, all will be
there in bewildering choice of beauty. I have heard of a single treasure, a
weeping willow, only six inches in height, the reward of years of patience,
for which the price of 7000 yen (£700) was paid; probably to our eyes it
would have had no more value than a humble “dwarf” which, in
consequence of some slight imperfection, would not fetch more than
sevenpence. In a perfect specimen not only each branch, but each twig and
each leaf, must conform absolutely in direction and proportion to the same
unbending laws which govern this art, as well as its sister arts of landscape
gardening and flower arrangement—laws which a writer says were “the
iron rules laid down by the canons of taste in the days when Iyeyasu
Tokugawa paralysed into an adamantine immobility the whole artistic and
intellectual life of the country.” So in every garden there will be failures as
perfect works of art, but beautiful in our eyes, which fail to see any
difference between the perfect specimen with its boughs bent down by the
weight of the laws which have trained it and priced it at some hundred yen,
or the “failure” by its side, beautiful and wonderful, with all its
imperfections an exquisite and dainty thing, priced at as many pence.
Perhaps one of the best opportunities for buying these imperfect trees,
which are still admired and readily bought by the Japanese themselves,
though not to be treasured as works of art, is at
THE OLD WISTARIA

the sales which take place at night in the streets of Kyoto on certain days of
the month. The plants are arranged on stalls down each side of a narrow
street, and the intending purchaser has to fight his way through a dense
crowd to choose his plants. No lover of dwarf trees should miss attending
one of these sales, and perhaps the uncertainty as to whether the plant is in
good health, or the bowl containing it is broken, adds to the excitement of
bargaining with the stall-holder; every Japanese loves a bargain, and the
transaction is eagerly watched by the crowd, and the “foreign devil” will
gain their admiration if he can hold his own against the rapacity of the
salesman. As the plants vary in price, from a few sen to two or three yen,
one can afford to carry off a sufficient number to ensure having some, at
least, that will be a reward for one’s patience. On the 1st of April the best
night-market of the year is held. The stalls will be covered with tempting
little flowering trees, their buds almost bursting and full of promise of
lovely blossoms to come—sturdy little peach-trees, their branches thickly
covered with soft velvet buds just tinged with pink; drooping cherries
wreathed with red-brown buds; slender pyrus trained into wonderful twisted
shapes; little groves of maple-trees, their scarlet or bronze leaves just
unfurling, or miniature forests of larch, shading mossy ravines with rivers
of white sand; ancient pine-trees spreading their branches over rocky
precipices rising from a bed of pebbles; sweet-scented daphnes, golden-
flowered forsythias, and early azaleas in porcelain dishes, which are round
or oval, square, shallow or deep, and of every shade, from white, through
soft greys and blues to a deep green. Every plant is a picture in itself, and
the difficulty lies in deciding, not which to buy, but which one can bring
oneself to leave behind.
Siebold, who visited Japan and wrote the Flora Japonica upwards of
sixty years ago, thus describes the dwarf trees:—
The Japanese have an incredible fondness for dwarf trees, and with reference to this the
cultivation of the Ume, or Plum, is one of the most general and lucrative employments of
the country. Such plants are increased by in-arching, and by this means specimens are
obtained which have the peculiar habit of the Weeping Willow. A nurseryman offered me
for sale in 1826 a plant in flower which was scarcely three inches high; this chef d’œuvre of
gardening was grown in a little lacquered box of three tiers, similar to those filled with
drugs which the Japanese carry in their belts; in the upper tier was this Ume, in the second
row a little Spruce Fir, and at the lowest a Bamboo scarcely an inch and a half high.

The Japanese still love their dwarf trees as much as they did in the days
of Siebold, and the trade in them has received additional impetus of late
years, as great numbers are exported annually to Europe and the United
States, where I fear they are not treasured as works of art, but are only
regarded as curiosities.
At different seasons of the year the nursery gardens will be gay with the
display of some especial flower. Early in May the gaudy-coloured curtains
and paper lanterns at the gates will announce, in the bold black lettering
which is one of the chief ornaments of the country, that a special exhibition
of azaleas is being held. It is scarcely conceivable that any plants can bear
so many blossoms as do these stiff and prim little azalea-trees; the
individual blooms are small, but their serried ranks form one dense even
mass, flat as a table, for no straggling branches are allowed in these
perfectly grown plants. Every shade is there, an incredible blaze of colour,
all the plants the same shape, all practically the same size, and all in the
same shaped pots; the only variety being in the delicate hue of the faience
pots or the vivid colouring of the blossoms. The pots are arranged in rows
or stages under the blue and white checked roofing, which seems peculiarly
to belong to flower exhibitions; the effect cannot be said to be artistic, but
there is something very attractive about the little trees, which are visited by
the same crowd of sight-seers, who seem to spend their days in “flower-
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

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.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookultra.com

You might also like