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

Java Precisely third edition Peter Sestoft download

The document provides information about the book 'Java Precisely, Third Edition' by Peter Sestoft, published by The MIT Press in 2016. It includes details on the book's contents, structure, and various topics covered, such as Java programming concepts, types, classes, and expressions. Additionally, it lists links to other related books and resources available for download.

Uploaded by

iyoreuloma
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)
53 views

Java Precisely third edition Peter Sestoft download

The document provides information about the book 'Java Precisely, Third Edition' by Peter Sestoft, published by The MIT Press in 2016. It includes details on the book's contents, structure, and various topics covered, such as Java programming concepts, types, classes, and expressions. Additionally, it lists links to other related books and resources available for download.

Uploaded by

iyoreuloma
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/ 66

Java Precisely third edition Peter Sestoft

download

https://ebookname.com/product/java-precisely-third-edition-peter-
sestoft/

Get Instant Ebook Downloads – Browse at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Metaphysics Third Edition Peter Van Inwagen

https://ebookname.com/product/metaphysics-third-edition-peter-
van-inwagen/

Real Time Java Platform Programming 1st Edition Peter


C. Dibble

https://ebookname.com/product/real-time-java-platform-
programming-1st-edition-peter-c-dibble/

Bovine Medicine Third Edition. Edition Peter D.


Cockcroft

https://ebookname.com/product/bovine-medicine-third-edition-
edition-peter-d-cockcroft/

Social Media for Scientific Institutions How to Attract


Young Academics by Using Social Media as a Marketing
Tool 1st Edition Daniel Hurrle

https://ebookname.com/product/social-media-for-scientific-
institutions-how-to-attract-young-academics-by-using-social-
media-as-a-marketing-tool-1st-edition-daniel-hurrle/
Religion and Psychology 1st Edition Michael T. Evans

https://ebookname.com/product/religion-and-psychology-1st-
edition-michael-t-evans/

Lean Development and Innovation Hitting the Market with


the Right Products at the Right Time Luciano Attolico

https://ebookname.com/product/lean-development-and-innovation-
hitting-the-market-with-the-right-products-at-the-right-time-
luciano-attolico/

The platform sutra the Zen teaching of Hui neng First


Edition Red Pine

https://ebookname.com/product/the-platform-sutra-the-zen-
teaching-of-hui-neng-first-edition-red-pine/

Sport and Exercise Psychology The Key Concepts


Routledge Key Guides 2nd Edition Wray Vamplew

https://ebookname.com/product/sport-and-exercise-psychology-the-
key-concepts-routledge-key-guides-2nd-edition-wray-vamplew/

ECGs by example 3rd Edition Richard Dean Jenkins

https://ebookname.com/product/ecgs-by-example-3rd-edition-
richard-dean-jenkins/
The Western Literary Tradition An Introduction In Texts
1st Edition Edition Margaret L. King

https://ebookname.com/product/the-western-literary-tradition-an-
introduction-in-texts-1st-edition-edition-margaret-l-king/
Java Precisely
Third Edition
Peter Sestoft

Java Precisely
Third Edition

The MIT Press


Cambridge, Massachusetts
London, England

c 2016 Massachusetts Institute of Technology

All rights reserved. No part of this book may be reproduced in any form by any electronic or mechanical
means (including photocopying, recording, or information storage and retrieval) without permission in
writing from the publisher.

MIT Press books may be purchased at special quantity discounts for business or sales promotional use.

This book was set in Times by the author using LATEX and was printed and bound in the United States of
America.

Library of Congress Cataloging-in-Publication Data


Names: Sestoft, Peter.
Title: Java precisely / Peter Sestoft.
Description: Third edition. | Cambridge, MA : The MIT Press, [2016] | Includes bibliographical references
and index.
Identifiers: LCCN 2015038522 | ISBN 9780262529075 (pbk. : alk. paper)
Subjects: LCSH: Java (Computer program language)
Classification: LCC QA76.73.J38 S435 2015 | DDC 005.13/3–dc23 LC record available at
http://lccn.loc.gov/2015038522

10 9 8 7 6 5 4 3 2 1
Contents
Preface xi

Notational Conventions xii

1 Running Java: Compilation, Loading, and Execution 2

2 Names and Reserved Names 2

3 Java Naming Conventions 2

4 Comments and Program Layout 2

5 Types 4
5.1 Primitive Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5.2 Reference Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5.3 Array Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5.4 Boxing: Wrapping Primitive Types as Reference Types . . . . . . . . . . . . . . . . . . . . . 4
5.5 Subtypes and Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
5.6 Signatures and Subsumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
5.7 Type Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

6 Variables, Parameters, Fields, and Scope 8


6.1 Values Bound to Variables, Parameters, or Fields . . . . . . . . . . . . . . . . . . . . . . . . 8
6.2 Variable Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6.3 Scope of Variables, Parameters, and Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

7 Strings 10
7.1 String Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

8 Arrays 16
8.1 Array Creation and Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
8.2 Array Initializers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
8.3 Multidimensional Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
8.4 The Utility Class Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

9 Classes 22
9.1 Class Declarations and Class Bodies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
9.2 Top-Level Classes, Nested Classes, Member Classes, and Local Classes . . . . . . . . . . . . 22
9.3 Class Modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
9.4 The Class Modifiers public, final, abstract . . . . . . . . . . . . . . . . . . . . . . . . . 24
9.5 Subclasses, Superclasses, Class Hierarchy, Inheritance, and Overriding . . . . . . . . . . . . 24
9.6 Field Declarations in Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
9.7 The Member Access Modifiers private, protected, public . . . . . . . . . . . . . . . . . 26
9.8 Method Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
9.9 Parameter Arrays and Variable-Arity Methods . . . . . . . . . . . . . . . . . . . . . . . . . 30
vi Contents

9.10 Constructor Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30


9.11 Nested Classes, Member Classes, Local Classes, and Inner Classes . . . . . . . . . . . . . . 32
9.12 Anonymous Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
9.13 Initializer Blocks, Field Initializers, and Initializers . . . . . . . . . . . . . . . . . . . . . . . 32

10 Classes and Objects in the Computer 34


10.1 What Is a Class? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
10.2 What Is an Object? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
10.3 Inner Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

11 Expressions 36
11.1 Table of Expression Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
11.2 Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
11.3 Logical Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
11.4 Bitwise Operators and Shift Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
11.5 Assignment Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
11.6 Conditional Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
11.7 Object Creation Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
11.8 Instance Test Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
11.9 Field Access Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
11.10 The Current Object Reference this . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
11.11 Type Cast Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
11.12 Method Call Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
11.13 Lambda Expressions (Java 8.0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
11.14 Method Reference Expressions (Java 8.0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

12 Statements 52
12.1 Expression Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
12.2 Block Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
12.3 The Empty Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
12.4 Choice Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
12.5 Loop Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
12.6 Returns, Labeled Statements, Exits, and Exceptions . . . . . . . . . . . . . . . . . . . . . . 60
12.7 The Try-with-Resources Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
12.8 The assert Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

13 Interfaces 66
13.1 Interface Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
13.2 Classes Implementing Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
13.3 Default and Static Methods on Interfaces (Java 8.0) . . . . . . . . . . . . . . . . . . . . . . . 68
13.4 Annotation Type Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

14 Enum Types 70

15 Exceptions, Checked and Unchecked 72

16 Compilation, Source Files, Class Names, and Class Files 74


Contents vii

17 Packages and Jar Files 74

18 Mathematical Functions 76

19 String Builders and String Buffers 78

20 Threads, Concurrent Execution, and Synchronization 80


20.1 Threads and Concurrent Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
20.2 Locks and the synchronized Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
20.3 Operations on Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
20.4 Operations on Locked Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
20.5 The Java Memory Model and Visibility Across Threads . . . . . . . . . . . . . . . . . . . . 86

21 Generic Types and Methods 88


21.1 Generics: Safety, Generality, and Efficiency . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
21.2 Generic Types, Type Parameters, and Type Instances . . . . . . . . . . . . . . . . . . . . . . 88
21.3 How Can Type Instances Be Used? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
21.4 Generic Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
21.5 Constraints on Type Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
21.6 How Can Type Parameters Be Used? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
21.7 Generic Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
21.8 Generic Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
21.9 Wildcard Type Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
21.10 The Raw Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
21.11 The Implementation of Generic Types and Methods . . . . . . . . . . . . . . . . . . . . . . 100

22 Generic Collections and Maps 102


22.1 Interface Collection<T> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
22.2 Interface List<T> and Its Implementations LinkedList<T> and ArrayList<T> . . . . . . . . . 105
22.3 Interface Set<T> and Its Implementations HashSet<T> and LinkedHashSet<T> . . . . . . . . 106
22.4 Interface SortedSet<T> and Implementation TreeSet<T> . . . . . . . . . . . . . . . . . . . 106
22.5 Interface Map<K,V> and Implementation HashMap<K,V> . . . . . . . . . . . . . . . . . . 108
22.6 Interface SortedMap<K,V> and Implementation TreeMap<K,V> . . . . . . . . . . . . . . . 110
22.7 Going through a Collection: Interfaces Iterator<T> and Iterable<T> . . . . . . . . . . . . . . 112
22.8 Interface ListIterator<T> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
22.9 Equality, Hash Codes, and Comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
22.10 The Comparator<T> Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
22.11 The Utility Class Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
22.12 Choosing the Right Collection Class or Map Class . . . . . . . . . . . . . . . . . . . . . . . 120

23 Functional Interfaces (Java 8.0) 122


23.1 Functional Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
23.2 Generic Functional Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
23.3 Primitive-Type Specialized Functional Interfaces . . . . . . . . . . . . . . . . . . . . . . . . 124
23.4 Covariance and Contravariance in Functional Interfaces . . . . . . . . . . . . . . . . . . . . 126
23.5 Interface Function<T,R> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
23.6 Interface UnaryOperator<T> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
viii Contents

23.7 Interfaces Predicate<T> and BiPredicate<T,U> . . . . . . . . . . . . . . . . . . . . . . . . . 128


23.8 Interfaces Consumer<T> and BiConsumer<T,U> . . . . . . . . . . . . . . . . . . . . . . . . 128
23.9 Interface Supplier<T> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
23.10 Interface BiFunction<T,U,R> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
23.11 Interface BinaryOperator<T> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

24 Streams for Bulk Data (Java 8.0) 132


24.1 Creating Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
24.2 Stream Builders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
24.3 Methods on Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
24.4 Numeric Streams: DoubleStream, IntStream, and LongStream . . . . . . . . . . . . . . . . . 140
24.5 Summary Statistics for Numeric Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
24.6 Collectors on Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142

25 Class Optional<T> (Java 8.0) 146

26 Input and Output 148


26.1 Creating an IO Stream from Another One . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
26.2 Kinds of Input and Output Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
26.3 Imports, Exceptions, Thread Safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
26.4 Sequential Character Input: Readers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
26.5 Sequential Character Output: Writers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
26.6 Printing Primitive Data to a Character Stream: PrintWriter . . . . . . . . . . . . . . . . . . . 154
26.7 The Appendable Interface and the CharSequence Interface . . . . . . . . . . . . . . . . . . . 154
26.8 Reading Primitive Data from a Character Stream: StreamTokenizer . . . . . . . . . . . . . . 156
26.9 Sequential Byte Input: InputStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
26.10 Sequential Byte Output: OutputStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
26.11 Binary Input-Output of Primitive Data: DataInput and DataOutput . . . . . . . . . . . . . . . 160
26.12 Serialization of Objects: ObjectInput and ObjectOutput . . . . . . . . . . . . . . . . . . . . 162
26.13 Buffered Input and Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
26.14 Random Access Files: RandomAccessFile . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
26.15 Files, Directories, and File Descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
26.16 Thread Communication: PipedInputStream and PipedOutputStream . . . . . . . . . . . . . . 168
26.17 Socket Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170

27 Reflection 172
27.1 Reflective Use of Types: The Class<T> Class . . . . . . . . . . . . . . . . . . . . . . . . . . 172
27.2 Reflection: The Field Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
27.3 Reflection: The Method Class and the Constructor<T> Class . . . . . . . . . . . . . . . . . . 174
27.4 Exceptions Thrown When Using Reflection . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

28 Metadata Annotations 176

29 What Is New in Java 8.0 178

References 180
Contents ix

Index 181
Preface
This third edition of Java Precisely gives a concise description of the Java programming language, version 8.0.
It is a quick reference for the reader who has already learned (or is learning) Java from a standard textbook and
who wants to know the language in more detail. The book presents the entire Java programming language and
essential parts of the class libraries: the collection classes, the input-output classes, the stream library and its
facilities for parallel programming, and the functional interfaces used for that.
General rules are shown on left-hand pages mostly, and corresponding examples are shown on right-hand
pages only. All examples are fragments of legal Java programs. The complete ready-to-run example programs
are available from the book Web site: www.itu.dk/people/sestoft/javaprecisely.
This third edition adds material about new methods for functional parallel processing of arrays (sec-
tion 8.4); default and static methods on interfaces (section 13.3); the memory visibility effects of volatile
and final (section 20.5); new comparator methods (section 22.10); functional interfaces (chapter 23) and the
related lambda expressions (section 11.13) and method reference expressions (section 11.14); stream process-
ing, including parallel programming and collectors (chapter 24); and the Optional class (chapter 25). In general
the book has been updated for the changes from Java 5.0 to Java 8.0. The final chapter 29 summarizes and
illustrates the new features of Java 8.0 and compares them to the C# programming language.
The book does not cover garbage collection, non-blocking input-output, the executor framework, finaliza-
tion and weak references, details of IEEE 754 floating-point numbers, or Javadoc.

Acknowledgments Thanks to Rasmus Lund, Niels Hallenberg, Hans Henrik Løvengreen, Christian Gram,
Jan Clausen, Anders Peter Ravn, Bruce Conrad, Brendan Humphreys, Hans Rischel, Ken Friis Larsen, Dan
Becker, Mads Jeppe Tarp-Johansen, Kasper Østerbye, Kasper Bilsted Graversen, Søren Eduard Jacobsen, Paul
van Bemmelen, Axel Tobias Schreiner, David Hemmendinger, Baris Aktemur, Jakob Bendsen, Jan Schoubo,
and all the anonymous reviewers and copy editors for their useful comments, suggestions, and corrections.
Special thanks to Rasmus Lund for letting me adapt his collections diagram for this book, and to Kasper
Østerbye for campaigning for a reflection chapter and providing a first draft of it.
It was a pleasure to work with Robert Prior, Valerie Geary, Deborah Cantor-Adams, Krista Magnuson,
Marc Lowenthal, Marie Lufkin Lee, Virginia Crossman, and Kathleen Hensley at The MIT Press. Thanks also
to the IT University of Copenhagen, Denmark, for support.
Notational Conventions
Symbol Meaning
a Expression or value of array type
b Boolean or byte array
C Class
cmp Comparator or Comparer
cs Character array (type char[])
cseq Character sequence (type CharSequence)
E Exception type
e Expression
f Field or function
I Interface
i Expression or value of integer type
m Method
o Expression or value of object type
p Package or predicate
s Expression or value of type String
supp Expression or value of type Supplier
sig Signature of method or constructor
t Type (primitive type or reference type)
T, U, K, V Type parameter in generic type or method
u Expression or value of thread type
v Value of any type
x Variable or parameter or field or array element
xs Stream
Java Precisely
2 Comments and Program Layout

1 Running Java: Compilation, Loading, and Execution


Before a Java program can be executed, it must be compiled and loaded. The compiler checks that the Java
program is legal: that the program conforms to the Java syntax, that operators (such as +) are applied to
operands (such as 5 and x) of the correct type, and so on. If so, the compiler generates class files. Execution
may then be started by loading the class files. Thus running a Java program involves three stages: compilation
(checks that the program is well-formed), loading (loads and initializes classes), and execution (runs the code).
This holds also for a program run from integrated development environments such as Eclipse or IntelliJ.

2 Names and Reserved Names


A legal name (of a variable, method, field, parameter, class, interface or package) starts with a letter or dollar
sign ($) or underscore (_), and continues with zero or more letters or dollar signs or underscores or digits (0–9).
Avoid dollar signs in class and interface names. Uppercase letters and lowercase letters are considered distinct.
A legal name cannot be one of the following reserved names:
abstract char else for interface protected switch try
assert class enum goto long public synchronized void
boolean const extends if native return this volatile
break continue false implements new short throw while
byte default final import null static throws
case do finally instanceof package strictfp transient
catch double float int private super true

3 Java Naming Conventions


The following naming conventions are often followed, although not enforced by Java:
• If a name is composed of several words, then each word (except possibly the first one) begins with an
uppercase letter. Examples: setLayout, addLayoutComponent.
• Names of variables, fields, and methods begin with a lowercase letter. Examples: vehicle, myVehicle.
• Names of classes and interfaces begin with an uppercase letter. Examples: Cube, ColorCube.
• Named constants (such as final static fields and enum values) are written entirely in uppercase, and
the parts of composite names are separated by underscores (_). Examples: CENTER, MAX_VALUE.
• Package names are sequences of dot-separated lowercase names. Example: java.awt.event. For
uniqueness, they are often prefixed with reverse domain names, as in com.sun.xml.util.

4 Comments and Program Layout


Comments have no effect on the execution of the program but may be inserted anywhere to help humans
understand the program. There are two forms: one-line comments and delimited comments.
Program layout has no effect on the computer’s execution of the program but is used to help humans
understand the structure of the program.
Comments and Program Layout 3

Example 1 Comments

class Comment {
// This is a one-line comment; it extends to the end of the line.
/* This is a delimited comment,
extending over several lines.
*/
int /* This delimited comment extends over part of a line */ x = 117;
}

Example 2 Recommended Program Layout Style


For reasons of space this layout style is not always followed in this book.

class Layout { // Class declaration


int x;

Layout(int x) {
this.x = x; // One-line body
}

int sum(int y) { // Multi-line body


if (x > 0) { // If statement
return x + y; // Single statement
} else if (x < 0) { // Nested if-else, block statement
int res = -x + y;
return res * 117;
} else { // x == 0 // Terminal else, block statement
int sum = 0;
for (int i=0; i<10; i++) { // For loop
sum += (y - i) * (y - i);
}
return sum;
}
}

static boolean checkdate(int mth, int day) {


int length;
switch (mth) { // Switch statement
case 2: // Single case
length = 28; break;
case 4: case 6: case 9: case 11: // Multiple case
length = 30; break;
case 1: case 3: case 5: case 7: case 8: case 10: case 12:
length = 31; break;
default:
return false;
}
return (day >= 1) && (day <= length);
}
}
4 Types

5 Types
A type is a set of values and operations on them. A type is either a primitive type or a reference type.

5.1 Primitive Types


A primitive type is either boolean or one of the numeric types char, byte, short, int, long, float, or
double. The primitive types, example literals (that is, constants), size in bits (where 8 bits equals 1 byte), and
value range, are shown in the table opposite. For readability, a number constant may contain underscores (_)
anywhere except as the first and last character of the constant.
The integer types are exact within their range. They use signed 2’s complement representation (except for
char), so when the most positive number in a type is max, then the most negative number is −max − 1. The
floating-point types are inexact and follow IEEE 754, with the number of significant digits indicated by “sigdig”
in the table. For character escape sequences such as \u0000, see page 10.

5.2 Reference Types


A reference type is a class type defined by a class declaration (section 9.1), or an interface type defined by an
interface declaration (section 13.1), or an array type (section 5.3), or an enum type (chapter 14).
A value of reference type is either null or a reference to an object or array. The special value null denotes
“no object.” The literal null, denoting the null value, can have any reference type.

5.3 Array Types


An array type has the form t[], where t is any type. An array type t[] is a reference type. Hence a value of
array type t[] is either null or a reference to an array whose element type is precisely t (when t is a primitive
type), or is a subtype of t (when t is a reference type).

5.4 Boxing: Wrapping Primitive Types as Reference Types


For every primitive type there is a corresponding wrapper class, which is a reference type. The wrapper classes
are listed in the table opposite. An object of a wrapper class contains a single value of the corresponding
primitive type.
A wrapper class must be used when a value of primitive type is passed to a method that expects a reference
type, or is stored in a variable or field of reference type. For instance, to store an int in a collection (chapter 22)
one must wrap it as an Integer object.
The conversion from primitive type to wrapper class is called boxing, and the opposite conversion is called
unboxing. Boxing and unboxing are performed automatically when needed. Boxing and unboxing may also
be performed explicitly using operations such as new Integer(i) to box the integer i, and o.intValue()
or (int)o to unbox the Integer object o. If o is null, then unboxing of o will fail at run-time by throwing
NullPointerException. Because of automatic unboxing, a Boolean value may be used in conditional statements
(if, for, while, and do-while) and in logical operators (such as !, &&, ?: and so on); and Integer and other
integer type wrapper classes may be used in switch statements.
A boxed value can be unboxed only to a value of the boxed type, or to a supertype. Thus an Integer object
can be unboxed to an int or a long because long is a supertype of int, but not to a char, byte, or short.
The wrapper classes Byte, Short, Integer, Long, Float, and Double have the common superclass Number.
Types 5

Primitive Types

Type Kind Example Literals Size Range Wrapper


boolean logical false, true 1 Boolean
char integer ’ ’, ’0’, ’A’, . . . 16 \u0000 . . . \uFFFF (unsigned) Character
byte integer 0, 1, -1, 117, . . . 8 max = 127 Byte
short integer 0, 1, -1, 117, 2_117, . . . 16 max = 32767 Short
int integer 0, 1, -1, 117, 2_117, . . . 32 max = 2147483647 Integer
long integer 0L, 1L, -1L, 117L, 2_117L, . . . 64 max = 9223372036854775807 Long
float floating -1.0f, 0.49f, 3E8f, . . . 32 ±10−38 . . . ± 1038, sigdig 6–7 Float
double floating -1.0, 0.49, 3E8, . . . 64 ±10−308 . . . ± 10308, sigdig 15–16 Double

Integer Literals Integer literals (of type byte, char, short, int, or long) may be written in four bases:

Notation Base Distinction Example Integer Literals


Decimal 10 No leading 0 1_234_567_890, 127, -127
Binary 2 Leading 0b or 0B 0b10, 0b111_1111, -0b111_1111
Octal 8 Leading 0 01234567, 0177, -0177
Hexadecimal 16 Leading 0x or 0X 0xAB_CDEF_0123, 0x7F, -0x7F

Example 3 Automatic Boxing and Unboxing


Boolean bb1 = false, bb2 = !bb1; // Boxing to [false] [true]
Integer bi1 = 117; // Boxing to [117]
Double bd1 = 1.2; // Boxing to [1.2]
boolean b1 = bb1; // Unboxing, result false
if (bb1) // Unboxing, result false
System.out.println("Not true");
int i1 = bi1 + 2; // Unboxing, result 119
// short s = bi1; // Illegal
long l = bi1; // Legal: int is subtype of long
Integer bi2 = bi1 + 2; // Unboxing, boxing, result [119]
Integer[] biarr = { 2, 3, 5, 7, 11 };
int sum = 0;
for (Integer bi : biarr)
sum += bi; // Unboxing in loop body
for (int i : biarr) // Unboxing in loop header
sum += i;
int i = 1934;
Integer bi4 = i, bi5 = i;
// Prints true true true false; bi4==bi5 is a reference comparison:
System.out.format("%b %b %b %b%n", i==i, bi4==i, i==bi5, bi4==bi5);
Boolean bbn = null;
boolean b = bbn; // Compiles OK, fails at run-time
if (bbn) // Compiles OK, fails at run-time
System.out.println("Not true");
Integer bin = null;
Integer bi6 = bin + 2; // Compiles OK, fails at run-time
6 Types

5.5 Subtypes and Compatibility


A type t1 may be a subtype of a type t2, in which case t2 is a supertype of t1. Intuitively this means that any
value v1 of type t1 can be used where a value of type t2 is expected. When t1 and t2 are reference types, t1
must provide at least the functionality (methods and fields) provided by t2. In particular, any value v1 of type
t1 may be bound to a variable or field or parameter x2 of type t2, for instance by the assignment x2 = v1 or
by parameter passing. We also say that types t1 and t2 are compatible. The following rules determine when
a type t1 is a subtype of a type t2:

• Every type is a subtype of itself.


• If t1 is a subtype of t2, and t2 is a subtype of t3, then t1 is a subtype of t3.
• If t1 and t2 are primitive types, and there is a widening (W or L) conversion from t1 to t2 according
to the table opposite, then t1 is a subtype of t2.
• If t1 and t2 are classes, then t1 is a subtype of t2 if t1 is a subclass of t2.
• If t1 and t2 are interfaces, then t1 is a subtype of t2 if t1 is a subinterface of t2.
• If t1 is a class and t2 is an interface, then t1 is a subtype of t2 provided that t1 (is a subclass of a class
that) implements t2 or implements a subinterface of t2.
• Array type t1[] is a subtype of array type t2[] if reference type t1 is a subtype of reference type t2.
• Any reference type t, including any array type, is also a subtype of predefined class Object.

No primitive type is a subtype of a reference type and no reference type is a subtype of a primitive type.
But there are automatic boxing and unboxing conversions between a primitive type and its wrapper class; see
section 5.4.

5.6 Signatures and Subsumption


A signature has form m(t1 , . . . , tn ), where m is a method or constructor name, and (t1 , . . . , tn ) is a list of
non-generic types; see example 36.
We say that a signature sig1 = m(t1 , . . . , tn ) subsumes signature sig2 = m(u1 , . . . , un ) if each ui is a subtype
of ti . We also say that sig2 is more specific than sig1 . Note that the method name m and the number n of types
must be the same in the two signatures. Since every type ti is a subtype of itself, every signature subsumes
itself. In a collection of signatures there may be one that is subsumed by all others; such a signature is called
the most specific signature.

5.7 Type Conversion


A type conversion converts a value from one type to another. A widening conversion converts from a type to
a supertype (or the type itself). A narrowing conversion converts from a type to another type. A narrowing
conversion requires an explicit type cast (section 11.11), except in an assignment x = e or initialization where
e is a compile-time integer constant (section 11.5).
The legal type conversions between primitive types are shown in the table opposite. The primitive type
boolean cannot be converted to any other primitive type. A type cast between primitive types never fails at
run-time.
Types 7

Conversion between Primitive Types


The letter C marks a narrowing conversion that requires a type cast (t)e, see section 11.11; W marks a
widening conversion that preserves the value; and L marks a widening conversion that may cause a loss of
precision. A narrowing integer conversion discards those (most significant) bits that cannot be represented in
the smaller integer type. Conversion from an integer type to a floating-point type (float or double) produces
a floating-point approximation of the integer value. Conversion from a floating-point type to an integer type
discards the fractional part of the number; that is, it rounds toward zero. When converting a too-large floating-
point number to a long or int, the result is the best approximation (that is, the type’s largest positive or the
largest negative representable number); conversion to byte, short, or char is done by converting to int and
then to the requested type.
To Type
From Type char byte short int long float double
char W C C W W W W
byte C W W W W W W
short C C W W W W W
int C C C W W L W
long C C C C W L L
float C C C C C W W
double C C C C C C W

Example 4 Conversion between Primitive Types


This example shows lossy (L) and lossless (W) widening conversions to float and double as well as narrow-
ing conversions (C) from int and double. Example 51 shows primitive conversions in assignments.
private static void floatdouble(float f, double d)
{ System.out.println(f + " " + d); }
private static void bytecharshort(byte b, char c, short s)
{ System.out.println(b + " " + (int)c + " " + s); }
private static void intint(int i1, int i2)
{ System.out.println(i1 + " " + i2); }
...
int i1 = 1000111222, i2 = 40000, i3 = -1;
floatdouble(i1, i1); // L W: 1.00011123E9 1.000111222E9
bytecharshort((byte)i2, (char)i2, (short)i2); // C C C: 64 40000 -25536
bytecharshort((byte)i3, (char)i3, (short)i3); // C C C: -1 65535 -1
intint((int)1.9, (int)-1.9); // C C: 1 -1
intint((int)1.5, (int)-1.5); // C C: 1 -1
intint((int)2.5, (int)-2.5); // C C: 2 -2

Example 5 Method Signature Subsumption


• m(double,double) subsumes itself and m(double,int) and m(int,double) and m(int,int).
• m(double,int) subsumes itself and m(int,int).
• m(int,double) subsumes itself and m(int,int).
• m(double,int) does not subsume m(int,double), nor the other way around.
• The collection m(double,int), m(int,int) has the most specific signature m(int,int).
• The collection m(double,int), m(int,double) has no most specific signature.
8 Variables, Parameters, Fields, and Scope

6 Variables, Parameters, Fields, and Scope


A variable is declared inside a method, constructor, initializer block, or block statement (section 12.2). The
variable can be used only in that block statement (or method or constructor or initializer block), and only after
its declaration.
A parameter is a special kind of variable: it is declared in the parameter list of a method or constructor,
and is given a value when the method or constructor is called. The parameter can be used only in that method
or constructor.
A field is declared inside a class, but not inside a method or constructor or initializer block of the class. It
can be used anywhere in the class, also textually before its declaration.

6.1 Values Bound to Variables, Parameters, or Fields


A variable, parameter, or field of primitive type holds a value of that type, such as the boolean false, the
integer 117, or the floating-point number 1.7. A variable, parameter, or field of reference type t either has the
special value null or holds a reference to an object or array. If it is an object, then the run-time class of that
object must be t or a subclass of t.

6.2 Variable Declarations


The purpose of a variable is to hold a value during the execution of a block statement (or method or constructor
or initializer block). A variable-declaration has one of the forms
variable-modifier type varname1, varname2, ... ;
variable-modifier type varname1 = initializer1, ... ;
A variable-modifier may be final or absent. If a variable is declared final, then it must be initialized
or assigned at most once at run-time (exactly once if it is ever used): it is a named constant. However, if the
variable has reference type, then the object or array pointed to by the variable may still be modified. A variable
initializer may be an expression or an array initializer (section 8.2).
Execution of the variable declaration will reserve space for the variable, then evaluate the initializer, if
any, and store the resulting value in the variable. Unlike a field, a variable is not given a default value when
declared, but the compiler checks that it has been given a value before it is used.

6.3 Scope of Variables, Parameters, and Fields


The scope of a name is that part of the program in which the name is visible. The scope of a variable extends
from just after its declaration to the end of the innermost enclosing block statement. The scope of a method
or constructor parameter is the entire method or constructor body. For a control variable x declared in a for
statement
for (int x = ...; ...; ...) body

the scope is the entire for statement, including the header and the body.
Within the scope of a variable or parameter x, one cannot redeclare x. However, one may declare a variable
x within the scope of a field x, thus shadowing the field. Hence the scope of a field x is the entire class, except
where shadowed by a variable or parameter of the same name, and except for initializers preceding the field’s
declaration (section 9.1).
Variables, Parameters, Fields, and Scope 9

Example 6 Variable Declarations

public static void main(String[] args) {


int a, b, c;
int x = 1, y = 2, z = 3;
int ratio = z/x;
final double PI = 3.141592653589;
boolean found = false;
final int maxyz;
if (z > y) maxyz = z; else maxyz = y;
}

Example 7 Scope of Fields, Parameters, and Variables


This program declares five variables or fields, all called x, and shows where each one is in scope (visible). The
variables and fields are labeled #1, . . . , #5 for reference.

class Scope {
... //
void m1(int x) { // Declaration of parameter x (#1)
... // x #1 in scope
} //
... //
void m2(int v2) { //
... // x #5 in scope
} //
... //
void m3(int v3) { //
... // x #5 in scope
int x; // Declaration of variable x (#2)
... // x #2 in scope
} //
... //
void m4(int v4) { //
... // x #5 in scope
{ //
int x; // Declaration of variable x (#3)
... // x #3 in scope
} //
... // x #5 in scope
{ //
int x; // Declaration of variable x (#4)
... // x #4 in scope
} //
... // x #5 in scope
} //
... //
int x; // Declaration of field x (#5)
... // x #5 in scope
}
10 Strings

7 Strings
A string is an object of the predefined class String. It is immutable: once created it cannot be changed. A
string literal is a sequence of characters within double quotes: "New York", "A38", "", and so on. Internally,
a character is stored as a number using the Unicode [1] character encoding, whose character codes 0–127
coincide with the old ASCII encoding. String literals and character literals may use character escape sequences:
Escape Code Meaning
\b backspace
\t horizontal tab
\n newline
\f form feed (page break)
\r carriage return
\" the double quote character
\’ the single quote character
\\ the backslash character
\ddd the character whose character code is the three-digit octal number ddd
\udddd the character whose character code is the four-digit hexadecimal number dddd
A character escape sequence represents a single character. Since the letter A has code 65 (decimal), which is
written 101 in octal and 0041 in hexadecimal, the string literal "A\101\u0041" is the same as "AAA". If s1
and s2 are expressions of type String and v is an expression of any type, then
• s1.length() of type int is the length of s1, that is, the number of characters in s1.
• s1.equals(s2) of type boolean is true if s1 and s2 contain the same sequence of characters, and
false otherwise; equalsIgnoreCase is similar but does not distinguish lowercase and uppercase.
• s1.charAt(i) of type char is the character at position i in s1, counting from 0. If the index i is less
than 0, or greater than or equal to s1.length(), then StringIndexOutOfBoundsException is thrown.
• s1.toString() of type String is the same object as s1.
• String.valueOf(v) returns the string representation of v, which can have any primitive type (sec-
tion 5.1) or reference type. When v has reference type and is not null, then it is converted using
v.toString(); if it is null, then it is converted to the string "null". Any class C inherits from Object
a default toString method that produces strings of the form C@2a5734, where 2a5734 is some memory
address, but toString may be overridden to produce more useful strings.
• s1 + s2 has the same meaning as s1.concat(s2): it constructs the concatenation of s1 and s2, a new
String consisting of the characters of s1 followed by the characters of s2. Both s1 + v and v + s1 are
evaluated by converting v to a string with String.valueOf(v), thus using v.toString() when v has
reference type, and then concatenating the resulting strings.
• s1.compareTo(s2) returns a negative integer, zero, or a positive integer, according as s1 precedes,
equals, or follows s2 in the usual lexicographical ordering based on the Unicode [1] character encoding.
If s1 or s2 is null, then the exception NullPointerException is thrown. Method compareToIgnoreCase
is similar but does not distinguish lowercase and uppercase.
• s1.substring(int i, int j) returns a new String of the characters from s1 with indexes i..(j-1).
Throws IndexOutOfBoundsException if i<0 or i>j or j>s1.length.
• s1.subSequence(int i, int j) is like substring but returns a CharSequence (section 26.7).
• More String methods are described in the Java class library documentation [2].
Strings 11

Example 8 Equality of Strings and the Subtlety of the (+) Operator


String s1 = "abc";
String s2 = s1 + ""; // New object, but contains same text as s1
String s3 = s1; // Same object as s1
String s4 = s1.toString(); // Same object as s1
// The following statements print false, true, true, true, true:
System.out.println("s1 and s2 identical objects: " + (s1 == s2));
System.out.println("s1 and s3 identical objects: " + (s1 == s3));
System.out.println("s1 and s4 identical objects: " + (s1 == s4));
System.out.println("s1 and s2 contain same text: " + (s1.equals(s2)));
System.out.println("s1 and s3 contain same text: " + (s1.equals(s3)));
// These two statements print 35A and A1025 because (+) is left-associative:
System.out.println(10 + 25 + "A"); // Same as (10 + 25) + "A"
System.out.println("A" + 10 + 25); // Same as ("A" + 10) + 25

Example 9 Concatenating All Command Line Arguments


When concatenating many strings, use a string builder instead (chapter 19 and example 104).
public static void main(String[] args) {
String res = "";
for (int i=0; i<args.length; i++)
res += args[i];
System.out.println(res);
}

Example 10 Counting the Number of e’s in a String


static int ecount(String s) {
int ecount = 0;
for (int i=0; i<s.length(); i++)
if (s.charAt(i) == ’e’)
ecount++;
return ecount;
}

Example 11 Determining Whether Strings Occur in Lexicographically Increasing Order


static boolean sorted(String[] a) {
for (int i=1; i<a.length; i++)
if (a[i-1].compareTo(a[i]) > 0)
return false;
return true;
}

Example 12 Using a Class That Declares a toString Method


The class Point (example 27) declares a toString method that returns a string of the point coordinates. The
operator (+) calls the toString method implicitly to format the Point objects.
Point p1 = new Point(10, 20), Point p2 = new Point(30, 40);
System.out.println("p1 is " + p1); // Prints: p1 is (10, 20)
System.out.println("p2 is " + p2); // Prints: p2 is (30, 40)
p2.move(7, 7);
System.out.println("p2 is " + p2); // Prints: p2 is (37, 47)
12 Strings

7.1 String Formatting


Formatting of numbers, characters, dates, times, and other data may be done using a formatting string fmt
containing formatting specifiers, using one of these methods:

• String.format(fmt, v1, ..., vn) returns a String produced from fmt by replacing formatting
specifiers with the strings resulting from formatting the values v1, . . . , vn.
• strm.format(fmt, v1, ..., vn), where strm is a PrintWriter or PrintStream (section 26.6), con-
structs a string as above, outputs it to strm, and returns strm.
• strm.printf(fmt, v1, ..., vn) behaves exactly as strm.format(fmt, v1, ..., vn).

These methods exist also in a version that take a Locale object as first argument; see examples 16 and 17.
Formatting specifiers are described in sections 7.1.1 and 7.1.2 below. If a value vi is of the wrong type for
a given formatting specifier, or if the formatting specifier is ill-formed, then a call to the above methods will
throw an exception of class IllegalFormatException or one of its subclasses.

7.1.1 Formatting of Numeric, Character, and General Types


A formatting specifier for numeric, character, and general types has this form:
%[index$][flags][width][.precision]conversion

The index is an integer 1, 2, . . . indicating the value vindex to format; the conversion indicates what operation is
used to format the value; the width indicates the minimum number of characters used to format the value; the
flags indicate how that width should be used (where “-” means left-justification, or padding on the right, and
“0” means padding with zero); and precision limits the output, such as the number of fractional digits. Each of
the four parts in brackets [ ] is optional; the only mandatory parts are the percent sign (%) and the conversion.
The documentation for Java API class java.util.Formatter gives the full details of number formatting. The
table below shows the legal conversions on numbers (I = integers, F = floating-point numbers, IF = both),
characters (C), and general types (G). An uppercase conversion such as X produces uppercase output.

Format conversion flags precision Type


Decimal d -+ 0,( I
Octal o -#0 I
Hexadecimal x or X -#0 I
Hexadecimal significand and exponent a or A -#+ 0 F
General: scientific or fractional g or G -#+ 0,( Max. significant digits IF
Fixed-point number f -#+ 0,( Fractional digits IF
Scientific notation e or E -#+ 0,( Fractional digits IF
Unicode character [1] c or C - C
Boolean: "true" or "false" b or B - Boolean
Hexadecimal hashcode of value, or "null" h or H - G
Determined by value’s formatTo method s or S - G
A percent symbol (%) % (none)
Platform-specific newline n (none)
Another Random Document on
Scribd Without Any Related Topics
Dns. Barth. de Wendone, Rector. Dns. Rogerus,
Capellanus.

Dominus Robertus de Walsham, precentor of Sarum (f. 100 v.), is in


his choir habit, a white surplice, and over it a fur amys fastened at
the throat with a brooch. Dns. Robertus de Hereforde, Dean of
Sarum (f. 101), has a lilac robe and hood fastened by a gold brooch.
There is another dean, Magister Johnnes Appleby, Dean of St. Paul’s,
at f. 105, whose costume is not very distinctly drawn. It may be
necessary to assure some of our readers, that the colours here
described were not given at the caprice of a limner wishing to make
his page look gay. The portraits were perhaps imaginary, but the
personages are habited in the costume proper to their rank and
order. The series of Benedictine abbots and monks in the same book
are in black robes; other monks introduced are in the proper habit of
their order; a king in his royal robes; a knight sometimes in armour,
sometimes in the civil costume of his rank, with a sword by his side,
and a chaplet round his flowing hair; a lady in the fashionable dress
of the time; a burgher in his proper habit, with his hair cut short.
And so the clergy are represented in the dress which they usually
wore; and, for our purpose, the pictures are more valuable than if
they were actual portraits of individual peculiarities of costume,
because we are the more sure that they give us the usual and
recognised costume of the several characters. Indeed, it is a rule,
which has very rare exceptions, that the mediæval illuminators
represented contemporary subjects with scrupulous accuracy. We
give another representation from the picture of John Ball, the priest
who was concerned in Wat Tyler’s rebellion, taken from a MS. of
Froissart’s Chronicle, in the Bibliothèque Impériale at Paris. The
whole picture is interesting; the background is a church, in whose
churchyard are three tall crosses. Ball is preaching from the pulpit of
his saddle to the crowd of insurgents who occupy the left side of the
picture. In the Froissart MS. Harl. 4,380, at f. 20, is a picture of un
vaillant homme et clerque nommé Maistre Johan Warennes,
preaching against Pope Boniface; he is in a pulpit panelled in green
and gold, with a pall hung over the front, and the people sit on
benches before him; he is habited in a blue robe and hood lined with
white.
John Ball, Priest.

The author of Piers Ploughman, carping at the clergy in the latter


half of the fourteenth century, says it would be better
“If many a priest bare for their baselards and their
brooches,
A pair of beads in their hand, and a book under their arm.
Sire[304] John and Sire Geffrey hath a girdle of silver,
A baselard and a knife, with botons overgilt.”
A little later, he speaks of proud priests habited in patlocks,—a short
jacket worn by laymen,—with peaked shoes and large knives or
daggers. And in the poems of John Audelay, in the fifteenth century,
a parish priest is described in
“His girdle harnesched with silver, his baselard hangs by.”
In the wills of the clergy they themselves describe their “togas” of
gay colours, trimmed with various furs, and their ornamented girdles
and purses, and make no secret of the objectionable knives and
baselards. In the Bury St. Edmunds Wills, Adam de Stanton, a
chaplain, a.d. 1370, bequeaths one girdle, with purse and knife,
valued at 5s.—a rather large sum of money in those days. In the
York wills, John Wynd-hill, Rector of Arnecliffe, a.d. 1431, bequeaths
a pair of amber beads, such as Piers Ploughman says a priest ought
“to bear in his hand, and a book under his arm;” and, curiously
enough, in the next sentence he leaves “an English book of Piers
Ploughman;” but he does not seem to have been much influenced
by the popular poet’s invectives, for he goes on to bequeath two
green gowns and one of murrey and one of sanguine colour, besides
two of black, all trimmed with various furs; also, one girdle of
sanguine silk, ornamented with silver, and gilded, and another zone
of green and white, ornamented with silver and gilded; and he also
leaves behind him—proh pudor—his best silver girdle, and a
baselard with ivory and silver handle. John Gilby, Rector of Knesale,
1434-5, leaves a red toga, furred with byce, a black zone of silk with
gilt bars, and a zone ornamented with silver. J. Bagule, Rector of All
Saints, York, a.d. 1438, leaves a little baselard, with a zone
harnessed with silver, to Sir T. Astell, a chaplain. W. Duffield, a
chantry priest at York, a.d. 1443, leaves a black zone silvered, a
purse called a “gypsire,” and a white purse of “Burdeux.” W. Siverd,
chaplain, leaves to H. Hobshot a hawk-bag; and to W. Day, parochial
chaplain of Calton, a pair of hawk-bag rings; and to J. Sarle,
chaplain, “my ruby zone, silvered, and my toga, furred with
‘bevers;’” and to the wife of J. Bridlington, “a ruby purse of satin.” R.
Rolleston, provost of the church of Beverley, a.d. 1450, leaves a
“toga lunata” with a red hood, a toga and hood of violet, a long toga
and hood of black, trimmed with martrons, and a toga and hood of
violet. J. Clyft, chaplain, a.d. 1455, leaves a zone of silk, ornamented
with silver. J. Tidman, chaplain, a.d. 1458, a toga of violet and one of
meld. C. Lassels, chaplain, a.d. 1461, a green toga and a white zone,
silvered. T. Horneby, rector of Stokesley, a.d. 1464, a red toga and
hood; and, among the Richmondshire Wills, we find that of Sir Henry
Halled, Lady-priest of the parish of Kirby-in-Kendal, in 1542 a.d. (four
years before the suppression of the chantries), who leaves a short
gown and a long gown, whose colour is not specified, but was
probably black, which seems by this time to have been the most
usual clerical wear.
The accompanying woodcut will admirably illustrate the ornamented
girdle, purse, and knife, of which we have been reading. It is from a
MS. of Chaucer’s poem of the Romaunt of the Rose (Harl. 4,425, f.
143), and represents a priest confessing a lady in a church. The
characters in the scene are, like the poem, allegorical; the priest is
Genius, and the lady is Dame Nature; but it is not the less an
accurate picture of a confessional scene of the latter part of the
fourteenth century. The priest is habited in a robe of purple, with a
black cap and a black liripipe attached to it, brought over the
shoulder to the front, and falling over the arm. The tab, peeping
from beneath the cap above the ear, is red; the girdle, purse, and
knife, are, in the original illumination, very clearly represented. In
another picture of the same person, at f. 106, the black girdle is
represented as ornamented with little circles of gold.
A Priest Confessing a Lady.

Many of these clergymen had one black toga with hood en suite—
not for constant use in divine service, for, as we have already seen,
they are generally represented in the illuminations with coloured
“togas” under their surplices,—but perhaps, for wear on mourning
occasions. Thus, in the presentations of York Cathedral, a.d. 1519,
“We thynke it were convenient that whene we fetche a corse to the
churche, that we shulde be in our blak abbettes [habits] mornyngly,
wt our hodes of the same of our hedes, as is used in many other
places.”[305]
At the time of the Reformation, when the English clergy abandoned
the mediæval official robes, they also desisted from wearing the
tonsure, which had for many centuries been the distinguishing mark
of a cleric, and they seem generally to have adopted the academical
dress, for the model both of their official and their ordinary dress.
The Puritan clergy adopted a costume which differed little, if at all,
from that of the laity of the same school. But it is curious that this
question of clerical dress continued to be one of complaint on one
side, and resistance on the other, down to the end of our
ecclesiastical legislation. The 74th canon of 1603 is as rhetorical in
form, and as querulous in tone, and as minute in its description of
the way in which ecclesiastical persons should, and the way in which
they should not, dress, as is the Injunction of 1342, which we have
already quoted. “The true, ancient, and flourishing churches of
Christ, being ever desirous that their prelacy and clergy might be
had as well in outward reverence, as otherwise regarded for the
worthiness of their ministry, did think it fit, by a prescript form of
decent and comely apparel, to have them known to the people, and
thereby to receive the honour and estimation due to the special
messengers and ministers of Almighty God: we, therefore, following
their grave judgment and the ancient custom of the Church of
England, and hoping that in time new fangleness of apparel in some
factious persons will die of itself, do constitute and appoint, that the
archbishops and bishops shall not intermit to use the accustomed
apparel of their degree. Likewise, all deans, masters of colleges,
archdeacons, and prebendaries, in cathedrals and collegiate
churches (being priests or deacons), doctors in divinity, law, and
physic, bachelors in divinity, masters of arts, and bachelors of law,
having any ecclesiastical living, shall wear gowns with standing
collars, and sleeves straight at the hands, or wide sleeves, as is used
in the universities, with hoods or tippets of silk or sarcenet, and
square caps; and that all other ministers admitted, or to be
admitted, into that function, shall also usually wear the like apparel
as is aforesaid, except tippets only. We do further in like manner
ordain, that all the said ecclesiastical persons above mentioned shall
usually wear on their journeys cloaks with sleeves, commonly called
Priests’ Cloaks, without guards, welts, long buttons, or cuts. And no
ecclesiastical person shall wear any coif, or wrought night-cap, but
only plain night caps of black silk, satin, or velvet. In all which
particulars concerning the apparel here prescribed, our meaning is
not to attribute any holiness or special worthiness to the said
garments, but for decency, gravity, and order, as is before specified.
In private houses and in their studies the said persons ecclesiastical
may use any comely and scholarlike apparel, provided that it be not
cut or pinkt; and that in public they go not in their doublet and hose
without coats or cassocks; and that they wear not any light-coloured
stockings. Likewise, poor beneficed men and curates (not being able
to provide themselves long gowns) may go in short gowns of the
fashion aforesaid.”
The portraits prefixed to the folio works of the great divines of the
sixteenth and seventeenth centuries have made us familiar with the
fact, that at the time of the Reformation the clergy wore the beard
and moustache. They continued to wear the cassock and gown as
their ordinary out-door costume until as late as the time of George
II.; but in the fashion of doublet and hose, hats, shoes, and hair,
they followed the custom of other gentlemen. Mr. Fairholt, in his
“Costume in England,” p. 327, gives us a woodcut from a print of
1680 a.d., which admirably illustrates the ordinary out-door dress of
a clergyman of the time of William and Mary.
CHAPTER V.
PARSONAGE HOUSES.

hen, in our endeavour to realise the life of these secular


clergymen of the Middle Ages, we come to inquire, What
sort of houses did they live in? how were these furnished?
what sort of life did their occupants lead? what kind of
men were they? it is curious how little seems to be generally known
on the subject, compared with what we know about the houses and
life and character of the regular orders. Instead of gathering
together what others have said, we find ourselves engaged in an
original investigation of a new and obscure subject. The case of the
cathedral and collegiate clergy, and that of the isolated parochial
clergy, form two distinct branches of the subject. The limited space
at our disposal will not permit us to do justice to both; the latter
branch of the subject is less known, and perhaps the more generally
interesting, and we shall therefore devote the bulk of our space to it.
We will only premise a few words on the former branch.
The bishop of a cathedral of secular canons had his house near his
cathedral, in which he maintained a household equal in numbers and
expense to that of the secular barons among whom he took rank;
the chief difference being, that the spiritual lord’s family consisted
rather of chaplains and clerks than of squires and men-at-arms. The
bishop’s palace at Wells is a very interesting example in an unusually
perfect condition. Britton gives an engraving of it as it appeared
before the reign of Edward VI. The bishop besides had other
residences on his manors, some of which were castles like those of
the other nobility. Farnham, the present residence of the see of
Winchester, is a noble example, which still serves its original
purpose. Of the cathedral closes many still remain sufficiently
unchanged to enable us to understand their original condition. Take
Lincoln for example. On the north side of the church, in the angle
between the nave and transept, was the cloister, with the polygonal
chapter-house on the east side. The lofty wall which enclosed the
precincts yet remains, with its main entrance in the middle of the
west wall, opposite the great doors of the cathedral. This gate,
called the Exchequer Gate, has chambers over it, devoted probably
to the official business of the diocese. There are two other smaller
gates at the north-east and south-east corners of the close, and
there is a postern on the south side. The bishop’s palace, whose
beautiful and interesting ruins and charming grounds still remain,
occupied the slope of the southern hill outside the close. The vicar’s
court is in the corner of the close near the gateway to the palace
grounds. A fourteenth-century house, which was the official
residence of the chaplain of one of the endowed chantries, still
remains on the south side of the close, nearly opposite the choir
door. On the east side of the close the fifteenth-century houses of
several of the canons still remain, and are interesting examples of
the domestic architecture of the time. It is not difficult from these
data to picture to ourselves the original condition of this noble
establishment when the cathedral, with its cloister and chapter-
house, stood isolated in the middle of the green sward, and the
houses of the canons and chaplains formed a great irregular
quadrangle round it, and the close walls shut them all in from the
outer world, and the halls and towers of the bishop’s palace were
still perfect amidst its hanging gardens enclosed within their own
walls, the quadrangle of houses which had been built for the
cathedral vicars occupying a corner cut out of the bishop’s grounds
beside his gateway. And we can repeople the restored close. Let it
be on the morning of one of the great festivals; let the great bells be
ringing out their summons to high mass; and we shall see the
dignified canons in amice and cap crossing the green singly on their
way from their houses to their stalls in the choir; the vicars
conversing in a little group as they come across from their court; the
surpliced chorister boys under the charge of their schoolmaster; a
band of minstrels with flutes, and hautboys, and viols, and harps,
and organs, coming in from the city, to use their instruments in the
rood-loft to aid the voices of the choir; scattered clerks and country
clergy, and townspeople, are all converging to the great south door;
and last of all the lord bishop, in cope and mitre, emerges from his
gateway, preceded by his cross-bearer, attended by noble or royal
guests, and followed by a suite of officials and clerks; while over all
the great bells ring out their joyous peal to summon the people to
the solemn worship of God in the mother church of the vast diocese.

But we must turn to our researches into the humbler life of the
country rectors and vicars. And first, what sort of houses did they
live in? We have not been able to find one of the parsonage houses
of an earlier date than the Reformation still remaining in a condition
sufficiently unaltered to enable us to understand what they originally
were. There is an ancient rectory house of the fourteenth century at
West Deane, Sussex,[306] of which we give a ground-plan and north-
east view on the following page; but the rectory belonged to the
prior and convent of Benedictine Monks of Wilmington, and this
house was probably their grange, or cell, and may have been
inhabited by two of their monks, or by their tenant, and not by the
parish priest. Again, there is a very picturesque rectory house, of the
fifteenth century, at Little Chesterton, near Cambridge,[307] but this
again is believed to have been a grange, or cell, of a monastic
house.
In the absence of actual examples, we are driven to glean what
information we can from other sources. There remain to us a good
many of the deeds of the thirteenth and fourteenth centuries, by
which, on the impropriation of the benefices, provision was made for
the permanent endowment of vicarages in them. In the majority of
cases the old rectory house was assigned as the future vicarage
house, and no detailed description of it was necessary; but in the
deed by which the rectories of Sawbridgeworth, in Herts, and
Kelvedon, in Essex, were appropriated to the convent of
Westminster, we are so fortunate as to find descriptions of the
fourteenth-century parsonage houses, one of which is so detailed as
to enable any one who is acquainted with the domestic architecture
of the time to form a very definite picture of the whole building. In
the case of Sawbridgeworth, the old rectory house was assigned as
the vicarage house, and is thus described—“All the messuage which
is called the priest’s messuage, with the houses thereon built, that is
to say, one hall with two chambers, with a buttery, cellar, kitchen,
stable, and other fitting and decent houses, with all the garden as it
is enclosed with walls to the said messuage belonging.” The
description of the parsonage house at Kelvedon is much more
definite and intelligible. For this the deed tells us the convent
assigned—“One hall situate in the manor of the said abbot and
convent near the said church, with a chamber and soler at one end
of the hall and with a buttery and cellar at the other. Also one other
house in three parts, that is to say, for a kitchen with a convenient
chamber in the end of the said house for guests, and a bakehouse.
Also one other house in two parts, next the gate at the entrance of
the manor, for a stable and cowhouse. He (the vicar) shall also have
a convenient grange, to be built within a year at the expense of the
prior and convent. He shall also have the curtilage with the garden
adjoining to the hall on the north side, as it is enclosed with hedges
and ditches.” The date of the deed is 1356 a.d., and it speaks of
these houses as already existing. Now the common arrangement of
a small house at that date, and for near a century before and after,
was this, “a hall in the centre, with a soler at one end and offices at
the other.”[308] A description which exactly agrees with the account
of the Kelvedon house, and enables us to say with great probability
that in the Sawbridgeworth “priest’s messuage” also, the two
chambers were at one end of the hall, and the buttery, cellar, and
kitchen at the other, the stable and other fitting and decent houses
being detached from and not forming any portion of the dwelling
house.
Rectory House, West Deane, Sussex.

A Entrance door. C Cellar window. E A recess.


B Windows. D Entrance to stair. F Fire-place.
ft. in.
Length of exterior 35 6
Width of interior 14 10
Thickness of wall 2 6
Height of rooms 8 0

Confining ourselves, however, to the Kelvedon house, a little study


will enable us to reconstruct it conjecturally with a very high
probability of being minutely accurate in our conjectures. First of all,
a house of this character in the county of Essex would, beyond
question, be a timber house. To make our description clearer we
have given a rough diagram of our conjectural arrangement. Its
principal feature was, of course, the “one hall” (a). We know at once
what the hall of a timber house of this period of architecture would
be. It would be a rather spacious and lofty apartment, with an open
timber roof; the principal door of the house would open into the
“screens” (d), at the lower end of the hall, and the back door of the
house would be at the other end of the screens. At the upper end of
the hall would be the raised dais (b), at which the master of the
house sat with his family. The fireplace would either be an open
hearth in the middle of the hall, like that which still exists in the
fourteenth-century hall at Penshurst Place, Kent, or it would be an
open fireplace, under a projecting chimney, at the further side of the
hall, such as is frequently seen in MS. illuminations of the small
houses of the period. There was next “a chamber and soler at one
end of the hall.” The soler of a mediæval house was the chief
apartment after the hall, it answered to the “great chamber” of the
sixteenth century, and to the parlour or drawing-room of more
modern times. It was usually adjacent to the upper end of the hall,
and built on transversely to it, with a window at each end. It was
usually raised on an undercroft, which was used as a storeroom or
cellar, so that it was reached by a stair from the upper end of the
hall. Sometimes, instead of a mere undercroft, there was a chamber
under the soler, which was the case here, so that we have added
these features to our plan (c). Next there was “a buttery and cellar
at the other” end of the hall. In the buttery in those days were kept
wine and beer, table linen, cups, pots, &c.: and in the cellar the
stores of eatables which, it must be remembered, were not bought
in weekly from the village shop, or the next market town, but were
partly the produce of the glebe and tithe, and partly were laid in
yearly or half-yearly at some neighbouring fair. The buttery and
cellar—they who are familiar with old houses, or with our colleges,
will remember—are always at the lower end of the hall, and open
upon the screens, with two whole or half doors side by side; we may
therefore add them thus upon our plan (h, i).

Conjectural Plan of Rectory-House at Kelvedon, Essex.

The deed adds, “Also one other house in three parts.” In those days
the rooms of a house were not massed compactly together under
one roof, but were built in separate buildings more or less detached,
and each building was called a house; “One other house in three
parts, that is to say, a kitchen with a convenient chamber at one end
of the said house for guests, and a bakehouse.” “The kitchen,” says
Mr. Parker, in his “Domestic Architecture,” “was frequently a
detached building, often connected with the hall by a passage or
alley leading from the screens;” and it was often of greater relative
size and importance than modern usage would lead us to suppose;
the kitchens of old monasteries, mansion houses, and colleges often
have almost the size and architectural character of a second hall. In
the case before us it was a section of the “other house,” and
probably occupied its whole height, with an open timber roof (g). In
the disposition of the bakehouse and convenient chamber for guests
which were also in this other house, we meet with our first difficulty;
the “chamber” might possibly be over the bakehouse, which took the
usual form of an undercroft beneath the guest chamber; but the
definition that the house was divided “in three parts” suggests that it
was divided from top to bottom into three distinct sections. Inclining
to the latter opinion, we have so disposed these apartments in our
plan (f, e).
The elevation of the house may be conjectured with as much
probability as its plan. Standing in front of it we should have the side
of the hall towards us, with the arched door at its lower end, and
perhaps two windows in the side with carved wood tracery[309] in
their heads. To the right would be the gable end of the chamber
with soler over it; the soler would probably have a rather large
arched and traceried window in the end, the chamber a smaller and
perhaps square-headed light. On the left would be the building,
perhaps a lean-to, containing the buttery and cellar, with only a
small square-headed light in front. The accompanying wood-cut of a
fourteenth-century house, from the Add. MSS. 10,292, will help to
illustrate our conjectural elevation of Kelvedon Rectory. It has the
hall with its great door and arched traceried window, and at the one
end a chamber and soler over it. It only wants the offices at the
other end to make the resemblance complete.[310]
A Fourteenth Century House.

Of later date probably and greater size, resembling a moated manor


house, was the rectory of Great Bromley, Essex, which is thus
described in the terrier of 1610 a.d.: “A large parsonage house
compass’d with a Mote, a Gate-house, with a large chamber, and a
substantial bridge of timber adjoining to it, a little yard, an orchard,
and a little garden, all within the Mote, which, together with the
Circuit of the House, contains about half an Acre of Ground; and
without the Mote there is a Yard, in which there is another Gate-
house and a stable, and a hay house adjoining; also a barn of 25
yards long and 9 yards wide, and about 79 Acres and a-half of
glebeland.”[311] The outbuildings were perhaps arranged as a
courtyard outside the moat to which the gate-house formed an
entrance, so that the visitor would pass through this outer gate,
through the court of offices, over the bridge, and through the
second gate-house into the base court of the house. This is the
arrangement at Ightham Mote, Kent.
The parish chaplains seem to have had houses of residence provided
for them. The parish of St. Michael-le-Belfry, York, complained in its
visitation presentment, in the year 1409, that there was no house
assigned for the parish chaplain or for the parish clerk. That they
were small houses we gather from the fact that in some of the
settlements of vicarages it is required that a competent house shall
be built for the vicar where the parish chaplain has been used to
live; e.g. at Great Bentley, Essex, it was ordered in 1323, that the
vicars “shall have one competent dwelling-house with a sufficient
curtilage, where the parish chaplain did use to abide, to be prepared
at the cost of the said prior and convent.”[312] And at the settlement
of the vicarage of St. Peter’s, Colchester, a.d. 1319, it was required
that “the convent of St. Botolph’s, the impropriators, should prepare
a competent house for the vicar in the ground of the churchyard
where a house was built for the parish chaplain of the said church.”
At Radwinter, Essex, we find by the terrier of 1610 a.d., that there
were two mansions belonging to the benefice, “on the south side of
the church, towards the west end, one called the great vicarage, and
in ancient time the Domus Capellanorum, and the other the less
vicarage,” which latter “formerly served for the ease of the Parson,
and, as appears by evidence, first given to the end that if any of the
parish were sick, the party might be sure to find the Parson or his
curate near the church ready to go and visit him.” At the south-west
corner of the churchyard of Doddinghurst, Essex, there still exists a
little house of fifteenth-century date, which may have been such a
curate’s house.
From a comparison of these parsonages with the usual plan and
arrangement of the houses of laymen of the fourteenth century, may
be made the important deduction that the houses of the parochial
clergy had no ecclesiastical peculiarities of arrangement; they were
not little monasteries or great recluse houses, they were like the
houses of the laity; and this agrees with the conclusions to which we
have arrived already by other roads, that the secular clergy lived in
very much the same style as laymen of a similar degree of wealth
and social standing. The poor clerk lived in a single chamber of a
citizen’s house; the town priest had a house like those of the
citizens; the country rector or vicar a house like the manor houses of
the smaller gentry.
As to the furniture of the parsonage, the wills of the clergy supply us
with ample authorities. We will select one of about the date of the
Kelvedon parsonage house which we have been studying, to help us
to conjecturally furnish the house which we have conjecturally built.
Here is an inventory of the goods of Adam de Stanton, a chaplain,
date 1370 a.d., taken from Mr. Tymms’s collection of Bury wills.
“Imprimis, in money vis. viiid. and i seal of silver worth ijs.” The
money will seem a fair sum to have in hand when we consider the
greater value of money then and especially the comparative scarcity
of actual coin. The seal was probably his official seal as chaplain of
an endowed chantry; we have extant examples of such seals of the
beneficed clergy. “Item, iij brass pots and i posnet worth xjs. vjd.
Item, in plate, xxijd. Item, a round pot with a laver, js. vjd.,” probably
an ewer and basin for washing the hands, like those still used in
Germany, &c. “Item, in iron instruments, vjs. viiijd. and vjd.,” perhaps
fire-dogs and poker, spit, and pothook. “Item, in pewter vessels, iiijs.
ijd.,” probably plates, dishes, and spoons. “Item, of wooden utensils,”
which, from comparison with other inventories of about the same
period, we suppose may be boards and trestles for tables, and
benches, and a chair, and perhaps may include trenchers and bowls.
“Item, i portiforum, xs.,” a book of church service so called, which
must have been a handsome one to be worth ten shillings, perhaps
it was illuminated. “Item, j book de Lege and j Par Statutorum, and j
Book of Romances.[313] Item, j girdle with purse and knife, vs.” on
which we have already commented in our last chapter. “Item, j pair
of knives for the table, xijd. Item, j saddle with bridle and spurs, iijs.
Item, of linen and woollen garments, xxviijs. and xijd. Item, of chests
and caskets, vjs. ijd.,” Chests and caskets then served for cupboards
and drawers.[314]
If we compare these clerical inventories with those of contemporary
laymen of the same degree, we shall find that a country parson’s
house was furnished like a small manor house, and that his domestic
economy was very like that of the gentry of a like income. Matthew
Paris tells us an anecdote of a certain handsome clerk, the rector of
a rich church, who surpassed all the knights living around him in
giving repeated entertainments and acts of hospitality.[315] But
usually it was a rude kind of life which the country squire or parson
led, very like that which was led by the substantial farmers of a few
generations ago, when it was the fashion for the unmarried farm
labourers to live in the farm-house, and for the farmer and his
household all to sit down to meals together. These were their hours:

“Rise at five, dine at nine,
Sup at five, and bed at nine,
Will make a man live to ninety-and-nine.”
The master of the house sat in the sole arm-chair, in the middle of
the high table on the dais, with his family on either side of him; and
his men sat at the movable tables of boards and trestles, with a
bench on each side, which we find mentioned in the inventories: or
the master sat at the same table with his men, only he sat above the
salt and they below; he drank his ale out of a silver cup while they
drank it out of horn; he ate white bread while they ate brown, and
he a capon out of his curtilage while they had pork or mutton ham;
he retired to his great chamber when he desired privacy, which was
not often perhaps; and he slept in a tester bed in the great chamber,
while they slept on truckle beds in the hall.
One item in the description of the Kelvedon parsonage requires
special consideration, and opens up a rather important question as
to the domestic economy of the parochial clergy over and above
what we have hitherto gleaned. “The convenient chamber for
guests” there mentioned was not a best bedroom for any friend who
might pay him a visit. It was a provision for the efficient exercise of
the hospitality to which the beneficed parochial clergy were bound.
It is a subject which perhaps needs a little explanation. In England
there were no inns where travellers could obtain food and lodging
until the middle of the fourteenth century; and for long after that
period they could only be found in the largest and most important
towns; and it was held to be a part of the duty of the clergy to
“entertain strangers,” and be “given to hospitality.” It was a charity
not very likely to be abused; for, thanks to bad roads, unbridged
fords, no inns, wild moors, and vast forests haunted by lawless men,
very few travelled, except for serious business; and it was a real act
of Christian charity to afford to such travellers the food and shelter
which they needed, and would have been hard put to it to have
obtained otherwise. The monasteries, we all know, exercised this
hospitality on so large a scale, that in order to avoid the interruption
a constant succession of guests would have made in the seclusion
and regularity of conventual life, they provided special buildings for
it, called the hospitium or guest house, a kind of inn within the walls,
and they appointed one of the monks, under the name of the
hospitaller or guest master, to represent the convent in entertaining
the guests. Hermitages also, we have seen, were frequently built
along the high roads, especially near bridges and fords, for the
purpose of aiding travellers. Along the road which led towards some
famous place of pilgrimage hospitals, which were always religious
foundations, were founded especially for the entertainment of poor
pilgrims. And the parochial clergy were expected to exercise a similar
hospitality. Thus in the replies of the rectors of Berkshire to the
papal legate, in 1240 a.d., they say that “their churches were
endowed and enriched by their patrons with lands and revenues for
the especial purpose that the rectors of them should receive guests,
rich as well as poor, and show hospitality to laity as well as clergy,
according to their means, as the custom of the place required.”[316]
Again, in 1246, the clergy, on a similar occasion, stated that “a
custom has hitherto prevailed, and been observed in England, that
the rectors of parochial churches have always been remarkable for
hospitality, and have made a practice of supplying food to their
parishioners who were in want, ... and if a portion of their benefices
be taken away from them, they will be under the necessity of
refusing their hospitality, and abandoning their accustomed offices of
piety. And if these be withdrawn, they will incur the hatred of those
subject to them [their parishioners], and will lose the favour of
passers-by [travellers] and their neighbours.”[317] Again, in 1253 a.d.,
Bishop Grostête, in his remonstrance to the Pope, says of the
foreigners who were intruded into English benefices, that they
“could not even take up their residence, to administer to the wants
of the poor, and to receive travellers.”[318]
There is an interesting passage illustrative of the subject quoted in
Parker’s “Domestic Architecture,” i. p. 123. Æneus Sylvius,
afterwards Pope Pius II., describing his journey from Scotland into
England, in the year 1448, says that he entered a large village in a
wild and barbarous part of the country, about sunset, and “alighted
at a rustic’s house, and supped there with the priest of the place and
the host.” The special mention of the priest in the first place almost
leads us to conjecture that the foreign ecclesiastic had first gone to
the priest of the place for the usual hospitality, and had been taken
on by him to the manor house—for the “rustic” seems to have been
a squire—as better able to afford him a suitable hospitality. Sundry
pottages, and fowls, and geese, were placed on the table, but there
was neither bread nor wine. He had, however, brought with him a
few loaves and a roundel of wine, which he had received at a certain
monastery. Either a stranger was a great novelty, or the Italian
ecclesiastic had something remarkable in his appearance, for he says
all “the people of the place ran to the house to stare at him.”
Kelvedon being on one of the great high roads of the country, its
parson would often be called upon to exercise his duty of hospitality,
hence the provision of a special guest chamber in the parsonage
house. And so in our picture of the domestic economy and ordinary
life of a mediæval country parson we must furnish his guest
chamber, and add a little to the contents of buttery and cellar, to
provide for his duty of hospitality; and we must picture him not
always sitting in solitary dignity at his high table on the dais, but
often playing the courteous host to knight and lady, merchant,
minstrel, or pilgrim; and after dinner giving the broken meat to the
poor, who in the days when there was no poor law were the regular
dependants on his bounty.

THE MINSTRELS OF THE MIDDLE AGES.


CHAPTER I.

t would carry us too far a-field to attempt to give a sketch


of the early music of the principal nations of antiquity,
such as might be deduced from the monuments of Egypt
and Nineveh and Greece. We may, however, briefly glance
at the most ancient minstrelsy of the Israelites; partly for the sake of
the peculiar interest of the subject itself, partly because the early
history of music is nearly the same in all nations, and this earliest
history will illustrate and receive illustration from a comparison with
the history of music in mediæval England.
Musical instruments, we are told by the highest of all authorities,
were invented in the eighth generation of the world—that is in the
third generation before the flood—by Tubal, “the Father of all such
as handle the harp and organ, both stringed and wind instruments.”
The ancient Israelites used musical instruments on the same
occasions as the mediæval Europeans—in battle; in their feasts and
dances; in processions, whether of religious or civil ceremony; and in
the solemnising of divine worship. The trumpet and the horn were
then, as always, the instruments of warlike music—“If ye go to war
then shall ye blow an alarm with the silver trumpets.”[319] The
trumpet regulated the march of the hosts of Israel through the
wilderness. When Joshua compassed Jericho, the seven priests blew
trumpets of rams’ horns. Gideon and his three hundred discomfited
the host of the Midianites with the sound of their trumpets.
The Tabret was the common accompaniment of the troops of female
dancers, whether the occasion were religious or festive. Miriam the
prophetess took a timbrel in her hand, and all the women went out
after her with timbrels and with dances, singing a solemn chorus to
the triumphant song of Moses and of the Children of Israel over the
destruction of Pharaoh in the Red Sea,—
“Sing ye to the Lord, for he hath triumphed gloriously;
The horse and his rider hath he thrown into the sea.”[320]
Jephthah’s daughter went to meet her victorious father with timbrels
and dances:—
“The daughter of the warrior Gileadite,
From Mizpeh’s tower’d gate with welcome light,
With timbrel and with song.”
And so, when King Saul returned from the slaughter of the
Philistines, after the shepherd David had killed their giant champion
in the valley of Elah, the women came out of all the cities to meet
the returning warriors “singing and dancing to meet King Saul, with
tabrets, with joy, and with instruments of music;” and the women
answered one another in dramatic chorus—
“Saul hath slain his thousands,
And David his ten thousands.”[321]
Laban says that he would have sent away Jacob and his wives and
children, “with mirth and with songs, with tabret and with harp.” And
Jeremiah prophesying that times of ease and prosperity shall come
again for Israel, says: “O Virgin of Israel, thou shalt again be
adorned with thy tabrets, and shalt go forth in the dances of them
that make merry.”[322]
In their feasts these and many other instruments were used. Isaiah
tells us[323] that they had “the harp, and the viol, the tabret, and
pipe, and wine in their feasts;” and Amos tells us of the luxurious
people who lie upon beds of ivory, and “chant to the sound of the
viol, and invent to themselves instruments of music like David,” and
drink wine in bowls, and anoint themselves with the costliest
perfumes.
Instruments of music were used in the colleges of Prophets, which
Samuel established in the land, to accompany and inspire the
delivery of their prophetical utterances. As Saul, newly anointed,
went up the hill of God towards the city, he met a company of
prophets coming down, with a psaltery, and a tabret, and a pipe,
and a harp before them, prophesying; and the spirit of the Lord
came upon Saul when he heard, and he also prophesied.[324] When
Elisha was requested by Jehoram to prophesy the fate of the battle
with the Moabites, he said: “Bring me a minstrel; and when the
minstrel played, the hand of the Lord came upon him, and he
prophesied.”
When David brought up the ark from Gibeah, he and all the house of
Israel played before the Lord on all manner of instruments made of
firwood, even on harps, psalteries, timbrels, cornets, and cymbals.
[325] And in the song which he himself composed to be sung on that
occasion,[326] he thus describes the musical part of the procession:—
“It is well seen how thou goest,
How thou, my God and King, goest to the sanctuary;
The singers go before, the minstrels follow after,
In the midst are the damsels playing with the timbrels.”
The instruments appointed for the regular daily service of the
Temple “by David, and Gad the king’s seer, and Nathan the prophet,
for so was the commandment of the Lord by his prophets,” were
cymbals, psalteries, and harps, which David made for the purpose,
and which were played by four thousand Levites.
Besides the instruments already mentioned,—the harp, tabret,
timbrel, psaltery, trumpet, cornet, cymbal, pipe, and viol,—they had
also the lyre, bag-pipes, and bells; and probably they carried back
with them from Babylon further additions, from the instruments of
“all peoples, nations, and languages” with which they would become
familiarised in that capital of the world. But from the time of Tubal
down to the time when the royal minstrel of Israel sang those
glorious songs which are still the daily solace of thousands of
mankind, and further down to the time when the captive Israelites
hanged their unstrung harps upon the willows of Babylon, and could
not sing the songs of Zion in a strange land, the harp continued still
the fitting accompaniment of the voice in all poetical utterance of a
dignified and solemn character:—the recitation of the poetical
portions of historical and prophetical Scripture, for instance, would
be sustained by it, and the songs of the psalmists of Zion were
accompanied by its strains. And thus this sketch of the history of the
earliest music closes, with the minstrel harp still in the foreground;
while in the distance we hear the sound of the fanfare of cornet,
flute, harp, sackbut, psaltery, dulcimer, and all kinds of music, which
were concerted on great occasions; such as that on which they
resounded over the plain of Dura, to bow that bending crowd of
heads, as the ripe corn bends before the wind, to the great Image of
Gold:—an idolatry, alas! which the peoples, nations, and languages
still perform almost as fervently as of old.

The northern Bard, or Scald, was the father of the minstrels of


mediæval Europe. Our own early traditions afford some picturesque
anecdotes, proving the high estimation in which the character was
held by the Saxons and their kindred Danes; and showing that they
were accustomed to wander about to court, and camp, and hall; and
were hospitably received, even though the Bard were of a race
against which his hosts were at that very time encamped in hostile
array. We will only remind the reader of the Royal Alfred’s
assumption of the character of a minstrel, and his visit in that
disguise to the Danish camp (a.d. 878); and of the similar visit, ten
years after, of Anlaff the Danish king to the camp of Saxon
Athelstane. But the earliest anecdote of the kind we shall have
hereafter to refer to, and may therefore here detail at length. It is
told us by Geoffrey of Monmouth, that Colgrin, the son of Ella, who
succeeded Hengist in the leadership of the invading Saxons, was
shut up in York, and closely besieged by King Arthur and his Britons.
Baldulf, the brother of Colgrin, wanted to gain access to him, to
apprise him of a reinforcement which was coming from Germany. In
order to accomplish this design, he assumed the character of a
minstrel. He shaved his head and beard; and dressing himself in the
habit of that profession, took his harp in his hand. In this disguise he
walked up and down the trenches without suspicion, playing all the
while upon his instrument as a harper. By little and little he
approached the walls of the city; and, making himself known to the
sentinels, was in the night drawn up by a rope.
The harper continued throughout the Middle Ages to be the most
dignified of the minstrel craft, the reciter, and often the composer, of
heroic legend and historical tale, of wild romance and amorous song.
Frequently, and perhaps especially in the case of the higher class of
harpers, he travelled alone, as in the cases which we have already
seen of Baldulf, and Alfred, and Anlaff. But he also often associated
himself with a band of minstrels, who filled up the intervals of his
recitations and songs with their music, much as vocal and
instrumental pieces are alternated in our modern concerts. With a
band of minstrels there was also very usually associated a mime,
who amused the audience with his feats of agility and leger-de-main.
The association appears at first sight somewhat undignified—the
heroic harper and the tumbler—but the incongruity was not peculiar
to the Middle Ages; the author of the “Iliad” wrote the “Battle of the
Frogs,”—the Greeks were not satisfied without a satiric drama after
their grand heroic tragedy; and in these days we have a farce or a
pantomime after Shakspeare. We are not all Heraclituses, to see
only the tragic side of life, or Democrituses, to laugh at everything;
the majority of men have faculties to appreciate both classes of
emotion; and it would seem, from universal experience, that, as the
Russian finds a physical delight in leaping from a vapour-bath into
the frozen Neva, so there is some mental delight in the sudden
alternate excitation of the opposite emotions of tragedy and farce. If
we had time to philosophise, we might find the source of the delight
deeply seated in our nature:—alternate tears and laughter—it is an
epitome of human life!
In the accompanying woodcut from a Late Saxon MS. in the British
Museum (Cott. Tiberius C. vi.) we have a curious evidence of the
way in which custom blinded men to any incongruity there may be in
the association of the harper and the juggler, for here we have David
singing his Psalms and accompanying himself on the harp, the dove
reminding us that he sang and harped under the influence of
inspiration. He is accompanied by performers who must be Levites;
and yet the Saxon illuminator was so used to see a mime form one
of a minstrel band, that he has introduced one playing the common
feat of tossing three knives and three balls.

Saxon Band of Minstrels.


The Saxons were a musical people. We learn from Bede’s anecdote
of the poet Cædmon, that it was usual at their feasts to pass the
harp round from hand to hand, and every man was supposed to be
able to sing in his turn, and accompany himself on the instrument.
They had a considerable number of musical instruments. In a MS. in
the British Museum, Tiberius C. vi., folios 16 v., 17 v., 18, are a few
leaves of a formal treatise on the subject, which give us very
carefully drawn pictures of different instruments, with their names
and descriptions. There are also illustrations of them in the Add.
11,695, folios 86, 86 v., 164, 170 v., 229, and in Cleopatra E. viii.
Among them are the Psaltery of various shapes, the Sambuca or
sackbut, the single and double Chorus, &c. Other instruments we
find in Saxon MSS. are the lyre, viol, flute, cymbals, organ, &c. A set
of hand-bells (carillons) which the player struck with two hammers,
was a favourite instrument. We often find different instruments
played together. At folio 93 v. of the MS. Claudius B iv. there is a
group of twelve female harpists playing together; one has a small
instrument, probably a kind of lyre, the rest have great harps of the
same pattern. They probably represent Miriam and the women of
Israel joining in the triumphal song of Moses over the destruction of
the Egyptians in the Red Sea.
Saxon Organ.

The organ, already introduced into divine service, became, under the
hands of St. Dunstan, a large and important instrument. William of
Malmesbury says that Dunstan gave many to churches which had
pipes of brass and were inflated with bellows. In a MS. psalter in
Trinity College, Cambridge, is a picture of one of considerable size,
which has no less than four bellows played by four men. It is
represented in the accompanying wood-cut.
The Northmen who invaded and gave their name to Normandy, took
their minstrels with them; and the learned assert that it was from
them that the troubadours of Provence learned their art, which
ripened in their sunny clime into la joyeuse science, and thence was
carried into Italy, France, and Spain. It is quite certain that
minstrelsy was in high repute among the Normans at the period of
the Conquest. Every one will remember how Taillefer, the minstrel-
knight, commenced the great battle of Hastings. Advancing in front
of the Norman host, he animated himself and them to a chivalric
daring by chanting the heroic tale of Charlemagne and his Paladins,
at the same time showing feats of skill in tossing his sword into the
air; and then rushed into the Saxon ranks, like a divinely-mad hero
of old, giving in his own self-sacrifice an augury of victory to his
people.
From the period of the Conquest, authorities on the subject of which
we are treating, though still not so numerous as could be desired,
become too numerous to be all included within the limits to which
our space restricts us. The reader may refer to Wharton’s “History of
English Poetry,” to Bishop Percy’s introductory essay to the “Reliques
of Early English Poetry,” and to the introductory essay to Ellis’s “Early
English Metrical Romances,” for the principal published authorities.
For a series of learned essays on mediæval musical instruments he
may consult M. Didron’s “Annales Archæologiques,” vol. iii. pp. 76,
142, 260; vol. iv. pp. 25, 94; vol. vi. p. 315; vol. vii. pp. 92, 157, 244,
325; vol. viii. p. 242; vol. ix. pp. 289, 329.[327] We propose only from
these and other published and unpublished materials to give a
popular sketch of the subject.
Throughout this period minstrelsy was in high estimation with all
classes of society. The king himself, like his Saxon[328] predecessors,
had a king’s minstrel, or king of the minstrels, who probably from
the first was at the head of a band of royal minstrels.[329]
This fashion of the royal court, doubtless, like all its other fashions,
obtained also in the courts of the great nobility (several instances
will be observed in the sequel), and in their measure in the
households of the lesser nobility. Every gentleman of estate had
probably his one, two, or more minstrels as a regular part of his
household. It is not difficult to discover their duties. In the
representations of dinners, which occur plentifully in the mediæval
MSS., we constantly find musicians introduced; sometimes we see
them preceding the servants, who are bearing the dishes to table—a
custom of classic usage, and which still lingers to this day at Queen’s
College, Oxford, in the song with which the choristers usher in the
boar’s head on Christmas-day, and at our modern public dinners,
when the band strikes up “Oh the Roast Beef of Old England,” as
that national dish is brought to table.
We give here an illustration of such a scene from a very fine MS. of
the early part of the fourteenth century, in the British Museum
(marked Royal 2 B vii., f. 184 v. and 185). A very fine representation
of a similar scene occurs at the foot of the large Flemish Brass of
Robert Braunche and his two wives in St. Margaret’s Church, Lynn;
the scene is intended as a delineation of a feast given by the
corporation of Lynn to King Edward III. Servants from both sides of
the picture are bringing in that famous dish of chivalry, the peacock
with his tail displayed; and two bands of minstrels are ushering in
the banquet with their strains: the date of the brass is about 1364
a.d. In the fourteenth-century romance of “Richard Cœur de Lion,”
we read of some knights who have arrived in presence of the
romance king whom they are in quest of; dinner is immediately
prepared for them; “trestles,” says Ellis in his abstract of it, “were
immediately set; a table covered with a silken cloth was laid; a rich
repast, ushered in by the sound of trumpets and shalms, was served
up.”[330]

A Royal Dinner.

Having introduced the feast, the minstrels continued to play during


its progress. We find numerous representations of dinners in the
illuminations, in which one or two minstrels are standing beside the
table, playing their instruments during the progress of the meal. In a
MS. volume of romances of the early part of the fourteenth century
in the British Museum (Royal 14 E iii.), the title-page of the romance
of the “Quête du St. Graal” (at folio 89 of the MS.) is adorned with
an illumination of a royal banquet; a squire on his knee (as in the
illustration given on opposite page) is carving, and a minstrel stands
beside the table playing the violin; he is dressed in a parti-coloured
tunic of red and blue, and wears his hat. In the Royal MS. 2 B vii., at
folio 168, is a similar representation of a dinner, in which a minstrel
stands playing the violin; he is habited in a red tunic, and is
bareheaded. At folio 203 of the same MS. (Royal 2 B vii.), is another
representation of a dinner, in which two minstrels are introduced;
one (wearing his hood) is playing a cittern, the other (bareheaded)
is playing a violin: and these references might be multiplied.

Royal Dinner of the time of Edward IV.

We reproduce here, in further illustration of the subject, engravings


of a royal dinner of about the time of our Edward IV., “taken from an
illumination of the romance of the Compte d’Artois, in the possession
of M. Barrois, a distinguished and well-known collector in Paris.”[331]
The other is an exceedingly interesting representation of a grand
imperial banquet, from one of the plates of Hans Burgmair, in the
volume dedicated to the exploits of the Emperor Maximilian,
contemporary with our Henry VIII. It represents the entrance of a
masque, one of those strange entertainments, of which our
ancestors, in the time of Henry and Elizabeth, were so fond, and of
which Mr. C. Kean some years ago gave the play-going world of
London so accurate a representation in his mise en scene of Henry
VIII. at the Princess’s Theatre. The band of minstrels who have been
performing during the banquet, are seen in the left corner of the
picture.
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!

ebookname.com

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy