SlideShare a Scribd company logo
Core Java Vol 1 2 For The Impatient And
Effective Pack 12th Ed Cay S Horstmann download
https://ebookbell.com/product/core-java-vol-1-2-for-the-
impatient-and-effective-pack-12th-ed-cay-s-horstmann-50687482
Explore and download more ebooks at ebookbell.com
Here are some recommended products that we believe you will be
interested in. You can click the link to download.
Core Java Vol Iiadvanced Features 12th Edition Cay S Horstmann
https://ebookbell.com/product/core-java-vol-iiadvanced-features-12th-
edition-cay-s-horstmann-49554648
Core Java Vol Iiadvanced Features 12th Edition Cay S Horstmann
https://ebookbell.com/product/core-java-vol-iiadvanced-features-12th-
edition-cay-s-horstmann-38321494
Core Java Volume Ii Advanced Features 11th Vol Ii Cay Horstmann
https://ebookbell.com/product/core-java-volume-ii-advanced-
features-11th-vol-ii-cay-horstmann-9992752
Core Java Volume I Fundamentals 12th Horstmann Cay
https://ebookbell.com/product/core-java-volume-i-fundamentals-12th-
horstmann-cay-46173296
Core Java Volume Ii Advanced Features 12th Cay S Horstmann
https://ebookbell.com/product/core-java-volume-ii-advanced-
features-12th-cay-s-horstmann-46173298
Core Java For The Impatient 3rd Edition Cay Horstmann
https://ebookbell.com/product/core-java-for-the-impatient-3rd-edition-
cay-horstmann-48456364
Core Java Interview Questions Youll Most Likely Be Asked Job Interview
Questions Series 2nd Edition Vibrant Publishers
https://ebookbell.com/product/core-java-interview-questions-youll-
most-likely-be-asked-job-interview-questions-series-2nd-edition-
vibrant-publishers-49183978
Core Java Made Simple Som Prakash Rai
https://ebookbell.com/product/core-java-made-simple-som-prakash-
rai-49422914
Core Java Volume Ifundamentals Cay S Horstmann
https://ebookbell.com/product/core-java-volume-ifundamentals-cay-s-
horstmann-49541448
Core Java Vol 1 2 For The Impatient And Effective Pack 12th Ed Cay S Horstmann
Core Java Vol 1 2 For The Impatient And Effective Pack 12th Ed Cay S Horstmann
Core Java for the Impatient
Third Edition
Cay S. Horstmann
Addison-Wesley Professional
Contents
Preface
Acknowledgments
About the Author
Chapter 1: Fundamental Programming Structures
Chapter 2: Object-Oriented Programming
Chapter 3: Interfaces and Lambda Expressions
Chapter 4: Inheritance and Reflection
Chapter 5: Exceptions, Assertions, and Logging
Chapter 6: Generic Programming
Chapter 7: Collections
Chapter 8: Streams
Chapter 9: Processing Input and Output
Chapter 10: Concurrent Programming
Chapter 11: Annotations
Chapter 12: The Date and Time API
Chapter 13: Internationalization
Chapter 14: Compiling and Scripting
Chapter 15: The Java Platform Module System
Table of Contents
Preface
Acknowledgments
About the Author
Chapter 1: Fundamental Programming Structures
1.1. Our First Program
1.2. Primitive Types
1.3. Variables
1.4. Arithmetic Operations
1.5. Strings
1.6. Input and Output
1.7. Control Flow
1.8. Arrays and Array Lists
1.9. Functional Decomposition
Exercises
Chapter 2: Object-Oriented Programming
2.1. Working with Objects
2.2. Implementing Classes
2.3. Object Construction
2.4. Records
2.5. Static Variables and Methods
2.6. Packages
2.7. Nested Classes
2.8. Documentation Comments
Exercises
Chapter 3: Interfaces and Lambda Expressions
3.1. Interfaces
3.2. Static, Default, and Private Methods
3.3. Examples of Interfaces
3.4. Lambda Expressions
3.5. Method and Constructor References
3.6. Processing Lambda Expressions
3.7. Lambda Expressions and Variable Scope
3.8. Higher-Order Functions
3.9. Local and Anonymous Classes
Exercises
Chapter 4: Inheritance and Reflection
4.1. Extending a Class
4.2. Inheritance Hierarchies
4.3. Object: The Cosmic Superclass
4.4. Enumerations
4.5. Runtime Type Information and Resources
4.6. Reflection
Exercises
Chapter 5: Exceptions, Assertions, and Logging
5.1. Exception Handling
5.2. Assertions
5.3. Logging
Exercises
Chapter 6: Generic Programming
6.1. Generic Classes
6.2. Generic Methods
6.3. Type Bounds
6.4. Type Variance and Wildcards
6.5. Generics in the Java Virtual Machine
6.6. Restrictions on Generics
6.7. Reflection and Generics
Exercises
Chapter 7: Collections
7.1. An Overview of the Collections Framework
7.2. Iterators
7.3. Sets
7.4. Maps
7.5. Other Collections
7.6. Views
Exercises
Chapter 8: Streams
8.1. From Iterating to Stream Operations
8.2. Stream Creation
8.3. The filter, map, and flatMap Methods
8.4. Extracting Substreams and Combining Streams
8.5. Other Stream Transformations
8.6. Simple Reductions
8.7. The Optional Type
8.8. Collecting Results
8.9. Collecting into Maps
8.10. Grouping and Partitioning
8.11. Downstream Collectors
8.12. Reduction Operations
8.13. Primitive Type Streams
8.14. Parallel Streams
Exercises
Chapter 9: Processing Input and Output
9.1. Input/Output Streams, Readers, and Writers
9.2. Paths, Files, and Directories
9.3. HTTP Connections
9.4. Regular Expressions
9.5. Serialization
Exercises
Chapter 10: Concurrent Programming
10.1. Concurrent Tasks
10.2. Asynchronous Computations
10.3. Thread Safety
10.4. Parallel Algorithms
10.5. Threadsafe Data Structures
10.6. Atomic Counters and Accumulators
10.7. Locks and Conditions
10.8. Threads
10.9. Processes
Exercises
Chapter 11: Annotations
11.1. Using Annotations
11.2. Defining Annotations
11.3. Standard Annotations
11.4. Processing Annotations at Runtime
11.5. Source-Level Annotation Processing
Exercises
Chapter 12: The Date and Time API
12.1. The Time Line
12.2. Local Dates
12.3. Date Adjusters
12.4. Local Time
12.5. Zoned Time
12.6. Formatting and Parsing
12.7. Interoperating with Legacy Code
Exercises
Chapter 13: Internationalization
13.1. Locales
13.2. Number Formats
13.3. Currencies
13.4. Date and Time Formatting
13.5. Collation and Normalization
13.6. Message Formatting
13.7. Resource Bundles
13.8. Character Encodings
13.9. Preferences
Exercises
Chapter 14: Compiling and Scripting
14.1. The Compiler API
14.2. The Scripting API
Exercises
Chapter 15: The Java Platform Module System
15.1. The Module Concept
15.2. Naming Modules
15.3. The Modular “Hello, World!” Program
15.4. Requiring Modules
15.5. Exporting Packages
15.6. Modules and Reflective Access
15.7. Modular JARs
15.8. Automatic Modules
15.9. The Unnamed Module
15.10. Command-Line Flags for Migration
15.11. Transitive and Static Requirements
15.12. Qualified Exporting and Opening
15.13. Service Loading
15.14. Tools for Working with Modules
Exercises
Preface
Java is now well over twenty years old. The classic book, Core Java,
covers, in meticulous detail, not just the language but all core libraries and a
multitude of changes between versions, spanning two volumes and over
2,000 pages. However, if you just want to be productive with modern Java,
there is a much faster, easier pathway for learning the language and core
libraries. In this book, I don’t retrace history and don’t dwell on features of
past versions. I show you the good parts of Java as it exists today, so you
can put your knowledge to work quickly.
As with my previous “Impatient” books, I quickly cut to the chase, showing
you what you need to know to solve a programming problem without
lecturing about the superiority of one paradigm over another. I also present
the information in small chunks, organized so that you can quickly retrieve
it when needed.
Assuming you are proficient in some other programming language, such as
C++, JavaScript, Objective C, PHP, or Ruby, with this book you will learn
how to become a competent Java programmer. I cover all aspects of Java
that a developer needs to know today, including the powerful concepts of
lambda expressions and streams, as well as modern constructs such as
records and sealed classes.
A key reason to use Java is to tackle concurrent programming. With parallel
algorithms and threadsafe data structures readily available in the Java
library, the way application programmers should handle concurrent
programming has completely changed. I provide fresh coverage, showing
you how to use the powerful library features instead of error-prone low-
level constructs.
Traditionally, books on Java have focused on user interface programming—
but nowadays, few developers produce user interfaces on desktop
computers. If you intend to use Java for server-side programming or
Android programming, you will be able to use this book effectively without
being distracted by desktop GUI code.
Finally, this book is written for application programmers, not for a college
course and not for systems wizards. The book covers issues that application
programmers need to wrestle with, such as logging and working with files
—but you won’t learn how to implement a linked list by hand or how to
write a web server.
I hope you enjoy this rapid-fire introduction into modern Java, and I hope it
will make your work with Java productive and enjoyable.
If you find errors or have suggestions for improvement, please visit
http://horstmann.com/javaimpatient, head for the errata
page, and leave a comment. On that site, you will also find a link to an
archive file containing all code examples from the book.
Acknowledgments
This content is currently in development.
About the Author
This content is currently in development.
1. Fundamental Programming
Structures
In this chapter, you will learn about the basic data types and control structures
of the Java language. I assume that you are an experienced programmer in
some other language and that you are familiar with concepts such as variables,
loops, function calls, and arrays, but perhaps with a different syntax. This
chapter will get you up to speed on the Java way. I will also give you some tips
on the most useful parts of the Java API for manipulating common data types.
The key points of this chapter are:
1. In Java, all methods are declared in a class. You invoke a nonstatic
method on an object of the class to which the method belongs.
2. Static methods are not invoked on objects. Program execution starts with
the static main method.
3. Java has eight primitive types: four signed integral types, two floating-
point types, char, and boolean.
4. The Java operators and control structures are very similar to those of C or
JavaScript.
5. There are four forms of switch: expressions and statements with and
without fall through.
6. The Math class provides common mathematical functions.
7. String objects are sequences of characters or, more precisely, Unicode
code points in the UTF-16 encoding.
8. Use the “text box” syntax to declare multiline string literals.
9. With the System.out object, you can display output in a terminal
window. A Scanner tied to System.in lets you read terminal input.
10. Arrays and collections can be used to collect elements of the same type.
1.1. Our First Program
When learning any new programming language, it is traditional to start with a
program that displays the message “Hello, World!”. That is what we will do in
the following sections.
1.1.1. Dissecting the “Hello, World” Program
Without further ado, here is the “Hello, World” program in Java.
package ch01.sec01;
// Our first Java program
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
Let’s examine this program:
Java is an object-oriented language. In your program, you manipulate
(mostly) objects by having them do work. Each object that you manipulate
belongs to a specific class, and we say that the object is an instance of that
class. A class defines what an object’s state can be and and what it can do.
In Java, all code is defined inside classes. We will look at objects and
classes in detail in Chapter 2. This program is made up of a single class
HelloWorld.
main is a method, that is, a function declared inside a class. The main
method is the first method that is called when the program runs. It is
declared as static to indicate that the method does not operate on any
objects. (When main gets called, there are only a handful of predefined
objects, and none of them are instances of the HelloWorld class.) The
method is declared as void to indicate that it does not return any value.
See Section 1.8.8 for the meaning of the parameter declaration
String[] args.
In Java, you can declare many features as public or private, and
there are a couple of other visibility levels as well. Here, we declare the
HelloWorld class and the main method as public, which is the most
common arrangement for classes and methods.
A package is a set of related classes. It is a good idea to place each class in
a package so you can group related classes together and avoid conflicts
when multiple classes have the same name. In this book, we’ll use chapter
and section numbers as package names. The full name of our class is
ch01.sec01.HelloWorld. Chapter 2 has more to say about
packages and package naming conventions.
The line starting with // is a comment. All characters between // and the
end of the line are ignored by the compiler and are meant for human
readers only.
Finally, we come to the body of the main method. In our example, it
consists of a single line with a command to print a message to
System.out, an object representing the “standard output” of the Java
program.
As you can see, Java is not a scripting language that can be used to quickly
dash off a few commands. It is squarely intended as a language for larger
programs that benefit from being organized into classes, packages, and
modules. (Modules are introduced in Chapter 15.)
Java is also quite simple and uniform. Some languages have global variables
and functions as well as variables and methods inside classes. In Java,
everything is declared inside a class. This uniformity can lead to somewhat
verbose code, but it makes it easy to understand the meaning of a program.
Note
You have just seen a // comment that extends to the end of the line. You
can also have multiline comments between /* and */ delimiters, such as
/*
This is the first sample program in Core Java
for the Impatient.
The program displays the traditional greeting
"Hello, World!".
*/
There is a third comment style, called documentation comment, with /**
and */ as delimiters, that you will see in the next chapter.
1.1.2. Compiling and Running a Java Program
To compile and run this program, you need to install the Java Development Kit
(JDK) and, optionally, an integrated development environment (IDE). You
should also download the sample code, which you will find at the companion
website for this book, http://horstmann.com/javaimpatient.
Since instructions for installing software don’t make for interesting reading, I
put them on the companion website as well.
Once you have installed the JDK, open a terminal window, change to the
directory containing the ch01 directory, and run the commands
javac ch01/sec01/HelloWorld.java
java ch01.sec01.HelloWorld
The familiar greeting will appear in the terminal window (see Figure 1.1).
Note that two steps were involved to execute the program. The javac
command compiles the Java source code into an intermediate machine-
independent representation, called byte codes, and saves them in class files.
The java command launches a virtual machine that loads the class files and
executes the byte codes.
Once compiled, byte codes can run on any Java virtual machine, whether on
your desktop computer or on a device in a galaxy far, far away. The promise of
“write once, run anywhere” was an important design criterion for Java.
Figure 1.1: Running a Java program in a terminal window
Note
The javac compiler is invoked with the name of a file, with slashes
separating the path segments, and an extension .java. The java virtual
machine launcher is invoked with the name of a class, with dots separating
the package segments, and no extension.
Note
If your program consists of a single source file, then you can skip the
compilation step and run the program with the command
java ch01/sec01/HelloWorld.java
Behind the scenes, the program is compiled before it runs, but no class
files are produced.
Note
On Unix-like operating systems, you can turn a Java file into an executable
program by following these steps:
1. Rename the file so that it doesn’t have extension .java:
mv HelloWorld.java hello
2. Make the file executable:
chmod +x hello
3. Add a “shebang” line on the top of the file:
#!/path/to/jdk/bin/java --source 17
Now you can run the program as
./hello
To run the program in an IDE, you need to first make a project, as described in
the installation instructions. Then, select the HelloWorld class and tell the
IDE to run it. Figure 1.2 shows how this looks in Eclipse. Eclipse is a popular
IDE, but there are many other excellent choices. As you get more comfortable
with Java programming, you should try out a few and pick one that you like.
Figure 1.2: Running a Java program inside the Eclipse IDE
Congratulations! You have just followed the time-honored ritual of running the
“Hello, World!” program in Java. Now we are ready to examine the basics of
the Java language.
Tip
At http://horstmann.com/javaimpatient, you can download sample
code for all chapters of this book that presents the book’s code
snippets in context. The code is organized so that you can make a
single project that holds all example programs. I encourage you to
download, run, and study the code as you follow along with the book
content.
1.1.3. Method Calls
Let us have a closer look at the single statement of the main method:
System.out.println("Hello, World!");
System.out is an object. It is an instance of a class called PrintStream.
The PrintStream class has methods println, print, and so on. These
methods are called instance methods because they operate on objects, or
instances, of the class.
To invoke an instance method on an object, you use the dot notation
object.methodName(arguments)
In this case, there is just one argument, the string "Hello, World!".
Let’s try it with another example. Strings such as "Hello, World!" are
instances of the String class. The String class has a method length that
returns the length of a String object. To call the method, you again use the
dot notation:
"Hello, World!".length()
The length method is invoked on the object "Hello, World!", and it
has no arguments. Unlike the println method, the length method returns
a result. One way of using that result is to print it:
System.out.println("Hello, World!".length());
Give it a try. Make a Java program with this statement and run it to see how
long the string is.
In Java, you need to construct most objects (unlike the System.out and
"Hello, World!" objects, which are already there, ready for you to use).
Here is a simple example.
An object of the Random class can generate random numbers. You construct a
Random object with the new operator:
new Random()
After the class name is the list of construction arguments, which is empty in
this example.
You can call a method on the constructed object. The call
new Random().nextInt()
yields the next integer that the newly constructed random number generator has
to offer.
If you want to invoke more than one method on an object, store it in a variable
(see Section 1.3). Here we print two random numbers:
Random generator = new Random();
System.out.println(generator.nextInt());
System.out.println(generator.nextInt());
Note
The Random class is declared in the java.util package. To use it in
your program, add an import statement, like this:
package ch01.sec01;
import java.util.Random;
public class MethodDemo {
...
}
We will look at packages and the import statement in more detail in
Chapter 2.
1.1.4. JShell
In Section 1.1.2, you saw how to compile and run a Java program. The JShell
program provides a “read-evaluate-print loop” (REPL) that allows you to
experiment with Java code without compiling and running a program. When
you type a Java expression, JShell evaluates your input, prints the result, and
waits for your next input. To start JShell, simply type jshell in a terminal
window (Figure 1.3).
Figure 1.3: Running JShell
JShell starts with a greeting, followed by a prompt:
| Welcome to JShell -- Version 17
| For an introduction type: /help intro
jshell>
Now type any Java expression, such as
"Hello, World!".length()
JShell responds with the result and another prompt.
$1 ==> 13
jshell>
Note that you do not type System.out.println. JShell automatically
prints the value of every expression that you enter.
The $1 in the output indicates that the result is available in further calculations.
For example, if you type
3 * $1 + 3
the response is
$2 ==> 42
If you need a variable many times, you can give it a more memorable name.
You have to follow the Java syntax and specify both the type and the name (see
Section 1.3). For example,
jshell> int answer = 42
answer ==> 42
You can have JShell fill in the type for you. Type an expression and instead of
hitting the Enter key, hit Shift+Tab and then the V key. For example, when you
type
new Random()
followed by Shift+Tab and the V key, you get
jshell> Random = new Random()
with the cursor positioned just before the = symbol. Now type a variable name
and hit Enter:
jshell> Random generator = new Random()
generator ==> java.util.Random@3fee9989
Another useful feature is tab completion. Type
generator.
followed by the Tab key. You get a list of all methods that you can invoke on
the generator variable:
jshell> generator.
doubles( equals( getClass()
hashCode() ints(
isDeprecated()
longs( nextBoolean() nextBytes(
nextDouble( nextExponential() nextFloat(
nextGaussian( nextInt( nextLong(
notify() notifyAll() setSeed(
toString() wait(
Now type ne and hit the Tab key again. The method name is completed to
next, and you get a shorter list:
jshell> generator.next
nextBoolean() nextBytes( nextDouble(
nextExponential() nextFloat( nextGaussian(
nextInt( nextLong(
Type a D and Tab again, and now the completion nextDouble( is filled in.
Hit Tab again, and you see three alternatives:
Signatures:
double
java.util.random.RandomGenerator.nextDouble(double
bound)
double
java.util.random.RandomGenerator.nextDouble(double
origin, double bound)
double Random.nextDouble()
<press tab again to see documentation>
Type a ) to select the third version:
jshell> generator.nextDouble()
$3 ==> 0.9560346568377398
Note
In the autocompletion list, methods that may require an argument are only
followed by a left parenthesis, such as nextDouble(, but methods
without arguments have both parentheses, such as nextBoolean().
To repeat a command, hit the ↑ key until you see the line that you want to
reissue or edit. You can move the cursor in the line with the ← and → keys,
and add or delete characters. Hit Enter when you are done. For example, hit ↑
and replace Double with Int, then hit Enter:
jshell> generator.nextInt()
$4 ==> -352355569
By default, JShell imports the following packages:
java.io
java.math
java.net
java.nio.file
java.util
java.util.concurrent
java.util.function
java.util.prefs
java.util.regex
java.util.stream
That’s why you can use the Random class in JShell without any import
statements. If you need to import another class, you can type the import
statement at the JShell prompt. Or, more conveniently, you can have JShell
search for it, by typing Shift+Tab and the I key. For example, type Duration
followed by Shift+Tab and the I key. You get a list of potential actions:
jshell> Duration
0: Do nothing
1: import: java.time.Duration
2: import: javafx.util.Duration
3: import: javax.xml.datatype.Duration
Choice:
Type 1, and you receive a confirmation:
Imported: java.time.Duration
followed by
jshell> Duration
so that you can pick up where you left off, but with the import in place.
These commands are enough to get you started with JShell. To get help, type
/help and Enter. To exit, type /exit and Enter, or simply Ctrl+D.
JShell makes it easy and fun to learn about the Java language and library,
without having to launch a heavy-duty development environment, and without
fussing with public static void main.
1.2. Primitive Types
Even though Java is an object-oriented programming language, not all Java
values are objects. Instead, some values belong to primitive types. Four of these
types are signed integer types, two are floating-point number types, one is the
character type char that is used in the encoding for strings, and one is the
boolean type for truth values. We will look at these types in the following
sections.
1.2.1. Signed Integer Types
The signed integer types are for numbers without fractional parts. Negative
values are allowed. Java provides the four signed integer types shown in Table
1.1.
Table 1.1: Java Signed Integer Types
Note
The constants Integer.MIN_VALUE and Integer.MAX_VALUE are
the smallest and largest int values. The Long, Short, and Byte classes
also have MIN_VALUE and MAX_VALUE constants.
In most situations, the int type is the most practical. If you want to represent
the number of inhabitants of our planet, you’ll need to resort to a long. The
byte and short types are mainly intended for specialized applications, such
as low-level file handling, or for large arrays when storage space is at a
premium.
Note
If the long type is not sufficient, use the BigInteger class. See
Section 1.4.6 for details.
In Java, the ranges of the integer types do not depend on the machine on which
you will be running your program. After all, Java is designed as a “write once,
run anywhere” language. In contrast, the integer types in C and C++ programs
depend on the processor for which a program is compiled.
You write long integer literals with a suffix L (for example, 4000000000L).
There is no syntax for literals of type byte or short. Use the cast notation
(see Section 1.4.4), for example, (byte) 127.
Hexadecimal literals have a prefix 0x (for example, 0xCAFEBABE). Binary
values have a prefix 0b. For example, 0b1001 is 9.
Caution
Octal numbers have a prefix 0. For example, 011 is 9. This can be
confusing, so it seems best to stay away from octal literals and leading
zeroes.
You can add underscores to number literals, such as 1_000_000 (or
0b1111_0100_0010_0100_0000) to denote one million. The underscores
are for human eyes only, the Java compiler simply removes them.
Note
If you work with integer values that can never be negative and you really
need an additional bit, you can, with some care, interpret signed integer
values as unsigned. For example, a byte value b represents the range
from –128 to 127. If you want a range from 0 to 255, you can still store it
in a byte. Due to the nature of binary arithmetic, addition, subtraction,
and multiplication will all work, provided they don’t overflow. For other
operations, call Byte.toUnsignedInt(b) to get an int value
between 0 and 255, then process the integer value, and cast the result back
to byte. The Integer and Long classes have methods for unsigned
division and remainder.
1.2.2. Floating-Point Types
The floating-point types denote numbers with fractional parts. The two
floating-point types are shown in Table 1.2.
Table 1.2: Floating-Point Types
Many years ago, when memory was a scarce resource, four-byte floating-point
numbers were in common use. But seven decimal digits don’t go very far, and
nowadays, “double precision” numbers are the default. It only makes sense to
use float when you need to store a large number of them.
Numbers of type float have a suffix F (for example, 3.14F). Floating-point
literals without an F suffix (such as 3.14) have type double. You can
optionally supply the D suffix (for example, 3.14D).
Note
You can specify floating-point literals in hexadecimal. For example,
0.0009765625 = 2–10 can be written as 0x1.0p-10. In hexadecimal
notation, you use a p, not an e, to denote the exponent. (An e is a
hexadecimal digit.) Note that, even though the digits are written in
hexadecimal, the exponent (that is, the power of 2) is written in decimal.
There are special floating-point values Double.POSITIVE_INFINITY for
∞, Double.NEGATIVE_INFINITY for –∞, and Double.NaN for “not a
number.” For example, the result of computing 1.0 / 0.0 is positive
infinity. Computing 0.0 / 0.0 or the square root of a negative number
yields NaN.
Caution
All “not a number” values are considered to be distinct from each other.
Therefore, you cannot use the test if (x == Double.NaN) to check
whether x is a NaN. Instead, call if (Double.isNaN(x)). There are
also methods Double.isInfinite to test for ±∞, and
Double.isFinite to check that a floating-point number is neither
infinite nor a NaN.
Floating-point numbers are not suitable for financial calculations in which
roundoff errors cannot be tolerated. For example, the command
System.out.println(2.0 - 1.7) prints 0.30000000000000004,
not 0.3 as you would expect. Such roundoff errors are caused by the fact that
floating-point numbers are represented in the binary number system. There is
no precise binary representation of the fraction 3/10, just as there is no accurate
representation of the fraction 1/3 in the decimal system. If you need precise
numerical computations with arbitrary precision and without roundoff errors,
use the BigDecimal class, introduced in Section 1.4.6.
1.2.3. The char Type
The char type describes “code units” in the UTF-16 character encoding used
by Java. The details are rather technical—see Section 1.5. You probably won’t
use the char type very much.
Occasionally, you may encounter character literals, enclosed in single quotes.
For example, ’J’ is a character literal with value 74 (or hexadecimal 4A), the
code unit for denoting the Unicode character “U+004A Latin Capital Letter J.”
A code unit can be expressed in hexadecimal, with the u prefix. For example,
’u004A’ is the same as ’J’. A more exotic example is ’u263A’, the
code unit for , “U+263A White Smiling Face.”
The special codes ’n’, ’r’, ’t’, ’b’ denote a line feed, carriage
return, tab, and backspace.
Use a backslash to escape a single quote ’’’ and a backslash ’’.
1.2.4. The boolean Type
The boolean type has two values, false and true.
In Java, the boolean type is not a number type. There is no relationship
between boolean values and the integers 0 and 1.
1.3. Variables
In the following sections, you will learn how to declare and initialize variables
and constants.
1.3.1. Variable Declarations
Java is a strongly typed language. Each variable can only hold values of a
specific type. When you declare a variable, you specify the type, the name, and
an optional initial value. For example,
int total = 0;
You can declare multiple variables of the same type in a single statement:
int total = 0, count; // count is an uninitialized integer
Most Java programmers prefer to use separate declarations for each variable.
Consider this variable declation:
Random generator = new Random();
Here, the name of the object’s class occurs twice. The first Random is the type
of the variable generator. The second Random is a part of the new
expression for constructing an object of that class.
To avoid this repetition, you can declare a variable with the var keyword:
var generator = new Random();
Then the type of the variable is the type of the expression with which the
variable is initialized. In this example, generator is a variable of type
Random.
In this book, I will use var whenever the type of the declared variable is
completely obvious.
1.3.2. Identifiers
The name of a variable, method, or class is called an identifier. In Java, an
identifier must begin with a letter. It can consist of any letters, digits, and the
symbols _ and $. However, the $ symbol is intended for automatically
generated identifiers, and you should not use it. Finally, the _ by itself is not a
valid identifier.
Here, letters and digits can be from any alphabet, not just the Latin alphabet.
For example, π and élévation are valid identifiers. Letter case is
significant: count and Count are different identifers.
You cannot use spaces or symbols in identifiers. Finally, you cannot use
keywords such as double.
By convention, names of variables and methods start with a lowercase letter,
and names of classes start with an uppercase letter. Java programmers like
“camel case,” where uppercase letters are used when names consist of multiple
words, like countOfInvalidInputs.
1.3.3. Initialization
When you declare a variable in a method, you must initialize it before you can
use it. For example, the following code results in a compile-time error:
int count;
count++; // Error—uses an uninitialized variable
The compiler must be able to verify that a variable has been initialized before it
has been used. For example, the following code is also an error:
int count;
if (total == 0) {
count = 0;
} else {
count++; // Error—count might not be initialized
}
You are allowed to declare a variable anywhere within a method. It is
considered good style to declare a variable as late as possible, just before you
need it for the first time. For example,
var in = new Scanner(System.in); // See Section 1.6.1 for
reading input
System.out.println("How old are you?");
int age = in.nextInt();
The variable is declared at the point at which its initial value is available.
1.3.4. Constants
The final keyword denotes a value that cannot be changed once it has been
assigned. In other languages, one would call such a value a constant. For
example,
final int DAYS_PER_WEEK = 7;
By convention, uppercase letters are used for names of constants.
You can also declare a constant outside a method, using the static keyword:
public class Calendar {
public static final int DAYS_PER_WEEK = 7;
...
}
Then the constant can be used in multiple methods. Inside Calendar, you
refer to the constant as DAYS_PER_WEEK. To use the constant in another
class, prepend the class name: Calendar.DAYS_PER_WEEK.
Note
The System class declares a constant
public static final PrintStream out
that you can use anywhere as System.out. This is one of the few
examples of a constant that is not written in uppercase.
It is legal to defer the initialization of a final variable, provided it is
initialized exactly once before it is used for the first time. For example, the
following is legal:
final int DAYS_IN_FEBRUARY;
if (leapYear) {
DAYS_IN_FEBRUARY = 29;
} else {
DAYS_IN_FEBRUARY = 28;
}
That is the reason for calling them “final” variables. Once a value has been
assigned, it is final and can never be changed.
Note
Sometimes, you need a set of related constants, such as
public static final int MONDAY = 0;
public static final int TUESDAY = 1;
...
In this case, you can define an enumeration like this:
enum Weekday { MONDAY, TUESDAY, WEDNESDAY,
THURSDAY, FRIDAY,
SATURDAY, SUNDAY };
Then, Weekday is a type with values Weekday.MONDAY and so on.
Here is how you declare and initialize a Weekday variable:
Weekday startDay = Weekday.MONDAY;
We will discuss enumerations in Chapter 4.
1.4. Arithmetic Operations
Java uses the familiar operators of any C-based language (see Table 1.3). We
will review them in the following sections.
Table 1.3: Java Operators
Note
In this table, operators are listed by decreasing precedence. For example,
since + has a higher precedence than <<, the value of 3 + 4 << 5 is (3
+ 4) << 5. An operator is left-associative when it is grouped left to
right. For example, 3 - 4 - 5 means (3 - 4) - 5. But -= is right-
associative, and i -= j -= k means i -= (j -= k).
1.4.1. Assignment
The last row in Table 1.3 shows the assignment operators. The statement
x = expression;
sets x to the value of the right-hand side, replacing the previous value.
Assignment is an operator with a value, namely the value that is being
assigned. It is legal to nest an assignment in another expression. For example,
(next = in.read()) != -1
sets next to the value that is returned by in.read(), and then evaluates to
true if that value is not -1.
When = is preceded by an operator, the operator combines the left- and right-
hand sides and the result is assigned. For example,
amount -= fee;
is the same as
amount = amount - fee;
1.4.2. Basic Arithmetic
Addition, subtraction, multiplication, and division are denoted by + - * /.
For example, 2
* n + 1 means to multiply 2 and n and add 1.
You need to be careful with the / operator. If both operands are integer types, it
denotes integer division, discarding the remainder. For example, 17 / 5 is 3,
whereas 17.0 / 5 is 3.4.
An integer division by zero gives rise to an exception which, if not caught, will
terminate your program. (See Chapter 5 for more information on exception
handling.) A floating-point division by zero yields an infinite value or NaN
(see Section 1.2.2), without causing an exception.
The % operator yields the remainder. For example, 17 % 5 is 2, the amount
that remains from 17 after subtracting 15 (the largest integer multiple of 5 that
“fits” into 17). If the remainder of a % b is zero, then a is an integer multiple
of b.
A common use is to test whether an integer is even. The expression n % 2 is
0 if n is even. What if n is odd? Then n % 2 is 1 if n is positive or -1 if n is
negative. That handling of negative numbers is unfortunate in practice. Always
be careful using % with potentially negative operands.
Consider this problem. You compute the position of the hour hand of a clock.
An adjustment is applied, and you want to normalize to a number between 0
and 11. That is easy: (position + adjustment) % 12. But what if
adjustment makes the position negative? Then you might get a negative
number. So you have to introduce a branch, or use ((position +
adjustment) % 12 + 12) % 12. Either way, it is a hassle.
Tip
In this case, it is easier to use the Math.floorMod method:
Math.floorMod(position + adjustment, 12) always
yields a value between 0 and 11.
Sadly, floorMod gives negative results for negative divisors, but
that situation doesn’t often occur in practice.
Java has increment and decrement operators:
n++; // Adds one to n
n--; // Subtracts one from n
As in other C-based languages, there is also a prefix form of these operators.
Both n++ and ++n increment the variable n, but they have different values
when they are used inside an expression. The first form yields the value before
the increment, and the second the value after the increment. For example,
String arg = args[n++];
sets arg to args[n], and then increments n. This made sense thirty years
ago when compilers didn’t do a good job optimizing code. Nowadays, there is
no performance drawback in using two separate statements, and many
programmers find the explicit form easier to read.
1.4.3. Mathematical Methods
There is no operator for raising numbers to a power. Instead, call the
Math.pow method: Math.pow(x, y) yields xy. To compute the square
root of x, call Math.sqrt(x).
These are static methods that don’t operate on objects. Like with static
constants, you prepend the name of the class in which they are declared.
Also useful are Math.min and Math.max for computing the minimum and
maximum of two values.
In addition, the Math class provides trigonometric and logarithmic functions
as well as the constants Math.PI and Math.E.
Note
The Math class provides several methods to make integer arithmetic safer.
The mathematical operators quietly return wrong results when a
computation overflows. For example, one billion times three
(1000000000 * 3) evaluates to -1294967296 because the largest
int value is just over two billion. If you call
Math.multiplyExact(1000000000, 3) instead, an exception is
generated. You can catch that exception or let the program terminate rather
than quietly continue with a wrong result. There are also methods
addExact, subtractExact, incrementExact,
decrementExact, negateExact, all with int and long
parameters.
A few mathematical methods are in other classes. For example, there are
methods compareUnsigned, divideUnsigned, and
remainderUnsigned in the Integer and Long classes to work with
unsigned values.
1.4.4. Number Type Conversions
When an operator combines operands of different number types, the numbers
are automatically converted to a common type before they are combined.
Conversion occurs in this order:
1. If either of the operands is of type double, the other one is converted to
double.
2. If either of the operands is of type float, the other one is converted to
float.
3. If either of the operands is of type long, the other one is converted to
long.
4. Otherwise, both operands are converted to int.
For example, if you compute 3.14 + 42, the second operand is converted
from an int to the double value 42.0, and then the sum is computed,
yielding the double value 45.14.
If you compute ’J’ + 1, the char value ’J’ is converted to the int value
74, and the result is the int value 75. Read on to find out how to convert that
value back to a char.
When you assign a value of a numeric type to a variable, or pass it as an
argument to a method, and the types don’t match, the value must be converted.
For example, in the assignment
double x = 42;
the value 42 is automatically converted from int to double.
In Java, conversions always exist if there is no loss of information:
From byte to short, int, long, or double
From short and char to int, long, or double
From int to long or double
All integer types can be converted to floating-point types.
Caution
The following conversions may lose information:
From int to float
From long to float or double
For example, consider the assignment
float f = 123456789;
Because a float only has about seven significant digits, f is actually
1.23456792E8.
To make a conversion that is not among these automatic ones, use a cast
operator: the name of the target type in parentheses. For example,
double x = 3.75;
int n = (int) x;
In this case, the fractional part is discarded, and n is set to 3.
If you want to round to the nearest integer instead, use the Math.round
method. That method returns a long. If you know the answer fits into an int,
call
int n = (int) Math.round(x);
In our example, where x is 3.75, n is set to 4.
To convert an integer type to another one with fewer bytes, also use a cast:
int n = 1;
char next = (char)(’J’ + n); // Converts 75 to ’K’
In such a cast, only the last bytes are retained.
int n = (int) 3000000000L; // Sets n to -1294967296
Note
If you worry that a cast can silently throw away important parts of a
number, use the Math.toIntExact method instead. When it cannot
convert a long to an int, an exception occurs.
1.4.5. Relational and Logical Operators
The == and != operators test for equality. For example, n != 0 is true
when n is not zero.
There are also the usual < (less than), > (greater than), <= (less than or equal),
and >= (greater than or equal) operators.
You can combine expressions of type boolean with the && (and), || (or),
and ! (not) operators. For example,
0 <= n && n < length
is true if n lies between zero (inclusive) and length (exclusive).
If the first condition is false, the second condition is not evaluated. This
“short circuit” evaluation is useful when the second condition could cause an
error. Consider the condition
n != 0 && s + (100 - s) / n < 50
If n is zero, then the second condition, which contains a division by n, is never
evaluated, and no error occurs.
Short circuit evaluation is also used for “or” operations, but then the evaluation
stops as soon as an operand is true. For example, the computation of
n == 0 || s + (100 - s) / n >= 50
yields true if n is zero, again without evaluating the second condition.
Finally, the conditional operator takes three operands: a condition and two
values. The result is the first of the values if the condition is true, the second
otherwise. For example,
time < 12 ? "am" : "pm"
yields the string "am" if time < 12 and the string "pm" otherwise.
Note
There are bitwise operators & (and), | (or), and ^ (xor) that are related to
the logical operators. They operate on the bit patterns of integers. For
example, since 0xF has binary digits 0...01111, n & 0xF yields the
lowest four bits in n, n = n | 0xF sets the lowest four bits to 1, and n
= n ^ 0xF flips them. The analog to the ! operator is ~, which flips all
bits of its operand: ~0xF is 1...10000.
There are also operators which shift a bit pattern to left or right. For
example, 0xF << 2 has binary digits 0...0111100. There are two
right shift operators: >> extends the sign bit into the top bits, and >>> fills
the top bits with zero. If you do bit-fiddling in your programs, you know
what that means. If not, you won’t need these operators.
Caution
The right-hand side operand of the shift operators is reduced modulo 32 if
the left hand side is an int, or modulo 64 if the left hand side is a long.
For example, the value of 1 << 35 is the same as 1 << 3 or 8.
Tip
The & (and) and | (or) operators, when applied to boolean values,
force evaluation of both operands before combining the results. This
usage is very uncommon. Provided that the right hand side doesn’t
have a side effect, they act just like && and ||, except they are less
efficient. If you really need to force evaluation of the second operand,
assign it to a boolean variable so that the flow of execution is
plainly visible.
1.4.6. Big Numbers
If the precision of the primitive integer and floating-point types is not
sufficient, you can turn to the BigInteger and BigDecimal classes in the
java.math package. Objects of these classes represent numbers with an
arbitrarily long sequence of digits. The BigInteger class implements
arbitrary-precision integer arithmetic, and BigDecimal does the same for
floating-point numbers. Of course, computations with big numbers are far
slower than with primitive numeric types.
The static valueOf method turns a long into a BigInteger:
BigInteger n =
BigInteger.valueOf(876543210123456789L);
You can also construct a BigInteger from a string of digits:
var k = new BigInteger("9876543210123456789");
There are predefined constants BigInteger.ZERO, BigInteger.ONE,
BigInteger.TWO, and BigInteger.TEN.
Java does not permit the use of operators with objects, so you must use method
calls to work with big numbers.
BigInteger r =
BigInteger.valueOf(5).multiply(n.add(k)); // r = 5
* (n + k)
In Section 1.2.2, you saw that the result of the floating-point subtraction 2.0
- 1.7 is 0.30000000000000004. The BigDecimal class can compute
the result accurately.
The call BigDecimal.valueOf(n, e) returns a BigDecimal instance
with value n × 10–e. The result of
BigDecimal.valueOf(2,
0).subtract(BigDecimal.valueOf(17, 1))
is exactly 0.3.
1.5. Strings
A string is a sequence of characters. In Java, a string can contain any Unicode
characters. For example, the string "Java™" or "Javau2122" consists of
the five characters J, a, v, a, and ™. The last character is “U+2122 Trade Mark
Sign.”
1.5.1. Concatenation
Use the + operator to concatenate two strings. For example,
String location = "Java";
String greeting = "Hello " + location;
sets greeting to the string "Hello Java". (Note the space at the end of
the first operand.)
When you concatenate a string with another value, that value is converted to a
string.
int age = 42;
String output = age + " years";
Now output is "42 years".
Caution
If you mix concatenation and addition, then you may get unexpected
results. For example,
"Next year, you will be " + age + 1 // Error
first concatenates age and then 1. The result is "Next year, you
will be 421". In such cases, use parentheses:
"Next year, you will be " + (age + 1) // OK
To combine several strings, separated with a delimiter, use the join method:
String names = String.join(", ", "Peter", "Paul",
"Mary");
// Sets names to "Peter, Paul, Mary"
The first argument is the separator string, followed by the strings you want to
join. There can be any number of them, or you can supply an array of strings.
(Arrays are covered in Section 1.8.)
It is somewhat inefficient to concatenate a large number of strings if all you
need is the final result. In that case, use a StringBuilder instead:
var builder = new StringBuilder();
while (more strings) {
builder.append(next string);
}
String result = builder.toString();
1.5.2. Substrings
To take strings apart, use the substring method. For example,
String greeting = "Hello, World!";
String location = greeting.substring(7, 12); // Sets
location to "World"
The first argument of the substring method is the starting position of the
substring to extract. Positions start at 0.
The second argument is the first position that should not be included in the
substring. In our example, position 12 of greeting is the !, which we do
not want. It may seem curious to specify an unwanted position, but there is an
advantage: the difference 12 - 7 is the length of the substring.
Sometimes, you want to extract all substrings from a string that are separated
by a delimiter. The split method carries out that task, returning an array of
substrings.
String names = "Peter, Paul, Mary";
String[] result = names.split(", ");
// An array of three strings ["Peter", "Paul", "Mary"]
The separator can be any regular expression (see Chapter 9). For example,
input.split("s+") splits input at white space.
1.5.3. String Comparison
To check whether two strings are equal, use the equals method. For example,
location.equals("World")
yields true if location is in fact the string "World".
Caution
Never use the == operator to compare strings. The comparison
location == "World" // Don’t do that!
returns true only if location and "World" are the same object in
memory. In the virtual machine, there is only one instance of each literal
string, so "World" == "World" will be true. But if location was
computed, for example, as
String location = greeting.substring(7, 12);
then the result is placed into a separate String object, and the
comparison location == "World" will return false!
Like any object variable, a String variable can be null, which indicates
that the variable does not refer to any object at all, not even an empty string.
String middleName = null;
To test whether an object is null, you do use the == operator:
if (middleName == null) ...
Note that null is not the same as an empty string "". An empty string is a
string of length zero, whereas null isn’t any string at all.
Caution
Invoking any method on null causes a “null pointer exception.” Like all
exceptions, it terminates your program if you don’t explicitly handle it.
Tip
When comparing a string against a literal string, it is a good idea to
put the literal string first:
if ("World".equals(location)) ...
This test works correctly even when location is null.
To compare two strings without regard to case, use the equalsIgnoreCase
method. For example,
"world".equalsIgnoreCase(location);
returns true if location is "World", "world", "WORLD", and so on.
Sometimes, one needs to put strings in order. The compareTo method tells
you whether one string comes before another in dictionary order. The call
first.compareTo(second)
returns a negative integer (not necessarily -1) if first comes before
second, a positive integer (not necessarily 1) if first comes after second,
and 0 if they are equal.
The strings are compared a character at a time, until one of them runs out of
characters or a mismatch is found. For example, when comparing "word" and
"world", the first three characters match. Since d has a Unicode value that
is less than that of l, "word" comes first. The call
"word".compareTo("world") returns -8, the difference between the
Unicode values of d and l.
This comparison can be unintuitive to humans because it depends on the
Unicode values of characters. "blue/green" comes before "bluegreen"
because / happens to have a lower Unicode value than g.
Tip
When sorting human-readable strings, use a Collator object that
knows about language-specific sorting rules. See Chapter 13 for more
information.
1.5.4. Converting Between Numbers and Strings
To turn an integer into a string, call the static Integer.toString method:
int n = 42;
String str = Integer.toString(n); // Sets str to "42"
A variant of this method has a second parameter, a radix (between 2 and 36):
String str2 = Integer.toString(n, 2); // Sets str2 to
"101010"
Note
An even simpler way of converting an integer to a string is to concatenate
with the empty string: "" + n. Some people find this ugly, and it is
slightly less efficient.
Conversely, to convert a string containing an integer to the number, use the
Integer.parseInt method:
String str = "101010";
int n = Integer.parseInt(str); // Sets n to 101010
You can also specify a radix:
int n2 = Integer.parseInt(str, 2); // Sets n2 to 42
For floating-point numbers, use Double.toString and
Double.parseDouble:
String str = Double.toString(3.14); // Sets str to
"3.14"
double x = Double.parseDouble(str); // Sets x to 3.14
1.5.5. The String API
As you might expect, the String class has a large number of methods. Some
of the more useful ones are shown in Table 1.4.
Table 1.4: Useful String Methods
Note that in Java, the String class is immutable. That is, none of the
String methods modify the string on which they operate. For example,
greeting.toUpperCase()
Random documents with unrelated
content Scribd suggests to you:
LETTER V.
Sir William Kyngston to Secretary Cromwell, May 16th.
1536, upon the preparations for the execution of my Lord
Rochford and Queen Anne.
[HARL. MS. 283. fol. 134. Orig.]
SIR,
Thys day I was with the kyng’s grace and declared the petysyons of
my Lord of Rochford, wherin I was answred. Sir, the sayd lord meche
desyreth to speke with you, weche towchet hys consyens meche as
he sayth, wherin I pray you I may know your plesur, for by cause of
my promysse made unto my sayd lord to do the same, and also I
shall desyre you further to know the kyngs plesur towchyng the
quene, as well for her comfyt as for the preparacion of skefolds and
hother necessarys consernyng. The kyng’s grace showed me that my
lord of Cantorbury shuld be hyr confessar, and was here thys day
with the quene; & not[223] in that mater, sir, the tyme ys short, for
the kyng supposeth the gentelmen to dy to morow, and my lord of
Rocheford with the reysydew of gentelmen, & as zit with yowt
[confession] weche I loke for, bot I have told my lord of Rocheford
that he be in aredynes to morow to sulfur execusyon, and so he
accepse[224] it very well, and will do his best to be redy,
Notwithstandyng he wold have reysayved hys ryghts, weche hathe
not bene used and in especiall here. Sir, I shall desyre you at[225] we
here may know the kyngs plesur here as shortly as may be, at[225]
we here may prepayre for the same weche[226] ys necessary, for the
same we here have now may for to do execusyon. Sir, I pray you
have gud rymembrance in all thys for hus[227] to do, for we shalbe
redy al ways to our knowlage. Zit thys day at dyner the quene sayd
at[225] she shuld go to Anvures[228] & ys in hope of lyf, and thus far
you well.
WILLM KYNGSTON.
LETTER VI.
Sir William Kingston to Lord Cromwell, apparently May 18th 1536.
[MS. COTTON, OTHO C. X. fol. 223.]
Syr,
Thys shalbe to advertyse you I have resayved your lettr
wherin yo[u
wolde] have strangerys conveyed yowt of the Towre and so thay be
by the [meanis] of Richard Gressum, & Will-m Loke, & Wythepoll,
bot the n̄ mbr[229] of stra[ngers past] not XXX. and not mony; Hothe
and the inbassitr
of the emperor had a [servaunt] ther and honestly
put yowt. Sr
yf we have not an owre[230] serten [as it may] be
knowen in London, I thynke he[re] wilbe bot few and I thynk [a
resonable] humbur[231] ware bes: for I suppose she wyll declare hyr
self to b[e a good] woman for all men bot for the kyng at the or
of
hyr de[th. For thys] mornyng she sent for me that I myght be with
hyr at [soche tyme] asshe reysayved the gud lord to the in tent I
shuld here by[r speke as] towchyng her innosensy alway to be clere.
& in the writy[ng of this] she sent for me, and at my commyng she
sayd, M. Kyngston, I he[ar saye I shall] not dy affore none, & I am
very sory ther fore; for I thowth [than to] be dede [an]d past my
payne. I told hyr it shuld be now payne it w[as so sottell. And then
she said I] hard say the executr
. was very gud, and I have a ly[ttle
necke, and put he]r hand abowt it lawyng hartely.
I have sen[e mony men &] also wemen executed and at they have
bene in gre[te sorrowe, and to my knowle]ge thys lady hathe meche
joye and plesur in dethe. [Sir, hyr Amner is conti]newally with hyr,
and hasse byne syns ij of the clo[cke after midnight. This is] the
effect of hony thyng that ys here at [thys tyme, and thus fare yow]
well.
Your . . . . . .
WILLM̄ KYNG[STON.]
LETTER VII.
From the Earl of Northumberland, addressed “To his
beloved Cosyn Thomas Arundel, one of the Gentlemen of
my Lord Legates prevy chambre.” It was written soon
after the death of the Earl’s father, in 1527. Referred to at
p. 339 of Wolsey’s life.
[FROM THE ARCHIVES OF THE DUKE OF NORTHUMBERLAND.]
Bedfellow, after my most harte recommendacion: Thys Monday the
iijd off August I resevyd by my servaunt, Letters from yow beryng
datt the XXth
day off July, deliveryd unto hym the sayme day at the
kyngs town of Newcastell; wher in I do perseayff my lord Cardenalls
pleasour ys to have such boks as was in the Chapell of my lat lord
and ffayther (wos soll Jhu pardon). To the accomplyshment of which
at your desyer I am confformable, notwithstanding I trust to be able
ons to set up a chapel off myne owne. But I pray God he may look
better upon me than he doth. But me thynk I have lost very moch,
ponderyng yt ys no better regardyd; the occasion wher off he shall
persayff.
Fyrst, the long lyeng of my tressorer[232], with hys very hasty and
unkynd words unto hym, not on my parte deserved.
Also the news off Mr. Manyng, the which ys blon obroud over all
Yorksher; that neyther by the kyng[233], nor by my lord cardenall am
I regardyd; And that he wyll tell me at my metyng with hym, when I
come unto Yorksher; which shall be within thys month, God wyllyng:
but I ffer[234] my words to Mr
Manyng shall displeas my lord; for I
will be no ward.
Also, bedfellow, the payns I tayk and have taykyn sens my comyng
hether, are not better regardyd; but by a fflatteryng Byshope of
Carel[235] and that fals Worm[236] shall be broth[237] to the messery
and carffulness that I am in; and in such slanders, that now and my
lord cardenal wold, he cannot bryng me howth[238] thereof.
I shall with all sped send up your lettrs with the books unto my lord’s
grace, as to say iiij Anteffonars[239], such as I thynk were not seen a
gret wyll; v Gralls; an Ordeorly; a Manuall; viijth
Proffessioners, And
ffor all the ressidew, they not worth the sending, nor ever was
occupyd in my lords chapel. And also I shall wryt at thys time as ye
have wylled me.
Yff my lord’s grace wyll be so good Lord unto me, as to gyf me
lychens[240] to put Wyllm
Worme within a castell of myn off Anwyk in
assurty, unto the tyme he have accomptyd ffor more money recd
.
than ever I recd
., I shall gyff hys grace ij Cli
. and a benefiss off a C.
worth unto hys colleyg, with such other thyngs resserved as his
[grace] shall desyre; but unto such tyme as myne Awdytors hayth
takyn accompt off him: wher in good bedfellow do your best, ffor els
he shall put us to send myselff, as at owr metyng I shall show yow.
And also gyff secuer credens unto this berer, whom I assur yow I
have ffonddon a marvellous honest man, as ever I ffownd in my lyff.
In hast at my monestary of Hul Park the iijd
. day of August. In the
owne hand off
Yours ever assured,
H. NORTHUMBERLAND.
To my bedfellow Arundel.
LETTER VIII.
The Earl of Northumberland to Cromwell, denying any
contract or promise of marriage between Anne Bullen and
himself.
[ORIGINAL, COTT. LIB. OTHO c. 10.]
Mr
Secretary, This shall be to signifie unto you that I perceive by Sir
Raynold Carnaby, that there is supposed a precontract between the
queen and me; wherupon I was not only heretofore examined upon
my oath before the Archbishopps of Canterbury and York, but also
received the blessed sacrament upon the same before the Duke of
Norfolk, and other the king’s highnes’ council learned in the spiritual
law; assuring you Mr
Secretary, by the said oath, and blessed body
which affore I received, and hereafter intend to receive, that the
same may be to my damnation, if ever there were any contracte or
promise of marriage between her and me. At Newington Green, the
xiijth day of Maye, in the 28th
year of the reigne of our soveraigne
lord King Henry the VIIIth
.
Your assured,
NORTHUMBERLAND.
LETTER IX.
Queen Catherine of Arragon and King Henry VIIIth to Cardinal
Wolsey, a joint letter, 1527.
[MS. COTTON, VITELL. B. XII. fol. 4.]
Mr. Ellis has printed this letter in its mutilated condition; I
have ventured to supply the lacunæ from the copy in
Burnet’s History of the Reformation, vol. i. p. 55. Burnet
obtained his transcript when it was in a perfect state, but
has unaccountably attributed the first part of the letter to
Anne Boleyn. It is however said by Mr. Ellis to be in the
hand-writing of Catherine, and cannot but be considered
very interesting.
My Lord, in my moste humblyst wys that my hart can thinke [I desire
you to pardon] me that I am so bold to troubyl yow with my sympyl
[& rude wryteng, estemyng] yt to prosed from her that is muche
desirus to kno[we that youer grace does well.] I paersave be this
berar that you do; the wiche I [praye God long to continewe,] as I
am moste bonde to pray, for I do know the g[reate paines and
trowbles that] you have taken for me bothe day and nyght [is never
like to be recompensyd on] my part, but allonly in loveng you next
on to the [kinges grace above all] creatures leveng; and I do not
dought but the [dayly proffes of my deades] shall manefestly declaer
and aferme my wryte[ng to be trewe, and I do] truste you do thynke
the same. My lord, I do assure you I do long to heare from you som
newes of the legat, for I do hope and [they come from you they]
shall be very good, and I am seur that you deseyre [it as moche as
I] and more, and ytt waer possibel as I knowe ytt ys not: And thus
remaineing in a stedfast hope I make anend of my letter, [writtyn
with the hande] of her that is moste bounde to be——
➔Here Queen Catherine’s part ends, the rest is in the hand-writing
of Henry the Eighth.
The wrytter of thys letter wolde not cease tyll she had [caused me
likewise] to set to my hand desyryng yow thowgh it be short to t[ake
it in good part.] I ensure yow ther is nother of us but that grettly
desyry[th to see you, and] muche more rejoyse to heare that you
have scapyd thys plage [so well, trustyng] the fury thereof to be
passyd, specially with them that k[epyth good diett] as I trust you
doo. The not heryng of the legates arywall [in Franse causeth] us
sumwhat to muse; nottwithstandyng we trust by your dily[gens and
vigilancy] (with the assystence of Almyghty God) shortly to be easyd
owght [of that trouble.] No more to yow at thys tyme but that I pray
God send yow [as good health] and prosperity as the wryters wolde.
By your lovyng so[veraign & frende]
HENR[Y R.]
LETTER X.
Anne Boleyn to Cardinal Wolsey.
[FIDDES’ COLLECTIONS, p. 256.]
My Lord, after my most humble recommendations this shall be to
gyve unto your grace as I am most bownd my humble thanks for the
gret payn & travelle that your grace doth take in steudyeng by your
wysdome and gret dylygens how to bryng to pas honerably the
gretyst welth that is possyble to come to any creator lyving, and in
especyall remembryng howe wretchyd and unworthy I am in
comparyng to his hyghnes. And for you I do know my selfe never to
have deservyd by my desertys that you shuld take this gret payn for
me, yet dayly of your goodnes I do perceyve by all my frends, and
though that I had nott knowlege by them the dayly proffe of your
deds doth declare your words and wrytyng toward me to be trewe;
nowe good my Lord your dyscressyon may consyder as yet how lytle
it is in my power to recompence you but all onely wyth my good wyl,
the whiche I assewer you that after this matter is brought to pas you
shall fynd me as I am: bownde in the mean tym to owe you my
servyse, and then looke what a thyng in thys woreld I can immagen
to do you pleasor in, you shall fynd me the gladyst woman in the
woreld to do yt, and next unto the kyngs grace of one thyng I make
you full promes to be assewryd to have yt and that is my harty love
unfaynydly deweryng my lyf, and beying fully determynd with Godds
grace never to change thys porpos, I make an end of thys my reude
and trewe meanyd letter, praying ower Lord to send you moche
increase of honer with long lyfe. Wrytten with the hand of her that
besechys your grace to except this letter as prosydyng from one that
is most bownde to be
Your humble and
obedient servante,
ANNE BOLEYN.
LETTER XI.
Anne Boleyn to Cardinal Wolsey.
FROM FIDDES’ COLLECTIONS, p. 255.
Collated with the Original in the Cottonian Collection. Brit. Mus. Otho
C. X. fol. 218.
My Lord, in my most humblyst wyse that my powuer hart can thynke
I do thanke your grace for your kind letter, and for youer rych and
goodly present, the whyche I shall never be able to desarve wyth
owt your gret helpe, of the whyche I have hetherto hade so grete
plente that all the dayes of my lyfe I ame moaste bownd of all
creators next the kyngs grace to love and serve your grace, of the
whyche I besyche you never to dowte that ever I shalle vary frome
this thought as long as ony brethe is in my body. And as tochyng
your grace’s troble with the swet I thanke ower Lord that them that
I desyerd and prayed for ar scapyd, and that is the kyng and you.
Not doughthyng bot that God has preservyd you bothe for grete
cawsys knowen allonly to his hygh wysdome. And as for the
commyng of the legate I desyer that moche; and yf it be Goddis
pleasor I pray him to send this matter shortly to a good ende; and
then I trust my lord to recompense part of your grete panys, the
whych I must requyer you in the meane tyme to excepte my good
wyll in the stede of the power, the whyche must prosede partly from
you as ower Lourd knoweth to whome I be syche to sende you
longe lyfe with continewance in honor. Wrytten wyth the hande of
her that is most bound to be
Your humble and
obedyent servante,
ANNE BOLEYN.
Core Java Vol 1 2 For The Impatient And Effective Pack 12th Ed Cay S Horstmann
LETTER XII.
Cardinal Wolsey in his Distress to Thomas Cromwell.
MS. COTTON. VESP. F. XIII. fol. 76.
From Fiddes’ Collections, p. 256. Collated with the Original.
Myn owne enterly belovyd Cromwell,
I beseche you as ye love me and wyl evyr do any thyng for me,
repare hyther thys day as sone as the parlement ys brokyn up, leyng
aparte all thyngs for that tyme; for I wold nat onely commynycat
thyngs unto yow wherin for my comfort & relief I wold have your
good sad, dyscret advyse & counsell, but also opon the same
commytt sertyng thyngs requyryng expedicion to yow, on my behalf
to be solycytyd: this I pray you therfor, to hast your commyng hyther
assafore, with owt omyttyng so to do, as ye tendyr my socor, reliff &
comfort, and quyetnes of mynde. And thus fare ye well: from Asher,
in hast, thys Satyrday in the mornyng, with the rude hande &
sorrowful hert of your assuryd lover
T. CARLIS
EBOR.
I have also serteyn thyngs consernyng yowr sylf wych I am suere ye
wolbe glad to here & knowe: fayle not therfore to be here thys
nygth, ye may retorne early in the mornyng ageyn yf nede shul so
requyre. Et iterum vale.
Mr. Augusteyn[241] shewyd me how ye had wryttyn onto me a lettre
wherin ye shuld advr
tyse of the comyng hyther of the Duke of
Norfolke: I assure you ther cam to my hands no suche lettre.
LETTER XIII.
From Wolsey to Dr. Stephen Gardener, Secretary of State.
Communicated to Mr. Grove by Mr. Littleton, afterwards
Lord Littleton, who possessed the original. It is now in the
Ashmole Museum at Oxford.
My owne goode Mastyr Secretary,
Goyng this day out of my pue to sey masse, your lettres datyd
yesternygth at London wer delyveryd unto me; by the contynue
wherof I undyrstand, that the kyng’s hyhnes, of hys excellent
goodnes & cheryte ys contentyd, that I shall injoy & have the
admynystracion of Yorke merly, with the gyftts of the promocyons
spiritual & temporall of the same, reservyd onely onto his nobyll
grace the gyft of v or vj of the best promocions. And that hys
pleasure ys, I shal leve Wynchester & Saynt Albons. As hereonto Mr.
Secretary, I can nat expresse howe moche I am bowndyn to the
kyng’s royal majeste for thys hys gret & bowntawse liberalyte,
reputyng the same to be moche more then I shal ever be abyl to
deserve. Howbeyt yf hys majeste, consyderyng the short & lyttyl
tyme that I shal lyve here in thys world, by the reason of such
hevynes as I have conceyved in my hert, with the ruinyuose of the
olde howsys & the decay of the said archbyshopryck at the best to
the sum of viii C Marcke yearly, by the reason of the act passyd for
Fynys of Testaments, wth also myn long paynful servys and poore
degre; and for the declaration of hys grace’s excellent cheryte, yf
hys hyhnes be myndyd I shal leve Wynchester & Saynt Albon’s, wych
I supposyd, when I maid my submyssyon, not offendying in my
trewth towards hys royal parson, dygnyte, or majeste royal, I should
not now have desyrvyd to have left; and much the more knowyng
his grace’s excellent propensyon to pyte & mercy, & rememberyng
the francke departyng with of all that I had in thys world, that I may
have summe convenyent pension reservyd unto me, suche as the
kyng’s hyhnes of hys nobyll charite shal thynke mete, so orderyng
his that shal succede and my lyvyng, that the same may be of lyck
valew yeerly and exstent. Whereat my trust ys, and my herte so
gevyth me, that hys majeste wold make no dyffyculte, yf yt may
lycke yow friendly to propone the same, assuryng yow that I desyre
not thys for any mynde (God ys my judge), that I have to
accumulate good, or desyre that I have to the muke of world; for,
God be thankyd, at thys ower I set no more by the ryches &
promocyons of the world, then by the roshe undyr my fote; but
onely for the declaration of the kyng’s favor & hyhe cheryte, & to
have wherewith to do good dedys, & to helpe my poore servants
and kynnysfolks. And furthermore that yt wold please the kyng’s
excellent goodnes by your freindly medyacion, consyderyng how
slendyrly I am furnyshyed in my howse, nowe specially that the
apparell of Wynchester and Saynt Albons shal be takyn from me, to
geve and appoynt unto me a convenyent fernyture for the same,
non ad pompam, sed necessariam honestatem. And yf I may have
the free gyft and dysposycion of the benefyces, yt shalbe gretly to
my comfort. And yet when any of the v or vi pryncypall shal fortune
to be voyd, the kyng’s grace being myndyd to have any of them, hys
hyhnes shalbe as sure of the same, as though they wer reservyd.
And thus by his nobyl & mercyful goodnes delyvered owt of extreme
calamite, & restoryd to a newe fredome, I shal, with God’s mercy &
help, so ordyr my lyff, that I trust hys majeste shal take special
comfort therin, & be pleasyd with the same: Spero quod hoc, quæ
peto, non videbitur magna. Howbeyt I most humbly submyt and
referre all my petytions, immo ipsam vitam, to his gracyous
ordynance & pleasure, praying yow to declare & sygnify the same,
supplying myn indysposycion & lacke of wyt, conceyvyd by reason of
my extreme sorowe & hevynes, that the same may be to the kyng’s
contentacion, wherin I had lever be ded then to offende in word,
thowght, or dede, and as towching the grantyng of the fee of one c
li. for Mr. Nores duryng hys lyff for hys good servys done unto the
kyng’s hyhnes, for the wych I have always lovyd him, and for the
singuler good hert and mynde, that I knowe he hath alweys borne
unto me, I am content to make out my grawnte upon the same, ye
& it wol please the kyng to inlarge it one c. li. more; and semblably
cause Mr. Thesauror hath the kepyng of the kyng’s game nygh to
Fernam, I wold gladly, if it may stand with the kyng’s pleasure,
grawnte unto hym the reversion of such thinges as the Lord Sands
hath there, with the ampliacon of the fee above that wych is oldely
accustomyd, to the sum of xl. li. by the yeere; & also I wold gladly
geve to Mr. Comptroller a lycke fee, & to Mr. Russel, another of xx. li.
by the yeere. Remyttyng thys and all other my sutes to the kyng’s
hyhnes pleasure, mercy, pity, & compassion, moste holly.
Beseechyng hys Hyhnes so nowe gracyously to ordyr me, that I may
from hensforth serve God quietly & with repose of mynd, & pray as I
am most bowndyn, for the conservacyon & increase of his most
nobyll and royal astate. And thus with my dayly prayer I byd yow
farewell. From Asher hastely with the rude hand and moste hevy
herte of
Yowr assuryd frende & bedysman,
T. CARLIS
EBOR.
LETTER XIV.
Cardinal Wolsey to Dr. Stephen Gardener.
This Letter was also communicated to Mr. Grove by Mr. Littleton. It is
now in the Ashmole Museum at Oxford.
MY OWNE GOODE MASTYR SECRETARY,
Aftyr my moste herty commendacions I pray yow at the reverens of
God to helpe, that expedicion be usyd in my persuts, the delay
wherof so replenyshyth my herte with hevynes, that I can take no
reste; nat for any vayne fere, but onely for the miserable condycion,
that I am presently yn, and lyclyhod to contynue yn the same, onles
that yow, in whom ys myn assuryd truste, do help & releve me
therin; For fyrst, contynuyng here in this mowest & corrupt ayer,
beyng enteryd into the passyon of the dropsy. Cum prostatione
appetitus et continuo insomnio. I cannat lyve: Wherfor of necessyte
I must be removyd to some other dryer ayer and place, where I may
have comodyte of physycyans. Secondly, havyng but Yorke, wych is
now decayd, by viii C. li. by the yeere, I cannot tell how to lyve, &
kepe the poore nombyr of folks wych I nowe have, my howsys ther
be in decay, and of evry thyng mete for howssold onprovydyd and
furnyshyd. I have non apparell for my howsys ther, nor money to
bring me thether, nor to lyve wyth tyl the propysse tyme of the
yeere shall come to remove thether. Thes thyngs consyderyd, Mr.
Secretary, must nedys make me yn agony and hevynes, myn age
therwith & sycknes consyderyd, alas Mr. Secretary, ye with other my
lordys shewyd me, that I shuld otherwyse be furnyshyd & seyn unto,
ye knowe in your lernyng & consyens, whether I shuld forfet my
spiritualties of Wynchester or no. Alas! the qualytes of myn offencys
consyderyd, with the gret punishment & losse of goodes that I have
sustaynyd, owt to move petyfull hertys; and the moste nobyl kyng,
to whom yf yt wold please yow of your cherytable goodnes to shewe
the premyses aftyr your accustomable wysdome & dexteryte, yt ys
not to be dowbtyd, but his highnes wold have consyderacyon &
compassyon, aggmentyng my lyvyng, & appoyntyng such thyngs as
shuld be convenient for my furniture, wych to do shalbe to the
kyng’s high honor, meryte, & dyscharge of consyens, & to yow gret
prayse for the bryngyng of the same to passe for your olde brynger
up and lovying frende. Thys kyndnes exibite from the kyng’s
hyghnes shal prolong my lyff for some lytyl whyl, thow yt shall nat
be long, by the meane whereof hys grace shal take profygtt, & by
my deth non. What ys yt to hys hyhnes to give some convenyent
porcion owt of Wynchester, & Seynt Albons, hys grace takyng with
my herty good wyl the resydew. Remember, good Mr. Secretary, my
poore degre, & what servys I have done, and how nowe approchyng
to deth, I must begyn the world ageyn. I besech you therfore,
movyd with pity and compassyon soker me in thys my calamyte, and
to your power wych I knowe ys gret, releve me; and I wyth all myn
shal not onely ascrybe thys my relef unto yow, but also praye to God
for the increase of your honor, & as my poore shal increase, so I shal
not fayle to requyte your kyndnes. Wryttyn hastely at Asher, with the
rude and shackyng hand of
Your dayly bedysman,
And assuryd frend,
T. CARLIS
EBOR.
To the ryght honorable and my assuryd frende Mastyr
Secretary.
LETTER XV.
Cardinal Wolsey to Secretary Gardener,
Desiring him to write to him and give him an account of the king’s
intentions with regard to him. (From Strype.)
Myn own good mastyr secretary, albeit I am in such altiration and
indisposition of my hede & body, by the meansse of my dayly
sorowe & hevynesse, that I am fen omit to writ any long lr̅ e̅ s. Yet my
trustyng frend, Thomas Crowmwel, retornyng & reparyng unto yow,
I cowde nat forbere, but brively to put yow in remembrance: how
that aftyr the consultation takyn by the kyngs hyghnes opon myn
orderyng, which ye supposyd shulde be on Sunday was sevennyght,
ye wolde not fayle to advertyse me at the length of the specialties
thereof. Of the w̄ ch to here & have knowleg, I have & dayly do looke
for. I pray yow therefore at the reverens of God, & of this holy tyme,
& as ye love & tendyr my poore lyf, do so moche as to wrytt onto
me your seyd lr̅ e̅ s: wherby I may take some cumfort & rest: nat
dowting but your hert is so gentyl & pityful, that havyng knowleg in
what agony I am yn, ye wole take the payne to send onto me your
seyd consollatory lr̅ e̅ s. Wherby ye shal nat onely deserve toward
God, but also bynde me to be as I am, your contynual bedysman.
Wrytten this mornyng at Asher, with the rude hand and sorroweful
hert of yours with hert and prayer.
T. Cardinalis Ebor. Miserrimus.
To the right honorable Mr. Secretary.
LETTER XVI.
Cardinal Wolsey to Secretary Gardener.
To draw up his pardon. (From Strype.)
Myn owne good Mastyr Secretary,
Aftyr my moste herty recommendations, with lycke thanks for your
goodnes towards me, thes shal be to advertyse yow that I have
beyn informyd by my trusty frend Thomas Cromwell that ye have
signifyed onto hym to my syngular consolation how that the kynges
highnes movyd with pety & compassyon, & of hys excellent goodnes
& cheryte consyderyng the lamentable condition & stat that I stand
yn, hath wyllyd yow with other lords and mastyrs of hys honorable
cownsell, to intende to the perfyghtyng & absolvyng without further
tract or delay of myn end & appoyntement; and that my pardon
shulde be made in the moste ample forme that my counsell cowde
devise. For thys the kyngs moste gracyous remembrance, procedyng
of hymself, I accompt my sylf not onely moste bowndyn to serve &
pray for the preservation of hys moste royal majestie, but also
thancke God that ye have occasion given onto you to be a sollycyter
& setter forth of such thynges as do & shall conserve my seyde
ende. In the makyng & compowndyng wherof myn assured truste is,
that ye wole shewe the love & affection wych ye have & bere
towards me, your olde lover & frende: so declaryng your self therin,
that the worlde may parceyve that by your good meanys the kyng ys
the bettyr goode lorde unto me; & that nowe newly in maner
comyng to the world, ther maye be such respect had to my poore
degree, olde age & longe contynued servys, as shal be to the kyngs
hygh honor & your gret prayse & laude. Wych ondowtydly shall
folowe yf ye optinde yowre benyvolens towards me, & men perceive
that by your wisdome & dexterite I shalbe relevyd, & in this my
calamyte holpen. At the reverens therefore of God myn owne goode
Mr. Secretary, & refugy, nowe set to your hande, that I may come to
a laudable end & repos, seyng that I may be furnyshyd aftyr such a
sorte & maner as I may ende my short tyme & lyff to the honor of
Crystes churche & the prince. And besides my dayly prayer & true
hert I shal so requyte your kyndnes, as ye shall have cause to
thyncke the same to be well imployde, lycke as my seyd trusty
frende shall more amply shewe onto you. To whom yt may please
yow to geve firme credens and lovyng audyens. And I shall pray for
the increase of your honour. Wryttyn at Assher with the tremyllyng
hand & hevy hert of your assuryd lover & bedysman
T. CARDLIS
EBOR.
To the ryght honorable and my singular good frende
Mayster Secretary.
LETTER XVII.
Cardinal Wolsey to Secretary Gardener,
Desiring him to favour the cause of the Provost of Beverly, and to
intercede with the king for him and his colleges. (From Strype.)
Myne awne gentil Maister Secretary,
After my mooste herty recommendations, these shal be to thanke
you for the greate humanite, lovyng & gentil recule, that ye have
made unto the poore Provost of Beverly: & specialy, for that ye have
in such wise addressed hym unto the kings highnes presence, that
his grace not onely hath shewed unto hym, that he is his goode &
gracious lorde, but also that it hath pleased hys majeste to admitte
& accepte hym as his poore orator & scholer. Wherby both he & I
accompte our selfs so bounden unto you, that we cannot telle how
to requite this your gratitude & kyndenes; mooste hartely praying
you to contynue in your good favour towards hym, & to take hym &
his pore causis into your patrocynye & protection. And, as myne
assured expectation & trust is, to remember the poor state &
condition that I stond in, & to be a meane to the kyngs highness for
my relefe in the same. In doyng wherof ye shal not onely deserve
thanks of God, but also declare to your perpetual laud and prayse,
that ye beyng in auctorite, have not forgoten your olde maister &
frynde. And in the wey of charite, & for the love that ye bere to
virtue, & ad bona studia, be meane to the kyngs highnes for my
poore colleges; and specially for the college of Oxford. Suffer not the
things, which by your greate lernyng, studie, counsaile & travaile,
hath bene erected, founden, & with good statutes & ordinances, to
the honour of God, increase of vertue & lernyng established, to be
dissolved or dismembred. Ye do know, no man better, to what use
the monasteries, suppressed by the popis licence, the kyngs
consente concurryng with the same, & a pardon for the
premoneri[242], be converted. It is nat to be doubted, but the kyngs
highnes, of his high vertue & equite, beyng informed how every
thing is passed, his mooste gracious license & consente (as is
aforesaid) adhibited therunto, wol never go aboute to dissolve the
said incorporations or bodyes, wherof so greate benefite &
commodite shal insue unto his realme & subjects. Superfluities, if
any such shal be thought & founden, may be resecat; but to destroy
the hole, it were to greate pitie.
Eftsones therefore, good Maister Secretaire, I beseche you to be
good maister & patrone to the said colleges: “Et non sinas opus
manuum tuarum perire, aut ad nihilum redige.” Thus doyng, both I,
& they shal not onely pray for you, but in such wise deserve your
paynes, as ye shal have cause to thinke the same to be wel
bestowed & imployed, like as this present berer shal more at the
large shewe unto you. To whom it may please the same to geve
firme credence. And thus mooste hartely fare ye wel. From
Sothewell, the xxiijth
day of July.
Your lovyng frende,
T. CARLIS
EBOR.
To the right honorable & my singular good frende Mr
Doctor Stephyns, Secretory to the Kings Highnes.
LETTER XVIII.
Cardinal Wolsey to Secretary Gardener,
Desiring his favour in a suit against him for a debt of 700l. by one
Strangwish. (From Strype.)
Myne awne good Maister Secretary,
After my mooste harty recommendations, these shal be to desire, &
mooste effectuelly to pray you to be good maister & friende unto
me, concernyng the uncharitable sute of Strangwishe for vij C li.,
which he pretendith that I shulde owe unto hym, for the ward of
Bowes. And albeit there was at his fyrste comyng to my service, by
our mutual consents, a perfecte end made between hym & me for
the same, yet nowe digressyng therfrom, perceyvyng that I am out
of favour, destitute of socour, & in calamite, he not onely newly
demaundyth the said vij C li. but also hath made complaint unto the
kyngs highnes, surmittyng, that I shulde, contrary to justice,
deteyne from hym the said vij C li. For the redresse whereof, it hath
pleased the kyngs majeste to direct his mooste honorable letters
unto me; the contents wherof I am sure be nat unknown unto you.
And insuing the purporte therof, & afore the delyvere of the same
thre days by past, notwithstanding my greate necessite & poverte,
onely to be out of his exclamation & inquietnes, I have written to my
trusty friende, Mr
Cromwel, to make certeyn reasonable offres unto
hym for that intent and purpose; moost hartely beseching you to
helpe, that upon declaration of such things, as upon my part shal be
signified unto you by the said Maister Cromwell, some such end, by
your friendely dexterite, may bee made betwixt us, as shal accorde
with good congruence, & as I may supporte & be hable (myne other
debts and charges considered) to bere. In the doyng wherof, ye shall
bynde me to be your dayly bedesman, as knoweth God, who
alwayes preserve you. From Sothewell, the xxvth
day of August.
Yours with hert & prayer,
T. CARLIS
EBOR.
To my right entierly welbiloved frende Mr
Stephyn
Gardener, Secretory to kyngs highnes.
LETTER XIX.
Lettre de Monsieur de Bellay Evesque de Bayonne à Mr le Grant
Maistre. De Londres le xvij Oct. 1529.
[MSS. DE BETHUNE BIBLIOTH. DU ROY, V. 8603. f. 113.]
Monseigneur, depuis les lettres du Roy & les aultres vostres que je
pensoye sur l’heure envoyer, cette depesche a estée retardé jusques
à présent, parce qu’il a fallu faire & refaire les lettres que je vous
envoyé tout plein de fois, & pour ce aller & venir souvent, tant les
Ducs mêmes qu’aultres de ce conseil à Windesore, dont toute à
cette heure ils les m’ont envoyées en la forme que verrez par le
double d’iceux. Ils me prient le plus fort du monde de faire qu’on ne
trouve mauvais si en ces expéditions, & mesmement en ce que
touche le principal de la depesche, je ne suis de tout satisfait comme
je vouldroye, & aussi eulx mesmes, s’excusans que leur manière de
négocier envers leur maistre n’est encore bien dressée, mais pour
l’advenir doibvent faire merveilles, & en baillent de si grands
asseurances & si bien jurées, que je ne puis me garder de les croire;
je n’ay point refreschy mes lettres au Roy, car je ne voy point qu’il y
en ait matière.
Au demourant, j’ay esté voir le Cardinal en ses ennuis, où j’ay trouvé
les plus grand exemple de fortune que on ne scauroit voir, il m’a
remonstré son cas en la plus mauvaise rhétorique que je viz jamais,
car cueur & parolle luy failloient entièrement; il a bien plouré & prié
que le Roy & Madame voulsissent avoir pitié de luy, s’ils avoyent
trouvé qu’il leur eust guardé promesse de leur estre bon serviteur
autant que son honneur & povoir se y est peu estendre, mais il me à
la fin laissé sans me pouvoir dire autre chose qui vallist mieux que
son visage, qui est bien descheu de la moitié de juste pris: & vous
promets, Monseigneur, que sa fortune est telle que ses ennemis,
encore qu’ils soyent Angloys, ne se scauroyent guarder d’en avoir
pitié, ce nonobstant ne le laisseront de le poursuivre jusques au
bout, & ne voyt de moyen de son salut, aussi ne fais-je sinon qu’il
plaise au Roy & à Madame de l’ayder. De légation, de sceau
d’auctorité, de crédit il n’en demande point, il est prest de laisser
tout jusques à la chemise, & que on le laisse vivre en ung
hermitage, ne le tenant ce Roy en sa mal grâce: Je l’ay reconforté
au mieulx que j’ay peu, mais je n’y ay sceu faire grant chose: Depuis
par un en qui il se fie, il m’a mandé ce qu’il vouldroit qu’on feist pour
luy de la plus grand partie, luy voyant qu’il ne touchoit au bien des
affaires du Roy qu’on luy accordast la plus raisonnable chose qui
demande, c’est que le Roy escripvist à ce Roy qu’il est un grand bruit
de par delà qu’il l’ait recullé d’autour de luy, & fort eslongé de la
bonne grâce, en sorte qu’on dict qu’il doibve estre destruict, ce que
ne pense totalement estre comme on le dict; toutefois pour la bonne
fraternité, qu’ils ont ensemble, & si grant communication de tous
leurs plus grans affaires, l’a bien voulu prier de y avoir égard, affin
qu’il n’en entre souldainement quelque mauvaise fantasie envers
ceulx qui ont veu qu’en si grant solemnité & auctorité, il ait servy
d’instrument en cette perpétuelle amitié tant renommée par toute la
Chrétienté; & que si d’adventure il estoit entré en quelque
malcontentement de luy, il veüille ung peu modérer son affection,
comme il est bien sûr que luy vouldront conseiller ceulx qui sont
autour de sa personne & au maniement de ses plus grandes affaires.
Voilà, Monseigneur, la plus raisonable de toutes ses demandes, en
laquelle ne me veulx ingérer de dire mon advis, si diray-je bien qu’il
n’y a personne ici qui deust prendre à mal telle lettre; & mesment là
où ils considéreront, comme de facit ils font, qu’il sont forcés de
prendre & tenir plus que jamais votre party, & d’advantage
asseureray bien que la plus grant prinse qu’ils ayent peû avoir suz
luy du commencement, & qui plus leur a servi à le brouiller envers le
Roy, a esté qu’il déclara à ma venuë decza trop ouvertement de
vouloir aller à Cambray, car les aultres persuaderent au maistre ce
que c’estoient, seulement pour éviter d’estre à l’expédition du
mariage, & outre cela vous promets que sans luy les aultres
mectoyent ce Roy en ung terrible train de rompre la pratique de paix
dont vous escripvis quelque mot en ce temps-la, mais j’en laissay dix
fois en la plume, voyant que tout estoit rabillé, je vous les diray
estant là, & je suis seur que le trouverez fort estrange: Il me semble,
Monsieur, que à tout cela, & plusieurs aultres choses que bien
entendez de vous-mesmes, on doibt avoir quelque égard, vous
donnerez, s’il vous plaist, advis au Roy & à Madame de tout cecy,
affin qu’ils advisent ce qu’il leur plaira en faire, s’ils pensent
n’empirer par cela leurs affaires, je croy que voulentiers, outre ce
que sera quelque charité, ils vouldront qu’on cognoisse qu’ils ayent
retiré ung leur affectionné serviteur, & tenu pour tel par chescun,
des portes d’enfer; mais sur tout, Monseigneur, il desire que ce Roy
ne connoisse qu’ils en ayent esté requis, & que il les en ay fait
requerir en façon du monde, cela l’acheveroit d’affoller; car pour
vous dire le vray, & hormis toute affection, je vous asseure que la
plus grant prinse que ses ennemis ayent euë sur luy, outre celle du
mariage, ce a esté de persuader ce Roy que il avoit tousjours eu en
temps de paix et de guerre intelligence secrette à Madame, de
laquelle ladite guerre durant il avoit eu des grants presens, qui
furent cause que Suffolc estant à Montdidier, il ne le secourut
d’argent comme il debvoit, dont avint que il ne prit Paris; mais ils en
parlent en l’oreille de ce propos, afin que je n’en soy adverty. Quant
auxdits presens, il espère que Madame ne le nuyra où il en sera
parlé, de toutes aultres choses il s’en recommande en sa bonne
grâce. La fantaisie de ces seigneurs est que luy mort ou ruiné, il
deffèrent incontinent icy l’estat de l’Eglise, & prendront tous leurs
biens, qu’il seroit ja besoing que je misse en chiffre, car ils le crient
en plaine table; je croy qu’ils feront de beaux miracles, si m’a dict
vostre grant prophète au visaige bronsé, que ce Roy ne vivre gueres
plus que........ au quel, comme vous sçavez, à ce que je voy par ses
escriptures, il n’a baillé terme que de la monstre de May. Je ne veulx
oublier à vous dire que si le Roy & Madame veullent faire quelque
chose pour le Légat, il faudroit se haster, encores ne seront jamais
icy ses lettres que il n’ait perdu le sceau, toutefois il ne pense plus à
cela, elles serviront pour le demourant, aussi venant icy mon
successeur, comme chascun s’attend qu’il viendra dans peu des
jours, ils luy donnassent charge d’en parler; le pis de son mal est
que Mademoiselle de Boulen a faict promettre à son amy que il ne
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.
More than just a book-buying platform, we strive to be a bridge
connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.
Join us on a journey of knowledge exploration, passion nurturing, and
personal growth every day!
ebookbell.com

More Related Content

PDF
Core Java An Integrated Approach 2nd R Nageswara Rao
jasonarkadiethet
 
PDF
Learn java in one day and learn it well 2016 jamie chan
anand_study
 
PDF
Download full ebook of Programming With Java Edet Theophilus instant download...
noyzdapat39
 
PDF
Learning Java 4th Edition Patrick Niemeyer Daniel Leuck
zachryqypi73
 
PDF
Core Java Vol Iiadvanced Features 12th Edition Cay S Horstmann
broasutschdy
 
PDF
Essential Java For Scientists And Engineers 1st Brian D Hahn
yralabasah
 
PDF
Core Java Volume I Fundamentals 12th Horstmann Cay
luellarensdw
 
PPT
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
nagendrareddy104104
 
Core Java An Integrated Approach 2nd R Nageswara Rao
jasonarkadiethet
 
Learn java in one day and learn it well 2016 jamie chan
anand_study
 
Download full ebook of Programming With Java Edet Theophilus instant download...
noyzdapat39
 
Learning Java 4th Edition Patrick Niemeyer Daniel Leuck
zachryqypi73
 
Core Java Vol Iiadvanced Features 12th Edition Cay S Horstmann
broasutschdy
 
Essential Java For Scientists And Engineers 1st Brian D Hahn
yralabasah
 
Core Java Volume I Fundamentals 12th Horstmann Cay
luellarensdw
 
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
nagendrareddy104104
 

Similar to Core Java Vol 1 2 For The Impatient And Effective Pack 12th Ed Cay S Horstmann (20)

PPT
Java Simple Introduction in single course
binzbinz3
 
PPTX
Java programmingjsjdjdjdjdjdjdjdjdiidiei
rajputtejaswa12
 
PDF
The java interview questions ebook - confused coders
Yash Sharma
 
PPTX
Java Jive 002.pptx
AdarshSingh202130
 
PPT
Java
Manav Prasad
 
PPT
INTRODUCTION TO JAVA
Pintu Dasaundhi (Rahul)
 
PPT
java-corporate-training-institute-in-mumbai
vibrantuser
 
PPT
java-corporate-training-institute-in-mumbai
Unmesh Baile
 
PPTX
Skillwise Elementary Java Programming
Skillwise Group
 
PPT
java01.ppt
MansiDongare2
 
PPT
OOPs concept and java Environment decsion making statement looping array and ...
hannahroseline2
 
PPT
java01.ppt
BabekEsedli
 
PPT
java01.ppt
priyanshugautam46
 
PPT
java01.ppt
archibhartiya
 
PPT
java01.ppt
ximiha8972
 
PPT
java01.ppt
SouravGhosh305827
 
PPTX
mukul Dubey.pptx
CodeHome
 
PPT
java01.ppt
ROGNationYT
 
PPT
java01.ppt
ShivamChaturvedi67
 
Java Simple Introduction in single course
binzbinz3
 
Java programmingjsjdjdjdjdjdjdjdjdiidiei
rajputtejaswa12
 
The java interview questions ebook - confused coders
Yash Sharma
 
Java Jive 002.pptx
AdarshSingh202130
 
INTRODUCTION TO JAVA
Pintu Dasaundhi (Rahul)
 
java-corporate-training-institute-in-mumbai
vibrantuser
 
java-corporate-training-institute-in-mumbai
Unmesh Baile
 
Skillwise Elementary Java Programming
Skillwise Group
 
java01.ppt
MansiDongare2
 
OOPs concept and java Environment decsion making statement looping array and ...
hannahroseline2
 
java01.ppt
BabekEsedli
 
java01.ppt
priyanshugautam46
 
java01.ppt
archibhartiya
 
java01.ppt
ximiha8972
 
java01.ppt
SouravGhosh305827
 
mukul Dubey.pptx
CodeHome
 
java01.ppt
ROGNationYT
 
java01.ppt
ShivamChaturvedi67
 
Ad

Recently uploaded (20)

PPTX
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
PPTX
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
PPTX
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
PPTX
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
PPTX
CDH. pptx
AneetaSharma15
 
PPTX
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
PPTX
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
PPTX
How to Apply for a Job From Odoo 18 Website
Celine George
 
PPTX
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
PPTX
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
PDF
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PPTX
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
PDF
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
PPTX
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
PPTX
Care of patients with elImination deviation.pptx
AneetaSharma15
 
PPTX
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
PPTX
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PPTX
Basics and rules of probability with real-life uses
ravatkaran694
 
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
CDH. pptx
AneetaSharma15
 
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
How to Apply for a Job From Odoo 18 Website
Celine George
 
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
Care of patients with elImination deviation.pptx
AneetaSharma15
 
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
Basics and rules of probability with real-life uses
ravatkaran694
 
Ad

Core Java Vol 1 2 For The Impatient And Effective Pack 12th Ed Cay S Horstmann

  • 1. Core Java Vol 1 2 For The Impatient And Effective Pack 12th Ed Cay S Horstmann download https://ebookbell.com/product/core-java-vol-1-2-for-the- impatient-and-effective-pack-12th-ed-cay-s-horstmann-50687482 Explore and download more ebooks at ebookbell.com
  • 2. Here are some recommended products that we believe you will be interested in. You can click the link to download. Core Java Vol Iiadvanced Features 12th Edition Cay S Horstmann https://ebookbell.com/product/core-java-vol-iiadvanced-features-12th- edition-cay-s-horstmann-49554648 Core Java Vol Iiadvanced Features 12th Edition Cay S Horstmann https://ebookbell.com/product/core-java-vol-iiadvanced-features-12th- edition-cay-s-horstmann-38321494 Core Java Volume Ii Advanced Features 11th Vol Ii Cay Horstmann https://ebookbell.com/product/core-java-volume-ii-advanced- features-11th-vol-ii-cay-horstmann-9992752 Core Java Volume I Fundamentals 12th Horstmann Cay https://ebookbell.com/product/core-java-volume-i-fundamentals-12th- horstmann-cay-46173296
  • 3. Core Java Volume Ii Advanced Features 12th Cay S Horstmann https://ebookbell.com/product/core-java-volume-ii-advanced- features-12th-cay-s-horstmann-46173298 Core Java For The Impatient 3rd Edition Cay Horstmann https://ebookbell.com/product/core-java-for-the-impatient-3rd-edition- cay-horstmann-48456364 Core Java Interview Questions Youll Most Likely Be Asked Job Interview Questions Series 2nd Edition Vibrant Publishers https://ebookbell.com/product/core-java-interview-questions-youll- most-likely-be-asked-job-interview-questions-series-2nd-edition- vibrant-publishers-49183978 Core Java Made Simple Som Prakash Rai https://ebookbell.com/product/core-java-made-simple-som-prakash- rai-49422914 Core Java Volume Ifundamentals Cay S Horstmann https://ebookbell.com/product/core-java-volume-ifundamentals-cay-s- horstmann-49541448
  • 6. Core Java for the Impatient Third Edition Cay S. Horstmann Addison-Wesley Professional
  • 7. Contents Preface Acknowledgments About the Author Chapter 1: Fundamental Programming Structures Chapter 2: Object-Oriented Programming Chapter 3: Interfaces and Lambda Expressions Chapter 4: Inheritance and Reflection Chapter 5: Exceptions, Assertions, and Logging Chapter 6: Generic Programming Chapter 7: Collections Chapter 8: Streams Chapter 9: Processing Input and Output Chapter 10: Concurrent Programming Chapter 11: Annotations Chapter 12: The Date and Time API Chapter 13: Internationalization Chapter 14: Compiling and Scripting Chapter 15: The Java Platform Module System
  • 8. Table of Contents Preface Acknowledgments About the Author Chapter 1: Fundamental Programming Structures 1.1. Our First Program 1.2. Primitive Types 1.3. Variables 1.4. Arithmetic Operations 1.5. Strings 1.6. Input and Output 1.7. Control Flow 1.8. Arrays and Array Lists 1.9. Functional Decomposition Exercises Chapter 2: Object-Oriented Programming 2.1. Working with Objects 2.2. Implementing Classes 2.3. Object Construction 2.4. Records 2.5. Static Variables and Methods 2.6. Packages 2.7. Nested Classes 2.8. Documentation Comments Exercises Chapter 3: Interfaces and Lambda Expressions 3.1. Interfaces
  • 9. 3.2. Static, Default, and Private Methods 3.3. Examples of Interfaces 3.4. Lambda Expressions 3.5. Method and Constructor References 3.6. Processing Lambda Expressions 3.7. Lambda Expressions and Variable Scope 3.8. Higher-Order Functions 3.9. Local and Anonymous Classes Exercises Chapter 4: Inheritance and Reflection 4.1. Extending a Class 4.2. Inheritance Hierarchies 4.3. Object: The Cosmic Superclass 4.4. Enumerations 4.5. Runtime Type Information and Resources 4.6. Reflection Exercises Chapter 5: Exceptions, Assertions, and Logging 5.1. Exception Handling 5.2. Assertions 5.3. Logging Exercises Chapter 6: Generic Programming 6.1. Generic Classes 6.2. Generic Methods 6.3. Type Bounds 6.4. Type Variance and Wildcards 6.5. Generics in the Java Virtual Machine 6.6. Restrictions on Generics 6.7. Reflection and Generics Exercises Chapter 7: Collections 7.1. An Overview of the Collections Framework 7.2. Iterators
  • 10. 7.3. Sets 7.4. Maps 7.5. Other Collections 7.6. Views Exercises Chapter 8: Streams 8.1. From Iterating to Stream Operations 8.2. Stream Creation 8.3. The filter, map, and flatMap Methods 8.4. Extracting Substreams and Combining Streams 8.5. Other Stream Transformations 8.6. Simple Reductions 8.7. The Optional Type 8.8. Collecting Results 8.9. Collecting into Maps 8.10. Grouping and Partitioning 8.11. Downstream Collectors 8.12. Reduction Operations 8.13. Primitive Type Streams 8.14. Parallel Streams Exercises Chapter 9: Processing Input and Output 9.1. Input/Output Streams, Readers, and Writers 9.2. Paths, Files, and Directories 9.3. HTTP Connections 9.4. Regular Expressions 9.5. Serialization Exercises Chapter 10: Concurrent Programming 10.1. Concurrent Tasks 10.2. Asynchronous Computations 10.3. Thread Safety 10.4. Parallel Algorithms 10.5. Threadsafe Data Structures
  • 11. 10.6. Atomic Counters and Accumulators 10.7. Locks and Conditions 10.8. Threads 10.9. Processes Exercises Chapter 11: Annotations 11.1. Using Annotations 11.2. Defining Annotations 11.3. Standard Annotations 11.4. Processing Annotations at Runtime 11.5. Source-Level Annotation Processing Exercises Chapter 12: The Date and Time API 12.1. The Time Line 12.2. Local Dates 12.3. Date Adjusters 12.4. Local Time 12.5. Zoned Time 12.6. Formatting and Parsing 12.7. Interoperating with Legacy Code Exercises Chapter 13: Internationalization 13.1. Locales 13.2. Number Formats 13.3. Currencies 13.4. Date and Time Formatting 13.5. Collation and Normalization 13.6. Message Formatting 13.7. Resource Bundles 13.8. Character Encodings 13.9. Preferences Exercises Chapter 14: Compiling and Scripting 14.1. The Compiler API
  • 12. 14.2. The Scripting API Exercises Chapter 15: The Java Platform Module System 15.1. The Module Concept 15.2. Naming Modules 15.3. The Modular “Hello, World!” Program 15.4. Requiring Modules 15.5. Exporting Packages 15.6. Modules and Reflective Access 15.7. Modular JARs 15.8. Automatic Modules 15.9. The Unnamed Module 15.10. Command-Line Flags for Migration 15.11. Transitive and Static Requirements 15.12. Qualified Exporting and Opening 15.13. Service Loading 15.14. Tools for Working with Modules Exercises
  • 13. Preface Java is now well over twenty years old. The classic book, Core Java, covers, in meticulous detail, not just the language but all core libraries and a multitude of changes between versions, spanning two volumes and over 2,000 pages. However, if you just want to be productive with modern Java, there is a much faster, easier pathway for learning the language and core libraries. In this book, I don’t retrace history and don’t dwell on features of past versions. I show you the good parts of Java as it exists today, so you can put your knowledge to work quickly. As with my previous “Impatient” books, I quickly cut to the chase, showing you what you need to know to solve a programming problem without lecturing about the superiority of one paradigm over another. I also present the information in small chunks, organized so that you can quickly retrieve it when needed. Assuming you are proficient in some other programming language, such as C++, JavaScript, Objective C, PHP, or Ruby, with this book you will learn how to become a competent Java programmer. I cover all aspects of Java that a developer needs to know today, including the powerful concepts of lambda expressions and streams, as well as modern constructs such as records and sealed classes. A key reason to use Java is to tackle concurrent programming. With parallel algorithms and threadsafe data structures readily available in the Java library, the way application programmers should handle concurrent programming has completely changed. I provide fresh coverage, showing you how to use the powerful library features instead of error-prone low- level constructs. Traditionally, books on Java have focused on user interface programming— but nowadays, few developers produce user interfaces on desktop computers. If you intend to use Java for server-side programming or
  • 14. Android programming, you will be able to use this book effectively without being distracted by desktop GUI code. Finally, this book is written for application programmers, not for a college course and not for systems wizards. The book covers issues that application programmers need to wrestle with, such as logging and working with files —but you won’t learn how to implement a linked list by hand or how to write a web server. I hope you enjoy this rapid-fire introduction into modern Java, and I hope it will make your work with Java productive and enjoyable. If you find errors or have suggestions for improvement, please visit http://horstmann.com/javaimpatient, head for the errata page, and leave a comment. On that site, you will also find a link to an archive file containing all code examples from the book.
  • 15. Acknowledgments This content is currently in development.
  • 16. About the Author This content is currently in development.
  • 17. 1. Fundamental Programming Structures In this chapter, you will learn about the basic data types and control structures of the Java language. I assume that you are an experienced programmer in some other language and that you are familiar with concepts such as variables, loops, function calls, and arrays, but perhaps with a different syntax. This chapter will get you up to speed on the Java way. I will also give you some tips on the most useful parts of the Java API for manipulating common data types. The key points of this chapter are: 1. In Java, all methods are declared in a class. You invoke a nonstatic method on an object of the class to which the method belongs. 2. Static methods are not invoked on objects. Program execution starts with the static main method. 3. Java has eight primitive types: four signed integral types, two floating- point types, char, and boolean. 4. The Java operators and control structures are very similar to those of C or JavaScript. 5. There are four forms of switch: expressions and statements with and without fall through. 6. The Math class provides common mathematical functions. 7. String objects are sequences of characters or, more precisely, Unicode code points in the UTF-16 encoding. 8. Use the “text box” syntax to declare multiline string literals. 9. With the System.out object, you can display output in a terminal window. A Scanner tied to System.in lets you read terminal input. 10. Arrays and collections can be used to collect elements of the same type.
  • 18. 1.1. Our First Program When learning any new programming language, it is traditional to start with a program that displays the message “Hello, World!”. That is what we will do in the following sections. 1.1.1. Dissecting the “Hello, World” Program Without further ado, here is the “Hello, World” program in Java. package ch01.sec01; // Our first Java program public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } } Let’s examine this program: Java is an object-oriented language. In your program, you manipulate (mostly) objects by having them do work. Each object that you manipulate belongs to a specific class, and we say that the object is an instance of that class. A class defines what an object’s state can be and and what it can do. In Java, all code is defined inside classes. We will look at objects and classes in detail in Chapter 2. This program is made up of a single class HelloWorld. main is a method, that is, a function declared inside a class. The main method is the first method that is called when the program runs. It is declared as static to indicate that the method does not operate on any objects. (When main gets called, there are only a handful of predefined objects, and none of them are instances of the HelloWorld class.) The method is declared as void to indicate that it does not return any value. See Section 1.8.8 for the meaning of the parameter declaration String[] args. In Java, you can declare many features as public or private, and there are a couple of other visibility levels as well. Here, we declare the
  • 19. HelloWorld class and the main method as public, which is the most common arrangement for classes and methods. A package is a set of related classes. It is a good idea to place each class in a package so you can group related classes together and avoid conflicts when multiple classes have the same name. In this book, we’ll use chapter and section numbers as package names. The full name of our class is ch01.sec01.HelloWorld. Chapter 2 has more to say about packages and package naming conventions. The line starting with // is a comment. All characters between // and the end of the line are ignored by the compiler and are meant for human readers only. Finally, we come to the body of the main method. In our example, it consists of a single line with a command to print a message to System.out, an object representing the “standard output” of the Java program. As you can see, Java is not a scripting language that can be used to quickly dash off a few commands. It is squarely intended as a language for larger programs that benefit from being organized into classes, packages, and modules. (Modules are introduced in Chapter 15.) Java is also quite simple and uniform. Some languages have global variables and functions as well as variables and methods inside classes. In Java, everything is declared inside a class. This uniformity can lead to somewhat verbose code, but it makes it easy to understand the meaning of a program. Note You have just seen a // comment that extends to the end of the line. You can also have multiline comments between /* and */ delimiters, such as /* This is the first sample program in Core Java for the Impatient. The program displays the traditional greeting "Hello, World!". */
  • 20. There is a third comment style, called documentation comment, with /** and */ as delimiters, that you will see in the next chapter. 1.1.2. Compiling and Running a Java Program To compile and run this program, you need to install the Java Development Kit (JDK) and, optionally, an integrated development environment (IDE). You should also download the sample code, which you will find at the companion website for this book, http://horstmann.com/javaimpatient. Since instructions for installing software don’t make for interesting reading, I put them on the companion website as well. Once you have installed the JDK, open a terminal window, change to the directory containing the ch01 directory, and run the commands javac ch01/sec01/HelloWorld.java java ch01.sec01.HelloWorld The familiar greeting will appear in the terminal window (see Figure 1.1). Note that two steps were involved to execute the program. The javac command compiles the Java source code into an intermediate machine- independent representation, called byte codes, and saves them in class files. The java command launches a virtual machine that loads the class files and executes the byte codes. Once compiled, byte codes can run on any Java virtual machine, whether on your desktop computer or on a device in a galaxy far, far away. The promise of “write once, run anywhere” was an important design criterion for Java.
  • 21. Figure 1.1: Running a Java program in a terminal window Note The javac compiler is invoked with the name of a file, with slashes separating the path segments, and an extension .java. The java virtual machine launcher is invoked with the name of a class, with dots separating the package segments, and no extension.
  • 22. Note If your program consists of a single source file, then you can skip the compilation step and run the program with the command java ch01/sec01/HelloWorld.java Behind the scenes, the program is compiled before it runs, but no class files are produced. Note On Unix-like operating systems, you can turn a Java file into an executable program by following these steps: 1. Rename the file so that it doesn’t have extension .java: mv HelloWorld.java hello 2. Make the file executable: chmod +x hello 3. Add a “shebang” line on the top of the file: #!/path/to/jdk/bin/java --source 17 Now you can run the program as ./hello To run the program in an IDE, you need to first make a project, as described in the installation instructions. Then, select the HelloWorld class and tell the IDE to run it. Figure 1.2 shows how this looks in Eclipse. Eclipse is a popular IDE, but there are many other excellent choices. As you get more comfortable with Java programming, you should try out a few and pick one that you like.
  • 23. Figure 1.2: Running a Java program inside the Eclipse IDE Congratulations! You have just followed the time-honored ritual of running the “Hello, World!” program in Java. Now we are ready to examine the basics of the Java language. Tip
  • 24. At http://horstmann.com/javaimpatient, you can download sample code for all chapters of this book that presents the book’s code snippets in context. The code is organized so that you can make a single project that holds all example programs. I encourage you to download, run, and study the code as you follow along with the book content. 1.1.3. Method Calls Let us have a closer look at the single statement of the main method: System.out.println("Hello, World!"); System.out is an object. It is an instance of a class called PrintStream. The PrintStream class has methods println, print, and so on. These methods are called instance methods because they operate on objects, or instances, of the class. To invoke an instance method on an object, you use the dot notation object.methodName(arguments) In this case, there is just one argument, the string "Hello, World!". Let’s try it with another example. Strings such as "Hello, World!" are instances of the String class. The String class has a method length that returns the length of a String object. To call the method, you again use the dot notation: "Hello, World!".length() The length method is invoked on the object "Hello, World!", and it has no arguments. Unlike the println method, the length method returns a result. One way of using that result is to print it: System.out.println("Hello, World!".length()); Give it a try. Make a Java program with this statement and run it to see how long the string is. In Java, you need to construct most objects (unlike the System.out and "Hello, World!" objects, which are already there, ready for you to use).
  • 25. Here is a simple example. An object of the Random class can generate random numbers. You construct a Random object with the new operator: new Random() After the class name is the list of construction arguments, which is empty in this example. You can call a method on the constructed object. The call new Random().nextInt() yields the next integer that the newly constructed random number generator has to offer. If you want to invoke more than one method on an object, store it in a variable (see Section 1.3). Here we print two random numbers: Random generator = new Random(); System.out.println(generator.nextInt()); System.out.println(generator.nextInt()); Note The Random class is declared in the java.util package. To use it in your program, add an import statement, like this: package ch01.sec01; import java.util.Random; public class MethodDemo { ... } We will look at packages and the import statement in more detail in Chapter 2.
  • 26. 1.1.4. JShell In Section 1.1.2, you saw how to compile and run a Java program. The JShell program provides a “read-evaluate-print loop” (REPL) that allows you to experiment with Java code without compiling and running a program. When you type a Java expression, JShell evaluates your input, prints the result, and waits for your next input. To start JShell, simply type jshell in a terminal window (Figure 1.3). Figure 1.3: Running JShell JShell starts with a greeting, followed by a prompt:
  • 27. | Welcome to JShell -- Version 17 | For an introduction type: /help intro jshell> Now type any Java expression, such as "Hello, World!".length() JShell responds with the result and another prompt. $1 ==> 13 jshell> Note that you do not type System.out.println. JShell automatically prints the value of every expression that you enter. The $1 in the output indicates that the result is available in further calculations. For example, if you type 3 * $1 + 3 the response is $2 ==> 42 If you need a variable many times, you can give it a more memorable name. You have to follow the Java syntax and specify both the type and the name (see Section 1.3). For example, jshell> int answer = 42 answer ==> 42 You can have JShell fill in the type for you. Type an expression and instead of hitting the Enter key, hit Shift+Tab and then the V key. For example, when you type new Random() followed by Shift+Tab and the V key, you get
  • 28. jshell> Random = new Random() with the cursor positioned just before the = symbol. Now type a variable name and hit Enter: jshell> Random generator = new Random() generator ==> java.util.Random@3fee9989 Another useful feature is tab completion. Type generator. followed by the Tab key. You get a list of all methods that you can invoke on the generator variable: jshell> generator. doubles( equals( getClass() hashCode() ints( isDeprecated() longs( nextBoolean() nextBytes( nextDouble( nextExponential() nextFloat( nextGaussian( nextInt( nextLong( notify() notifyAll() setSeed( toString() wait( Now type ne and hit the Tab key again. The method name is completed to next, and you get a shorter list: jshell> generator.next nextBoolean() nextBytes( nextDouble( nextExponential() nextFloat( nextGaussian( nextInt( nextLong( Type a D and Tab again, and now the completion nextDouble( is filled in. Hit Tab again, and you see three alternatives: Signatures: double
  • 29. java.util.random.RandomGenerator.nextDouble(double bound) double java.util.random.RandomGenerator.nextDouble(double origin, double bound) double Random.nextDouble() <press tab again to see documentation> Type a ) to select the third version: jshell> generator.nextDouble() $3 ==> 0.9560346568377398 Note In the autocompletion list, methods that may require an argument are only followed by a left parenthesis, such as nextDouble(, but methods without arguments have both parentheses, such as nextBoolean(). To repeat a command, hit the ↑ key until you see the line that you want to reissue or edit. You can move the cursor in the line with the ← and → keys, and add or delete characters. Hit Enter when you are done. For example, hit ↑ and replace Double with Int, then hit Enter: jshell> generator.nextInt() $4 ==> -352355569 By default, JShell imports the following packages: java.io java.math java.net java.nio.file java.util java.util.concurrent java.util.function
  • 30. java.util.prefs java.util.regex java.util.stream That’s why you can use the Random class in JShell without any import statements. If you need to import another class, you can type the import statement at the JShell prompt. Or, more conveniently, you can have JShell search for it, by typing Shift+Tab and the I key. For example, type Duration followed by Shift+Tab and the I key. You get a list of potential actions: jshell> Duration 0: Do nothing 1: import: java.time.Duration 2: import: javafx.util.Duration 3: import: javax.xml.datatype.Duration Choice: Type 1, and you receive a confirmation: Imported: java.time.Duration followed by jshell> Duration so that you can pick up where you left off, but with the import in place. These commands are enough to get you started with JShell. To get help, type /help and Enter. To exit, type /exit and Enter, or simply Ctrl+D. JShell makes it easy and fun to learn about the Java language and library, without having to launch a heavy-duty development environment, and without fussing with public static void main. 1.2. Primitive Types Even though Java is an object-oriented programming language, not all Java values are objects. Instead, some values belong to primitive types. Four of these types are signed integer types, two are floating-point number types, one is the character type char that is used in the encoding for strings, and one is the
  • 31. boolean type for truth values. We will look at these types in the following sections. 1.2.1. Signed Integer Types The signed integer types are for numbers without fractional parts. Negative values are allowed. Java provides the four signed integer types shown in Table 1.1. Table 1.1: Java Signed Integer Types Note The constants Integer.MIN_VALUE and Integer.MAX_VALUE are the smallest and largest int values. The Long, Short, and Byte classes also have MIN_VALUE and MAX_VALUE constants. In most situations, the int type is the most practical. If you want to represent the number of inhabitants of our planet, you’ll need to resort to a long. The byte and short types are mainly intended for specialized applications, such as low-level file handling, or for large arrays when storage space is at a premium. Note
  • 32. If the long type is not sufficient, use the BigInteger class. See Section 1.4.6 for details. In Java, the ranges of the integer types do not depend on the machine on which you will be running your program. After all, Java is designed as a “write once, run anywhere” language. In contrast, the integer types in C and C++ programs depend on the processor for which a program is compiled. You write long integer literals with a suffix L (for example, 4000000000L). There is no syntax for literals of type byte or short. Use the cast notation (see Section 1.4.4), for example, (byte) 127. Hexadecimal literals have a prefix 0x (for example, 0xCAFEBABE). Binary values have a prefix 0b. For example, 0b1001 is 9. Caution Octal numbers have a prefix 0. For example, 011 is 9. This can be confusing, so it seems best to stay away from octal literals and leading zeroes. You can add underscores to number literals, such as 1_000_000 (or 0b1111_0100_0010_0100_0000) to denote one million. The underscores are for human eyes only, the Java compiler simply removes them. Note If you work with integer values that can never be negative and you really need an additional bit, you can, with some care, interpret signed integer values as unsigned. For example, a byte value b represents the range from –128 to 127. If you want a range from 0 to 255, you can still store it in a byte. Due to the nature of binary arithmetic, addition, subtraction, and multiplication will all work, provided they don’t overflow. For other operations, call Byte.toUnsignedInt(b) to get an int value between 0 and 255, then process the integer value, and cast the result back to byte. The Integer and Long classes have methods for unsigned division and remainder.
  • 33. 1.2.2. Floating-Point Types The floating-point types denote numbers with fractional parts. The two floating-point types are shown in Table 1.2. Table 1.2: Floating-Point Types Many years ago, when memory was a scarce resource, four-byte floating-point numbers were in common use. But seven decimal digits don’t go very far, and nowadays, “double precision” numbers are the default. It only makes sense to use float when you need to store a large number of them. Numbers of type float have a suffix F (for example, 3.14F). Floating-point literals without an F suffix (such as 3.14) have type double. You can optionally supply the D suffix (for example, 3.14D). Note You can specify floating-point literals in hexadecimal. For example, 0.0009765625 = 2–10 can be written as 0x1.0p-10. In hexadecimal notation, you use a p, not an e, to denote the exponent. (An e is a hexadecimal digit.) Note that, even though the digits are written in hexadecimal, the exponent (that is, the power of 2) is written in decimal. There are special floating-point values Double.POSITIVE_INFINITY for ∞, Double.NEGATIVE_INFINITY for –∞, and Double.NaN for “not a number.” For example, the result of computing 1.0 / 0.0 is positive
  • 34. infinity. Computing 0.0 / 0.0 or the square root of a negative number yields NaN. Caution All “not a number” values are considered to be distinct from each other. Therefore, you cannot use the test if (x == Double.NaN) to check whether x is a NaN. Instead, call if (Double.isNaN(x)). There are also methods Double.isInfinite to test for ±∞, and Double.isFinite to check that a floating-point number is neither infinite nor a NaN. Floating-point numbers are not suitable for financial calculations in which roundoff errors cannot be tolerated. For example, the command System.out.println(2.0 - 1.7) prints 0.30000000000000004, not 0.3 as you would expect. Such roundoff errors are caused by the fact that floating-point numbers are represented in the binary number system. There is no precise binary representation of the fraction 3/10, just as there is no accurate representation of the fraction 1/3 in the decimal system. If you need precise numerical computations with arbitrary precision and without roundoff errors, use the BigDecimal class, introduced in Section 1.4.6. 1.2.3. The char Type The char type describes “code units” in the UTF-16 character encoding used by Java. The details are rather technical—see Section 1.5. You probably won’t use the char type very much. Occasionally, you may encounter character literals, enclosed in single quotes. For example, ’J’ is a character literal with value 74 (or hexadecimal 4A), the code unit for denoting the Unicode character “U+004A Latin Capital Letter J.” A code unit can be expressed in hexadecimal, with the u prefix. For example, ’u004A’ is the same as ’J’. A more exotic example is ’u263A’, the code unit for , “U+263A White Smiling Face.” The special codes ’n’, ’r’, ’t’, ’b’ denote a line feed, carriage return, tab, and backspace. Use a backslash to escape a single quote ’’’ and a backslash ’’.
  • 35. 1.2.4. The boolean Type The boolean type has two values, false and true. In Java, the boolean type is not a number type. There is no relationship between boolean values and the integers 0 and 1. 1.3. Variables In the following sections, you will learn how to declare and initialize variables and constants. 1.3.1. Variable Declarations Java is a strongly typed language. Each variable can only hold values of a specific type. When you declare a variable, you specify the type, the name, and an optional initial value. For example, int total = 0; You can declare multiple variables of the same type in a single statement: int total = 0, count; // count is an uninitialized integer Most Java programmers prefer to use separate declarations for each variable. Consider this variable declation: Random generator = new Random(); Here, the name of the object’s class occurs twice. The first Random is the type of the variable generator. The second Random is a part of the new expression for constructing an object of that class. To avoid this repetition, you can declare a variable with the var keyword: var generator = new Random(); Then the type of the variable is the type of the expression with which the variable is initialized. In this example, generator is a variable of type Random.
  • 36. In this book, I will use var whenever the type of the declared variable is completely obvious. 1.3.2. Identifiers The name of a variable, method, or class is called an identifier. In Java, an identifier must begin with a letter. It can consist of any letters, digits, and the symbols _ and $. However, the $ symbol is intended for automatically generated identifiers, and you should not use it. Finally, the _ by itself is not a valid identifier. Here, letters and digits can be from any alphabet, not just the Latin alphabet. For example, π and élévation are valid identifiers. Letter case is significant: count and Count are different identifers. You cannot use spaces or symbols in identifiers. Finally, you cannot use keywords such as double. By convention, names of variables and methods start with a lowercase letter, and names of classes start with an uppercase letter. Java programmers like “camel case,” where uppercase letters are used when names consist of multiple words, like countOfInvalidInputs. 1.3.3. Initialization When you declare a variable in a method, you must initialize it before you can use it. For example, the following code results in a compile-time error: int count; count++; // Error—uses an uninitialized variable The compiler must be able to verify that a variable has been initialized before it has been used. For example, the following code is also an error: int count; if (total == 0) { count = 0; } else { count++; // Error—count might not be initialized }
  • 37. You are allowed to declare a variable anywhere within a method. It is considered good style to declare a variable as late as possible, just before you need it for the first time. For example, var in = new Scanner(System.in); // See Section 1.6.1 for reading input System.out.println("How old are you?"); int age = in.nextInt(); The variable is declared at the point at which its initial value is available. 1.3.4. Constants The final keyword denotes a value that cannot be changed once it has been assigned. In other languages, one would call such a value a constant. For example, final int DAYS_PER_WEEK = 7; By convention, uppercase letters are used for names of constants. You can also declare a constant outside a method, using the static keyword: public class Calendar { public static final int DAYS_PER_WEEK = 7; ... } Then the constant can be used in multiple methods. Inside Calendar, you refer to the constant as DAYS_PER_WEEK. To use the constant in another class, prepend the class name: Calendar.DAYS_PER_WEEK. Note The System class declares a constant public static final PrintStream out
  • 38. that you can use anywhere as System.out. This is one of the few examples of a constant that is not written in uppercase. It is legal to defer the initialization of a final variable, provided it is initialized exactly once before it is used for the first time. For example, the following is legal: final int DAYS_IN_FEBRUARY; if (leapYear) { DAYS_IN_FEBRUARY = 29; } else { DAYS_IN_FEBRUARY = 28; } That is the reason for calling them “final” variables. Once a value has been assigned, it is final and can never be changed. Note Sometimes, you need a set of related constants, such as public static final int MONDAY = 0; public static final int TUESDAY = 1; ... In this case, you can define an enumeration like this: enum Weekday { MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY }; Then, Weekday is a type with values Weekday.MONDAY and so on. Here is how you declare and initialize a Weekday variable: Weekday startDay = Weekday.MONDAY; We will discuss enumerations in Chapter 4.
  • 39. 1.4. Arithmetic Operations Java uses the familiar operators of any C-based language (see Table 1.3). We will review them in the following sections. Table 1.3: Java Operators Note In this table, operators are listed by decreasing precedence. For example, since + has a higher precedence than <<, the value of 3 + 4 << 5 is (3
  • 40. + 4) << 5. An operator is left-associative when it is grouped left to right. For example, 3 - 4 - 5 means (3 - 4) - 5. But -= is right- associative, and i -= j -= k means i -= (j -= k). 1.4.1. Assignment The last row in Table 1.3 shows the assignment operators. The statement x = expression; sets x to the value of the right-hand side, replacing the previous value. Assignment is an operator with a value, namely the value that is being assigned. It is legal to nest an assignment in another expression. For example, (next = in.read()) != -1 sets next to the value that is returned by in.read(), and then evaluates to true if that value is not -1. When = is preceded by an operator, the operator combines the left- and right- hand sides and the result is assigned. For example, amount -= fee; is the same as amount = amount - fee; 1.4.2. Basic Arithmetic Addition, subtraction, multiplication, and division are denoted by + - * /. For example, 2 * n + 1 means to multiply 2 and n and add 1. You need to be careful with the / operator. If both operands are integer types, it denotes integer division, discarding the remainder. For example, 17 / 5 is 3, whereas 17.0 / 5 is 3.4. An integer division by zero gives rise to an exception which, if not caught, will terminate your program. (See Chapter 5 for more information on exception
  • 41. handling.) A floating-point division by zero yields an infinite value or NaN (see Section 1.2.2), without causing an exception. The % operator yields the remainder. For example, 17 % 5 is 2, the amount that remains from 17 after subtracting 15 (the largest integer multiple of 5 that “fits” into 17). If the remainder of a % b is zero, then a is an integer multiple of b. A common use is to test whether an integer is even. The expression n % 2 is 0 if n is even. What if n is odd? Then n % 2 is 1 if n is positive or -1 if n is negative. That handling of negative numbers is unfortunate in practice. Always be careful using % with potentially negative operands. Consider this problem. You compute the position of the hour hand of a clock. An adjustment is applied, and you want to normalize to a number between 0 and 11. That is easy: (position + adjustment) % 12. But what if adjustment makes the position negative? Then you might get a negative number. So you have to introduce a branch, or use ((position + adjustment) % 12 + 12) % 12. Either way, it is a hassle. Tip In this case, it is easier to use the Math.floorMod method: Math.floorMod(position + adjustment, 12) always yields a value between 0 and 11. Sadly, floorMod gives negative results for negative divisors, but that situation doesn’t often occur in practice. Java has increment and decrement operators: n++; // Adds one to n n--; // Subtracts one from n As in other C-based languages, there is also a prefix form of these operators. Both n++ and ++n increment the variable n, but they have different values when they are used inside an expression. The first form yields the value before the increment, and the second the value after the increment. For example, String arg = args[n++];
  • 42. sets arg to args[n], and then increments n. This made sense thirty years ago when compilers didn’t do a good job optimizing code. Nowadays, there is no performance drawback in using two separate statements, and many programmers find the explicit form easier to read. 1.4.3. Mathematical Methods There is no operator for raising numbers to a power. Instead, call the Math.pow method: Math.pow(x, y) yields xy. To compute the square root of x, call Math.sqrt(x). These are static methods that don’t operate on objects. Like with static constants, you prepend the name of the class in which they are declared. Also useful are Math.min and Math.max for computing the minimum and maximum of two values. In addition, the Math class provides trigonometric and logarithmic functions as well as the constants Math.PI and Math.E. Note The Math class provides several methods to make integer arithmetic safer. The mathematical operators quietly return wrong results when a computation overflows. For example, one billion times three (1000000000 * 3) evaluates to -1294967296 because the largest int value is just over two billion. If you call Math.multiplyExact(1000000000, 3) instead, an exception is generated. You can catch that exception or let the program terminate rather than quietly continue with a wrong result. There are also methods addExact, subtractExact, incrementExact, decrementExact, negateExact, all with int and long parameters. A few mathematical methods are in other classes. For example, there are methods compareUnsigned, divideUnsigned, and remainderUnsigned in the Integer and Long classes to work with unsigned values.
  • 43. 1.4.4. Number Type Conversions When an operator combines operands of different number types, the numbers are automatically converted to a common type before they are combined. Conversion occurs in this order: 1. If either of the operands is of type double, the other one is converted to double. 2. If either of the operands is of type float, the other one is converted to float. 3. If either of the operands is of type long, the other one is converted to long. 4. Otherwise, both operands are converted to int. For example, if you compute 3.14 + 42, the second operand is converted from an int to the double value 42.0, and then the sum is computed, yielding the double value 45.14. If you compute ’J’ + 1, the char value ’J’ is converted to the int value 74, and the result is the int value 75. Read on to find out how to convert that value back to a char. When you assign a value of a numeric type to a variable, or pass it as an argument to a method, and the types don’t match, the value must be converted. For example, in the assignment double x = 42; the value 42 is automatically converted from int to double. In Java, conversions always exist if there is no loss of information: From byte to short, int, long, or double From short and char to int, long, or double From int to long or double All integer types can be converted to floating-point types. Caution
  • 44. The following conversions may lose information: From int to float From long to float or double For example, consider the assignment float f = 123456789; Because a float only has about seven significant digits, f is actually 1.23456792E8. To make a conversion that is not among these automatic ones, use a cast operator: the name of the target type in parentheses. For example, double x = 3.75; int n = (int) x; In this case, the fractional part is discarded, and n is set to 3. If you want to round to the nearest integer instead, use the Math.round method. That method returns a long. If you know the answer fits into an int, call int n = (int) Math.round(x); In our example, where x is 3.75, n is set to 4. To convert an integer type to another one with fewer bytes, also use a cast: int n = 1; char next = (char)(’J’ + n); // Converts 75 to ’K’ In such a cast, only the last bytes are retained. int n = (int) 3000000000L; // Sets n to -1294967296 Note If you worry that a cast can silently throw away important parts of a number, use the Math.toIntExact method instead. When it cannot
  • 45. convert a long to an int, an exception occurs. 1.4.5. Relational and Logical Operators The == and != operators test for equality. For example, n != 0 is true when n is not zero. There are also the usual < (less than), > (greater than), <= (less than or equal), and >= (greater than or equal) operators. You can combine expressions of type boolean with the && (and), || (or), and ! (not) operators. For example, 0 <= n && n < length is true if n lies between zero (inclusive) and length (exclusive). If the first condition is false, the second condition is not evaluated. This “short circuit” evaluation is useful when the second condition could cause an error. Consider the condition n != 0 && s + (100 - s) / n < 50 If n is zero, then the second condition, which contains a division by n, is never evaluated, and no error occurs. Short circuit evaluation is also used for “or” operations, but then the evaluation stops as soon as an operand is true. For example, the computation of n == 0 || s + (100 - s) / n >= 50 yields true if n is zero, again without evaluating the second condition. Finally, the conditional operator takes three operands: a condition and two values. The result is the first of the values if the condition is true, the second otherwise. For example, time < 12 ? "am" : "pm" yields the string "am" if time < 12 and the string "pm" otherwise. Note
  • 46. There are bitwise operators & (and), | (or), and ^ (xor) that are related to the logical operators. They operate on the bit patterns of integers. For example, since 0xF has binary digits 0...01111, n & 0xF yields the lowest four bits in n, n = n | 0xF sets the lowest four bits to 1, and n = n ^ 0xF flips them. The analog to the ! operator is ~, which flips all bits of its operand: ~0xF is 1...10000. There are also operators which shift a bit pattern to left or right. For example, 0xF << 2 has binary digits 0...0111100. There are two right shift operators: >> extends the sign bit into the top bits, and >>> fills the top bits with zero. If you do bit-fiddling in your programs, you know what that means. If not, you won’t need these operators. Caution The right-hand side operand of the shift operators is reduced modulo 32 if the left hand side is an int, or modulo 64 if the left hand side is a long. For example, the value of 1 << 35 is the same as 1 << 3 or 8. Tip The & (and) and | (or) operators, when applied to boolean values, force evaluation of both operands before combining the results. This usage is very uncommon. Provided that the right hand side doesn’t have a side effect, they act just like && and ||, except they are less efficient. If you really need to force evaluation of the second operand, assign it to a boolean variable so that the flow of execution is plainly visible. 1.4.6. Big Numbers If the precision of the primitive integer and floating-point types is not sufficient, you can turn to the BigInteger and BigDecimal classes in the java.math package. Objects of these classes represent numbers with an arbitrarily long sequence of digits. The BigInteger class implements arbitrary-precision integer arithmetic, and BigDecimal does the same for
  • 47. floating-point numbers. Of course, computations with big numbers are far slower than with primitive numeric types. The static valueOf method turns a long into a BigInteger: BigInteger n = BigInteger.valueOf(876543210123456789L); You can also construct a BigInteger from a string of digits: var k = new BigInteger("9876543210123456789"); There are predefined constants BigInteger.ZERO, BigInteger.ONE, BigInteger.TWO, and BigInteger.TEN. Java does not permit the use of operators with objects, so you must use method calls to work with big numbers. BigInteger r = BigInteger.valueOf(5).multiply(n.add(k)); // r = 5 * (n + k) In Section 1.2.2, you saw that the result of the floating-point subtraction 2.0 - 1.7 is 0.30000000000000004. The BigDecimal class can compute the result accurately. The call BigDecimal.valueOf(n, e) returns a BigDecimal instance with value n × 10–e. The result of BigDecimal.valueOf(2, 0).subtract(BigDecimal.valueOf(17, 1)) is exactly 0.3. 1.5. Strings A string is a sequence of characters. In Java, a string can contain any Unicode characters. For example, the string "Java™" or "Javau2122" consists of the five characters J, a, v, a, and ™. The last character is “U+2122 Trade Mark Sign.”
  • 48. 1.5.1. Concatenation Use the + operator to concatenate two strings. For example, String location = "Java"; String greeting = "Hello " + location; sets greeting to the string "Hello Java". (Note the space at the end of the first operand.) When you concatenate a string with another value, that value is converted to a string. int age = 42; String output = age + " years"; Now output is "42 years". Caution If you mix concatenation and addition, then you may get unexpected results. For example, "Next year, you will be " + age + 1 // Error first concatenates age and then 1. The result is "Next year, you will be 421". In such cases, use parentheses: "Next year, you will be " + (age + 1) // OK To combine several strings, separated with a delimiter, use the join method: String names = String.join(", ", "Peter", "Paul", "Mary"); // Sets names to "Peter, Paul, Mary" The first argument is the separator string, followed by the strings you want to join. There can be any number of them, or you can supply an array of strings.
  • 49. (Arrays are covered in Section 1.8.) It is somewhat inefficient to concatenate a large number of strings if all you need is the final result. In that case, use a StringBuilder instead: var builder = new StringBuilder(); while (more strings) { builder.append(next string); } String result = builder.toString(); 1.5.2. Substrings To take strings apart, use the substring method. For example, String greeting = "Hello, World!"; String location = greeting.substring(7, 12); // Sets location to "World" The first argument of the substring method is the starting position of the substring to extract. Positions start at 0. The second argument is the first position that should not be included in the substring. In our example, position 12 of greeting is the !, which we do not want. It may seem curious to specify an unwanted position, but there is an advantage: the difference 12 - 7 is the length of the substring. Sometimes, you want to extract all substrings from a string that are separated by a delimiter. The split method carries out that task, returning an array of substrings. String names = "Peter, Paul, Mary"; String[] result = names.split(", "); // An array of three strings ["Peter", "Paul", "Mary"] The separator can be any regular expression (see Chapter 9). For example, input.split("s+") splits input at white space. 1.5.3. String Comparison
  • 50. To check whether two strings are equal, use the equals method. For example, location.equals("World") yields true if location is in fact the string "World". Caution Never use the == operator to compare strings. The comparison location == "World" // Don’t do that! returns true only if location and "World" are the same object in memory. In the virtual machine, there is only one instance of each literal string, so "World" == "World" will be true. But if location was computed, for example, as String location = greeting.substring(7, 12); then the result is placed into a separate String object, and the comparison location == "World" will return false! Like any object variable, a String variable can be null, which indicates that the variable does not refer to any object at all, not even an empty string. String middleName = null; To test whether an object is null, you do use the == operator: if (middleName == null) ... Note that null is not the same as an empty string "". An empty string is a string of length zero, whereas null isn’t any string at all. Caution Invoking any method on null causes a “null pointer exception.” Like all exceptions, it terminates your program if you don’t explicitly handle it.
  • 51. Tip When comparing a string against a literal string, it is a good idea to put the literal string first: if ("World".equals(location)) ... This test works correctly even when location is null. To compare two strings without regard to case, use the equalsIgnoreCase method. For example, "world".equalsIgnoreCase(location); returns true if location is "World", "world", "WORLD", and so on. Sometimes, one needs to put strings in order. The compareTo method tells you whether one string comes before another in dictionary order. The call first.compareTo(second) returns a negative integer (not necessarily -1) if first comes before second, a positive integer (not necessarily 1) if first comes after second, and 0 if they are equal. The strings are compared a character at a time, until one of them runs out of characters or a mismatch is found. For example, when comparing "word" and "world", the first three characters match. Since d has a Unicode value that is less than that of l, "word" comes first. The call "word".compareTo("world") returns -8, the difference between the Unicode values of d and l. This comparison can be unintuitive to humans because it depends on the Unicode values of characters. "blue/green" comes before "bluegreen" because / happens to have a lower Unicode value than g. Tip
  • 52. When sorting human-readable strings, use a Collator object that knows about language-specific sorting rules. See Chapter 13 for more information. 1.5.4. Converting Between Numbers and Strings To turn an integer into a string, call the static Integer.toString method: int n = 42; String str = Integer.toString(n); // Sets str to "42" A variant of this method has a second parameter, a radix (between 2 and 36): String str2 = Integer.toString(n, 2); // Sets str2 to "101010" Note An even simpler way of converting an integer to a string is to concatenate with the empty string: "" + n. Some people find this ugly, and it is slightly less efficient. Conversely, to convert a string containing an integer to the number, use the Integer.parseInt method: String str = "101010"; int n = Integer.parseInt(str); // Sets n to 101010 You can also specify a radix: int n2 = Integer.parseInt(str, 2); // Sets n2 to 42 For floating-point numbers, use Double.toString and Double.parseDouble: String str = Double.toString(3.14); // Sets str to "3.14" double x = Double.parseDouble(str); // Sets x to 3.14
  • 53. 1.5.5. The String API As you might expect, the String class has a large number of methods. Some of the more useful ones are shown in Table 1.4. Table 1.4: Useful String Methods
  • 54. Note that in Java, the String class is immutable. That is, none of the String methods modify the string on which they operate. For example, greeting.toUpperCase()
  • 55. Random documents with unrelated content Scribd suggests to you:
  • 56. LETTER V. Sir William Kyngston to Secretary Cromwell, May 16th. 1536, upon the preparations for the execution of my Lord Rochford and Queen Anne. [HARL. MS. 283. fol. 134. Orig.] SIR, Thys day I was with the kyng’s grace and declared the petysyons of my Lord of Rochford, wherin I was answred. Sir, the sayd lord meche desyreth to speke with you, weche towchet hys consyens meche as he sayth, wherin I pray you I may know your plesur, for by cause of my promysse made unto my sayd lord to do the same, and also I shall desyre you further to know the kyngs plesur towchyng the quene, as well for her comfyt as for the preparacion of skefolds and hother necessarys consernyng. The kyng’s grace showed me that my lord of Cantorbury shuld be hyr confessar, and was here thys day with the quene; & not[223] in that mater, sir, the tyme ys short, for the kyng supposeth the gentelmen to dy to morow, and my lord of Rocheford with the reysydew of gentelmen, & as zit with yowt [confession] weche I loke for, bot I have told my lord of Rocheford that he be in aredynes to morow to sulfur execusyon, and so he accepse[224] it very well, and will do his best to be redy, Notwithstandyng he wold have reysayved hys ryghts, weche hathe not bene used and in especiall here. Sir, I shall desyre you at[225] we here may know the kyngs plesur here as shortly as may be, at[225] we here may prepayre for the same weche[226] ys necessary, for the same we here have now may for to do execusyon. Sir, I pray you have gud rymembrance in all thys for hus[227] to do, for we shalbe redy al ways to our knowlage. Zit thys day at dyner the quene sayd at[225] she shuld go to Anvures[228] & ys in hope of lyf, and thus far you well.
  • 58. LETTER VI. Sir William Kingston to Lord Cromwell, apparently May 18th 1536. [MS. COTTON, OTHO C. X. fol. 223.] Syr, Thys shalbe to advertyse you I have resayved your lettr wherin yo[u wolde] have strangerys conveyed yowt of the Towre and so thay be by the [meanis] of Richard Gressum, & Will-m Loke, & Wythepoll, bot the n̄ mbr[229] of stra[ngers past] not XXX. and not mony; Hothe and the inbassitr of the emperor had a [servaunt] ther and honestly put yowt. Sr yf we have not an owre[230] serten [as it may] be knowen in London, I thynke he[re] wilbe bot few and I thynk [a resonable] humbur[231] ware bes: for I suppose she wyll declare hyr self to b[e a good] woman for all men bot for the kyng at the or of hyr de[th. For thys] mornyng she sent for me that I myght be with hyr at [soche tyme] asshe reysayved the gud lord to the in tent I shuld here by[r speke as] towchyng her innosensy alway to be clere. & in the writy[ng of this] she sent for me, and at my commyng she sayd, M. Kyngston, I he[ar saye I shall] not dy affore none, & I am very sory ther fore; for I thowth [than to] be dede [an]d past my payne. I told hyr it shuld be now payne it w[as so sottell. And then she said I] hard say the executr . was very gud, and I have a ly[ttle necke, and put he]r hand abowt it lawyng hartely. I have sen[e mony men &] also wemen executed and at they have bene in gre[te sorrowe, and to my knowle]ge thys lady hathe meche joye and plesur in dethe. [Sir, hyr Amner is conti]newally with hyr, and hasse byne syns ij of the clo[cke after midnight. This is] the effect of hony thyng that ys here at [thys tyme, and thus fare yow] well.
  • 59. Your . . . . . . WILLM̄ KYNG[STON.]
  • 60. LETTER VII. From the Earl of Northumberland, addressed “To his beloved Cosyn Thomas Arundel, one of the Gentlemen of my Lord Legates prevy chambre.” It was written soon after the death of the Earl’s father, in 1527. Referred to at p. 339 of Wolsey’s life. [FROM THE ARCHIVES OF THE DUKE OF NORTHUMBERLAND.] Bedfellow, after my most harte recommendacion: Thys Monday the iijd off August I resevyd by my servaunt, Letters from yow beryng datt the XXth day off July, deliveryd unto hym the sayme day at the kyngs town of Newcastell; wher in I do perseayff my lord Cardenalls pleasour ys to have such boks as was in the Chapell of my lat lord and ffayther (wos soll Jhu pardon). To the accomplyshment of which at your desyer I am confformable, notwithstanding I trust to be able ons to set up a chapel off myne owne. But I pray God he may look better upon me than he doth. But me thynk I have lost very moch, ponderyng yt ys no better regardyd; the occasion wher off he shall persayff. Fyrst, the long lyeng of my tressorer[232], with hys very hasty and unkynd words unto hym, not on my parte deserved. Also the news off Mr. Manyng, the which ys blon obroud over all Yorksher; that neyther by the kyng[233], nor by my lord cardenall am I regardyd; And that he wyll tell me at my metyng with hym, when I come unto Yorksher; which shall be within thys month, God wyllyng: but I ffer[234] my words to Mr Manyng shall displeas my lord; for I will be no ward. Also, bedfellow, the payns I tayk and have taykyn sens my comyng hether, are not better regardyd; but by a fflatteryng Byshope of Carel[235] and that fals Worm[236] shall be broth[237] to the messery
  • 61. and carffulness that I am in; and in such slanders, that now and my lord cardenal wold, he cannot bryng me howth[238] thereof. I shall with all sped send up your lettrs with the books unto my lord’s grace, as to say iiij Anteffonars[239], such as I thynk were not seen a gret wyll; v Gralls; an Ordeorly; a Manuall; viijth Proffessioners, And ffor all the ressidew, they not worth the sending, nor ever was occupyd in my lords chapel. And also I shall wryt at thys time as ye have wylled me. Yff my lord’s grace wyll be so good Lord unto me, as to gyf me lychens[240] to put Wyllm Worme within a castell of myn off Anwyk in assurty, unto the tyme he have accomptyd ffor more money recd . than ever I recd ., I shall gyff hys grace ij Cli . and a benefiss off a C. worth unto hys colleyg, with such other thyngs resserved as his [grace] shall desyre; but unto such tyme as myne Awdytors hayth takyn accompt off him: wher in good bedfellow do your best, ffor els he shall put us to send myselff, as at owr metyng I shall show yow. And also gyff secuer credens unto this berer, whom I assur yow I have ffonddon a marvellous honest man, as ever I ffownd in my lyff. In hast at my monestary of Hul Park the iijd . day of August. In the owne hand off Yours ever assured, H. NORTHUMBERLAND. To my bedfellow Arundel.
  • 62. LETTER VIII. The Earl of Northumberland to Cromwell, denying any contract or promise of marriage between Anne Bullen and himself. [ORIGINAL, COTT. LIB. OTHO c. 10.] Mr Secretary, This shall be to signifie unto you that I perceive by Sir Raynold Carnaby, that there is supposed a precontract between the queen and me; wherupon I was not only heretofore examined upon my oath before the Archbishopps of Canterbury and York, but also received the blessed sacrament upon the same before the Duke of Norfolk, and other the king’s highnes’ council learned in the spiritual law; assuring you Mr Secretary, by the said oath, and blessed body which affore I received, and hereafter intend to receive, that the same may be to my damnation, if ever there were any contracte or promise of marriage between her and me. At Newington Green, the xiijth day of Maye, in the 28th year of the reigne of our soveraigne lord King Henry the VIIIth . Your assured, NORTHUMBERLAND.
  • 63. LETTER IX. Queen Catherine of Arragon and King Henry VIIIth to Cardinal Wolsey, a joint letter, 1527. [MS. COTTON, VITELL. B. XII. fol. 4.] Mr. Ellis has printed this letter in its mutilated condition; I have ventured to supply the lacunæ from the copy in Burnet’s History of the Reformation, vol. i. p. 55. Burnet obtained his transcript when it was in a perfect state, but has unaccountably attributed the first part of the letter to Anne Boleyn. It is however said by Mr. Ellis to be in the hand-writing of Catherine, and cannot but be considered very interesting. My Lord, in my moste humblyst wys that my hart can thinke [I desire you to pardon] me that I am so bold to troubyl yow with my sympyl [& rude wryteng, estemyng] yt to prosed from her that is muche desirus to kno[we that youer grace does well.] I paersave be this berar that you do; the wiche I [praye God long to continewe,] as I am moste bonde to pray, for I do know the g[reate paines and trowbles that] you have taken for me bothe day and nyght [is never like to be recompensyd on] my part, but allonly in loveng you next on to the [kinges grace above all] creatures leveng; and I do not dought but the [dayly proffes of my deades] shall manefestly declaer and aferme my wryte[ng to be trewe, and I do] truste you do thynke the same. My lord, I do assure you I do long to heare from you som newes of the legat, for I do hope and [they come from you they] shall be very good, and I am seur that you deseyre [it as moche as I] and more, and ytt waer possibel as I knowe ytt ys not: And thus remaineing in a stedfast hope I make anend of my letter, [writtyn with the hande] of her that is moste bounde to be——
  • 64. ➔Here Queen Catherine’s part ends, the rest is in the hand-writing of Henry the Eighth. The wrytter of thys letter wolde not cease tyll she had [caused me likewise] to set to my hand desyryng yow thowgh it be short to t[ake it in good part.] I ensure yow ther is nother of us but that grettly desyry[th to see you, and] muche more rejoyse to heare that you have scapyd thys plage [so well, trustyng] the fury thereof to be passyd, specially with them that k[epyth good diett] as I trust you doo. The not heryng of the legates arywall [in Franse causeth] us sumwhat to muse; nottwithstandyng we trust by your dily[gens and vigilancy] (with the assystence of Almyghty God) shortly to be easyd owght [of that trouble.] No more to yow at thys tyme but that I pray God send yow [as good health] and prosperity as the wryters wolde. By your lovyng so[veraign & frende] HENR[Y R.]
  • 65. LETTER X. Anne Boleyn to Cardinal Wolsey. [FIDDES’ COLLECTIONS, p. 256.] My Lord, after my most humble recommendations this shall be to gyve unto your grace as I am most bownd my humble thanks for the gret payn & travelle that your grace doth take in steudyeng by your wysdome and gret dylygens how to bryng to pas honerably the gretyst welth that is possyble to come to any creator lyving, and in especyall remembryng howe wretchyd and unworthy I am in comparyng to his hyghnes. And for you I do know my selfe never to have deservyd by my desertys that you shuld take this gret payn for me, yet dayly of your goodnes I do perceyve by all my frends, and though that I had nott knowlege by them the dayly proffe of your deds doth declare your words and wrytyng toward me to be trewe; nowe good my Lord your dyscressyon may consyder as yet how lytle it is in my power to recompence you but all onely wyth my good wyl, the whiche I assewer you that after this matter is brought to pas you shall fynd me as I am: bownde in the mean tym to owe you my servyse, and then looke what a thyng in thys woreld I can immagen to do you pleasor in, you shall fynd me the gladyst woman in the woreld to do yt, and next unto the kyngs grace of one thyng I make you full promes to be assewryd to have yt and that is my harty love unfaynydly deweryng my lyf, and beying fully determynd with Godds grace never to change thys porpos, I make an end of thys my reude and trewe meanyd letter, praying ower Lord to send you moche increase of honer with long lyfe. Wrytten with the hand of her that besechys your grace to except this letter as prosydyng from one that is most bownde to be Your humble and
  • 67. LETTER XI. Anne Boleyn to Cardinal Wolsey. FROM FIDDES’ COLLECTIONS, p. 255. Collated with the Original in the Cottonian Collection. Brit. Mus. Otho C. X. fol. 218. My Lord, in my most humblyst wyse that my powuer hart can thynke I do thanke your grace for your kind letter, and for youer rych and goodly present, the whyche I shall never be able to desarve wyth owt your gret helpe, of the whyche I have hetherto hade so grete plente that all the dayes of my lyfe I ame moaste bownd of all creators next the kyngs grace to love and serve your grace, of the whyche I besyche you never to dowte that ever I shalle vary frome this thought as long as ony brethe is in my body. And as tochyng your grace’s troble with the swet I thanke ower Lord that them that I desyerd and prayed for ar scapyd, and that is the kyng and you. Not doughthyng bot that God has preservyd you bothe for grete cawsys knowen allonly to his hygh wysdome. And as for the commyng of the legate I desyer that moche; and yf it be Goddis pleasor I pray him to send this matter shortly to a good ende; and then I trust my lord to recompense part of your grete panys, the whych I must requyer you in the meane tyme to excepte my good wyll in the stede of the power, the whyche must prosede partly from you as ower Lourd knoweth to whome I be syche to sende you longe lyfe with continewance in honor. Wrytten wyth the hande of her that is most bound to be Your humble and obedyent servante, ANNE BOLEYN.
  • 69. LETTER XII. Cardinal Wolsey in his Distress to Thomas Cromwell. MS. COTTON. VESP. F. XIII. fol. 76. From Fiddes’ Collections, p. 256. Collated with the Original. Myn owne enterly belovyd Cromwell, I beseche you as ye love me and wyl evyr do any thyng for me, repare hyther thys day as sone as the parlement ys brokyn up, leyng aparte all thyngs for that tyme; for I wold nat onely commynycat thyngs unto yow wherin for my comfort & relief I wold have your good sad, dyscret advyse & counsell, but also opon the same commytt sertyng thyngs requyryng expedicion to yow, on my behalf to be solycytyd: this I pray you therfor, to hast your commyng hyther assafore, with owt omyttyng so to do, as ye tendyr my socor, reliff & comfort, and quyetnes of mynde. And thus fare ye well: from Asher, in hast, thys Satyrday in the mornyng, with the rude hande & sorrowful hert of your assuryd lover T. CARLIS EBOR. I have also serteyn thyngs consernyng yowr sylf wych I am suere ye wolbe glad to here & knowe: fayle not therfore to be here thys nygth, ye may retorne early in the mornyng ageyn yf nede shul so requyre. Et iterum vale. Mr. Augusteyn[241] shewyd me how ye had wryttyn onto me a lettre wherin ye shuld advr tyse of the comyng hyther of the Duke of Norfolke: I assure you ther cam to my hands no suche lettre.
  • 70. LETTER XIII. From Wolsey to Dr. Stephen Gardener, Secretary of State. Communicated to Mr. Grove by Mr. Littleton, afterwards Lord Littleton, who possessed the original. It is now in the Ashmole Museum at Oxford. My owne goode Mastyr Secretary, Goyng this day out of my pue to sey masse, your lettres datyd yesternygth at London wer delyveryd unto me; by the contynue wherof I undyrstand, that the kyng’s hyhnes, of hys excellent goodnes & cheryte ys contentyd, that I shall injoy & have the admynystracion of Yorke merly, with the gyftts of the promocyons spiritual & temporall of the same, reservyd onely onto his nobyll grace the gyft of v or vj of the best promocions. And that hys pleasure ys, I shal leve Wynchester & Saynt Albons. As hereonto Mr. Secretary, I can nat expresse howe moche I am bowndyn to the kyng’s royal majeste for thys hys gret & bowntawse liberalyte, reputyng the same to be moche more then I shal ever be abyl to deserve. Howbeyt yf hys majeste, consyderyng the short & lyttyl tyme that I shal lyve here in thys world, by the reason of such hevynes as I have conceyved in my hert, with the ruinyuose of the olde howsys & the decay of the said archbyshopryck at the best to the sum of viii C Marcke yearly, by the reason of the act passyd for Fynys of Testaments, wth also myn long paynful servys and poore degre; and for the declaration of hys grace’s excellent cheryte, yf hys hyhnes be myndyd I shal leve Wynchester & Saynt Albon’s, wych I supposyd, when I maid my submyssyon, not offendying in my trewth towards hys royal parson, dygnyte, or majeste royal, I should not now have desyrvyd to have left; and much the more knowyng his grace’s excellent propensyon to pyte & mercy, & rememberyng the francke departyng with of all that I had in thys world, that I may
  • 71. have summe convenyent pension reservyd unto me, suche as the kyng’s hyhnes of hys nobyll charite shal thynke mete, so orderyng his that shal succede and my lyvyng, that the same may be of lyck valew yeerly and exstent. Whereat my trust ys, and my herte so gevyth me, that hys majeste wold make no dyffyculte, yf yt may lycke yow friendly to propone the same, assuryng yow that I desyre not thys for any mynde (God ys my judge), that I have to accumulate good, or desyre that I have to the muke of world; for, God be thankyd, at thys ower I set no more by the ryches & promocyons of the world, then by the roshe undyr my fote; but onely for the declaration of the kyng’s favor & hyhe cheryte, & to have wherewith to do good dedys, & to helpe my poore servants and kynnysfolks. And furthermore that yt wold please the kyng’s excellent goodnes by your freindly medyacion, consyderyng how slendyrly I am furnyshyed in my howse, nowe specially that the apparell of Wynchester and Saynt Albons shal be takyn from me, to geve and appoynt unto me a convenyent fernyture for the same, non ad pompam, sed necessariam honestatem. And yf I may have the free gyft and dysposycion of the benefyces, yt shalbe gretly to my comfort. And yet when any of the v or vi pryncypall shal fortune to be voyd, the kyng’s grace being myndyd to have any of them, hys hyhnes shalbe as sure of the same, as though they wer reservyd. And thus by his nobyl & mercyful goodnes delyvered owt of extreme calamite, & restoryd to a newe fredome, I shal, with God’s mercy & help, so ordyr my lyff, that I trust hys majeste shal take special comfort therin, & be pleasyd with the same: Spero quod hoc, quæ peto, non videbitur magna. Howbeyt I most humbly submyt and referre all my petytions, immo ipsam vitam, to his gracyous ordynance & pleasure, praying yow to declare & sygnify the same, supplying myn indysposycion & lacke of wyt, conceyvyd by reason of my extreme sorowe & hevynes, that the same may be to the kyng’s contentacion, wherin I had lever be ded then to offende in word, thowght, or dede, and as towching the grantyng of the fee of one c li. for Mr. Nores duryng hys lyff for hys good servys done unto the kyng’s hyhnes, for the wych I have always lovyd him, and for the singuler good hert and mynde, that I knowe he hath alweys borne
  • 72. unto me, I am content to make out my grawnte upon the same, ye & it wol please the kyng to inlarge it one c. li. more; and semblably cause Mr. Thesauror hath the kepyng of the kyng’s game nygh to Fernam, I wold gladly, if it may stand with the kyng’s pleasure, grawnte unto hym the reversion of such thinges as the Lord Sands hath there, with the ampliacon of the fee above that wych is oldely accustomyd, to the sum of xl. li. by the yeere; & also I wold gladly geve to Mr. Comptroller a lycke fee, & to Mr. Russel, another of xx. li. by the yeere. Remyttyng thys and all other my sutes to the kyng’s hyhnes pleasure, mercy, pity, & compassion, moste holly. Beseechyng hys Hyhnes so nowe gracyously to ordyr me, that I may from hensforth serve God quietly & with repose of mynd, & pray as I am most bowndyn, for the conservacyon & increase of his most nobyll and royal astate. And thus with my dayly prayer I byd yow farewell. From Asher hastely with the rude hand and moste hevy herte of Yowr assuryd frende & bedysman, T. CARLIS EBOR.
  • 73. LETTER XIV. Cardinal Wolsey to Dr. Stephen Gardener. This Letter was also communicated to Mr. Grove by Mr. Littleton. It is now in the Ashmole Museum at Oxford. MY OWNE GOODE MASTYR SECRETARY, Aftyr my moste herty commendacions I pray yow at the reverens of God to helpe, that expedicion be usyd in my persuts, the delay wherof so replenyshyth my herte with hevynes, that I can take no reste; nat for any vayne fere, but onely for the miserable condycion, that I am presently yn, and lyclyhod to contynue yn the same, onles that yow, in whom ys myn assuryd truste, do help & releve me therin; For fyrst, contynuyng here in this mowest & corrupt ayer, beyng enteryd into the passyon of the dropsy. Cum prostatione appetitus et continuo insomnio. I cannat lyve: Wherfor of necessyte I must be removyd to some other dryer ayer and place, where I may have comodyte of physycyans. Secondly, havyng but Yorke, wych is now decayd, by viii C. li. by the yeere, I cannot tell how to lyve, & kepe the poore nombyr of folks wych I nowe have, my howsys ther be in decay, and of evry thyng mete for howssold onprovydyd and furnyshyd. I have non apparell for my howsys ther, nor money to bring me thether, nor to lyve wyth tyl the propysse tyme of the yeere shall come to remove thether. Thes thyngs consyderyd, Mr. Secretary, must nedys make me yn agony and hevynes, myn age therwith & sycknes consyderyd, alas Mr. Secretary, ye with other my lordys shewyd me, that I shuld otherwyse be furnyshyd & seyn unto, ye knowe in your lernyng & consyens, whether I shuld forfet my spiritualties of Wynchester or no. Alas! the qualytes of myn offencys consyderyd, with the gret punishment & losse of goodes that I have sustaynyd, owt to move petyfull hertys; and the moste nobyl kyng, to whom yf yt wold please yow of your cherytable goodnes to shewe
  • 74. the premyses aftyr your accustomable wysdome & dexteryte, yt ys not to be dowbtyd, but his highnes wold have consyderacyon & compassyon, aggmentyng my lyvyng, & appoyntyng such thyngs as shuld be convenient for my furniture, wych to do shalbe to the kyng’s high honor, meryte, & dyscharge of consyens, & to yow gret prayse for the bryngyng of the same to passe for your olde brynger up and lovying frende. Thys kyndnes exibite from the kyng’s hyghnes shal prolong my lyff for some lytyl whyl, thow yt shall nat be long, by the meane whereof hys grace shal take profygtt, & by my deth non. What ys yt to hys hyhnes to give some convenyent porcion owt of Wynchester, & Seynt Albons, hys grace takyng with my herty good wyl the resydew. Remember, good Mr. Secretary, my poore degre, & what servys I have done, and how nowe approchyng to deth, I must begyn the world ageyn. I besech you therfore, movyd with pity and compassyon soker me in thys my calamyte, and to your power wych I knowe ys gret, releve me; and I wyth all myn shal not onely ascrybe thys my relef unto yow, but also praye to God for the increase of your honor, & as my poore shal increase, so I shal not fayle to requyte your kyndnes. Wryttyn hastely at Asher, with the rude and shackyng hand of Your dayly bedysman, And assuryd frend, T. CARLIS EBOR. To the ryght honorable and my assuryd frende Mastyr Secretary.
  • 75. LETTER XV. Cardinal Wolsey to Secretary Gardener, Desiring him to write to him and give him an account of the king’s intentions with regard to him. (From Strype.) Myn own good mastyr secretary, albeit I am in such altiration and indisposition of my hede & body, by the meansse of my dayly sorowe & hevynesse, that I am fen omit to writ any long lr̅ e̅ s. Yet my trustyng frend, Thomas Crowmwel, retornyng & reparyng unto yow, I cowde nat forbere, but brively to put yow in remembrance: how that aftyr the consultation takyn by the kyngs hyghnes opon myn orderyng, which ye supposyd shulde be on Sunday was sevennyght, ye wolde not fayle to advertyse me at the length of the specialties thereof. Of the w̄ ch to here & have knowleg, I have & dayly do looke for. I pray yow therefore at the reverens of God, & of this holy tyme, & as ye love & tendyr my poore lyf, do so moche as to wrytt onto me your seyd lr̅ e̅ s: wherby I may take some cumfort & rest: nat dowting but your hert is so gentyl & pityful, that havyng knowleg in what agony I am yn, ye wole take the payne to send onto me your seyd consollatory lr̅ e̅ s. Wherby ye shal nat onely deserve toward God, but also bynde me to be as I am, your contynual bedysman. Wrytten this mornyng at Asher, with the rude hand and sorroweful hert of yours with hert and prayer. T. Cardinalis Ebor. Miserrimus. To the right honorable Mr. Secretary.
  • 76. LETTER XVI. Cardinal Wolsey to Secretary Gardener. To draw up his pardon. (From Strype.) Myn owne good Mastyr Secretary, Aftyr my moste herty recommendations, with lycke thanks for your goodnes towards me, thes shal be to advertyse yow that I have beyn informyd by my trusty frend Thomas Cromwell that ye have signifyed onto hym to my syngular consolation how that the kynges highnes movyd with pety & compassyon, & of hys excellent goodnes & cheryte consyderyng the lamentable condition & stat that I stand yn, hath wyllyd yow with other lords and mastyrs of hys honorable cownsell, to intende to the perfyghtyng & absolvyng without further tract or delay of myn end & appoyntement; and that my pardon shulde be made in the moste ample forme that my counsell cowde devise. For thys the kyngs moste gracyous remembrance, procedyng of hymself, I accompt my sylf not onely moste bowndyn to serve & pray for the preservation of hys moste royal majestie, but also thancke God that ye have occasion given onto you to be a sollycyter & setter forth of such thynges as do & shall conserve my seyde ende. In the makyng & compowndyng wherof myn assured truste is, that ye wole shewe the love & affection wych ye have & bere towards me, your olde lover & frende: so declaryng your self therin, that the worlde may parceyve that by your good meanys the kyng ys the bettyr goode lorde unto me; & that nowe newly in maner comyng to the world, ther maye be such respect had to my poore degree, olde age & longe contynued servys, as shal be to the kyngs hygh honor & your gret prayse & laude. Wych ondowtydly shall folowe yf ye optinde yowre benyvolens towards me, & men perceive that by your wisdome & dexterite I shalbe relevyd, & in this my calamyte holpen. At the reverens therefore of God myn owne goode
  • 77. Mr. Secretary, & refugy, nowe set to your hande, that I may come to a laudable end & repos, seyng that I may be furnyshyd aftyr such a sorte & maner as I may ende my short tyme & lyff to the honor of Crystes churche & the prince. And besides my dayly prayer & true hert I shal so requyte your kyndnes, as ye shall have cause to thyncke the same to be well imployde, lycke as my seyd trusty frende shall more amply shewe onto you. To whom yt may please yow to geve firme credens and lovyng audyens. And I shall pray for the increase of your honour. Wryttyn at Assher with the tremyllyng hand & hevy hert of your assuryd lover & bedysman T. CARDLIS EBOR. To the ryght honorable and my singular good frende Mayster Secretary.
  • 78. LETTER XVII. Cardinal Wolsey to Secretary Gardener, Desiring him to favour the cause of the Provost of Beverly, and to intercede with the king for him and his colleges. (From Strype.) Myne awne gentil Maister Secretary, After my mooste herty recommendations, these shal be to thanke you for the greate humanite, lovyng & gentil recule, that ye have made unto the poore Provost of Beverly: & specialy, for that ye have in such wise addressed hym unto the kings highnes presence, that his grace not onely hath shewed unto hym, that he is his goode & gracious lorde, but also that it hath pleased hys majeste to admitte & accepte hym as his poore orator & scholer. Wherby both he & I accompte our selfs so bounden unto you, that we cannot telle how to requite this your gratitude & kyndenes; mooste hartely praying you to contynue in your good favour towards hym, & to take hym & his pore causis into your patrocynye & protection. And, as myne assured expectation & trust is, to remember the poor state & condition that I stond in, & to be a meane to the kyngs highness for my relefe in the same. In doyng wherof ye shal not onely deserve thanks of God, but also declare to your perpetual laud and prayse, that ye beyng in auctorite, have not forgoten your olde maister & frynde. And in the wey of charite, & for the love that ye bere to virtue, & ad bona studia, be meane to the kyngs highnes for my poore colleges; and specially for the college of Oxford. Suffer not the things, which by your greate lernyng, studie, counsaile & travaile, hath bene erected, founden, & with good statutes & ordinances, to the honour of God, increase of vertue & lernyng established, to be dissolved or dismembred. Ye do know, no man better, to what use the monasteries, suppressed by the popis licence, the kyngs consente concurryng with the same, & a pardon for the
  • 79. premoneri[242], be converted. It is nat to be doubted, but the kyngs highnes, of his high vertue & equite, beyng informed how every thing is passed, his mooste gracious license & consente (as is aforesaid) adhibited therunto, wol never go aboute to dissolve the said incorporations or bodyes, wherof so greate benefite & commodite shal insue unto his realme & subjects. Superfluities, if any such shal be thought & founden, may be resecat; but to destroy the hole, it were to greate pitie. Eftsones therefore, good Maister Secretaire, I beseche you to be good maister & patrone to the said colleges: “Et non sinas opus manuum tuarum perire, aut ad nihilum redige.” Thus doyng, both I, & they shal not onely pray for you, but in such wise deserve your paynes, as ye shal have cause to thinke the same to be wel bestowed & imployed, like as this present berer shal more at the large shewe unto you. To whom it may please the same to geve firme credence. And thus mooste hartely fare ye wel. From Sothewell, the xxiijth day of July. Your lovyng frende, T. CARLIS EBOR. To the right honorable & my singular good frende Mr Doctor Stephyns, Secretory to the Kings Highnes.
  • 80. LETTER XVIII. Cardinal Wolsey to Secretary Gardener, Desiring his favour in a suit against him for a debt of 700l. by one Strangwish. (From Strype.) Myne awne good Maister Secretary, After my mooste harty recommendations, these shal be to desire, & mooste effectuelly to pray you to be good maister & friende unto me, concernyng the uncharitable sute of Strangwishe for vij C li., which he pretendith that I shulde owe unto hym, for the ward of Bowes. And albeit there was at his fyrste comyng to my service, by our mutual consents, a perfecte end made between hym & me for the same, yet nowe digressyng therfrom, perceyvyng that I am out of favour, destitute of socour, & in calamite, he not onely newly demaundyth the said vij C li. but also hath made complaint unto the kyngs highnes, surmittyng, that I shulde, contrary to justice, deteyne from hym the said vij C li. For the redresse whereof, it hath pleased the kyngs majeste to direct his mooste honorable letters unto me; the contents wherof I am sure be nat unknown unto you. And insuing the purporte therof, & afore the delyvere of the same thre days by past, notwithstanding my greate necessite & poverte, onely to be out of his exclamation & inquietnes, I have written to my trusty friende, Mr Cromwel, to make certeyn reasonable offres unto hym for that intent and purpose; moost hartely beseching you to helpe, that upon declaration of such things, as upon my part shal be signified unto you by the said Maister Cromwell, some such end, by your friendely dexterite, may bee made betwixt us, as shal accorde with good congruence, & as I may supporte & be hable (myne other debts and charges considered) to bere. In the doyng wherof, ye shall
  • 81. bynde me to be your dayly bedesman, as knoweth God, who alwayes preserve you. From Sothewell, the xxvth day of August. Yours with hert & prayer, T. CARLIS EBOR. To my right entierly welbiloved frende Mr Stephyn Gardener, Secretory to kyngs highnes.
  • 82. LETTER XIX. Lettre de Monsieur de Bellay Evesque de Bayonne à Mr le Grant Maistre. De Londres le xvij Oct. 1529. [MSS. DE BETHUNE BIBLIOTH. DU ROY, V. 8603. f. 113.] Monseigneur, depuis les lettres du Roy & les aultres vostres que je pensoye sur l’heure envoyer, cette depesche a estée retardé jusques à présent, parce qu’il a fallu faire & refaire les lettres que je vous envoyé tout plein de fois, & pour ce aller & venir souvent, tant les Ducs mêmes qu’aultres de ce conseil à Windesore, dont toute à cette heure ils les m’ont envoyées en la forme que verrez par le double d’iceux. Ils me prient le plus fort du monde de faire qu’on ne trouve mauvais si en ces expéditions, & mesmement en ce que touche le principal de la depesche, je ne suis de tout satisfait comme je vouldroye, & aussi eulx mesmes, s’excusans que leur manière de négocier envers leur maistre n’est encore bien dressée, mais pour l’advenir doibvent faire merveilles, & en baillent de si grands asseurances & si bien jurées, que je ne puis me garder de les croire; je n’ay point refreschy mes lettres au Roy, car je ne voy point qu’il y en ait matière. Au demourant, j’ay esté voir le Cardinal en ses ennuis, où j’ay trouvé les plus grand exemple de fortune que on ne scauroit voir, il m’a remonstré son cas en la plus mauvaise rhétorique que je viz jamais, car cueur & parolle luy failloient entièrement; il a bien plouré & prié que le Roy & Madame voulsissent avoir pitié de luy, s’ils avoyent trouvé qu’il leur eust guardé promesse de leur estre bon serviteur autant que son honneur & povoir se y est peu estendre, mais il me à la fin laissé sans me pouvoir dire autre chose qui vallist mieux que son visage, qui est bien descheu de la moitié de juste pris: & vous promets, Monseigneur, que sa fortune est telle que ses ennemis, encore qu’ils soyent Angloys, ne se scauroyent guarder d’en avoir
  • 83. pitié, ce nonobstant ne le laisseront de le poursuivre jusques au bout, & ne voyt de moyen de son salut, aussi ne fais-je sinon qu’il plaise au Roy & à Madame de l’ayder. De légation, de sceau d’auctorité, de crédit il n’en demande point, il est prest de laisser tout jusques à la chemise, & que on le laisse vivre en ung hermitage, ne le tenant ce Roy en sa mal grâce: Je l’ay reconforté au mieulx que j’ay peu, mais je n’y ay sceu faire grant chose: Depuis par un en qui il se fie, il m’a mandé ce qu’il vouldroit qu’on feist pour luy de la plus grand partie, luy voyant qu’il ne touchoit au bien des affaires du Roy qu’on luy accordast la plus raisonnable chose qui demande, c’est que le Roy escripvist à ce Roy qu’il est un grand bruit de par delà qu’il l’ait recullé d’autour de luy, & fort eslongé de la bonne grâce, en sorte qu’on dict qu’il doibve estre destruict, ce que ne pense totalement estre comme on le dict; toutefois pour la bonne fraternité, qu’ils ont ensemble, & si grant communication de tous leurs plus grans affaires, l’a bien voulu prier de y avoir égard, affin qu’il n’en entre souldainement quelque mauvaise fantasie envers ceulx qui ont veu qu’en si grant solemnité & auctorité, il ait servy d’instrument en cette perpétuelle amitié tant renommée par toute la Chrétienté; & que si d’adventure il estoit entré en quelque malcontentement de luy, il veüille ung peu modérer son affection, comme il est bien sûr que luy vouldront conseiller ceulx qui sont autour de sa personne & au maniement de ses plus grandes affaires. Voilà, Monseigneur, la plus raisonable de toutes ses demandes, en laquelle ne me veulx ingérer de dire mon advis, si diray-je bien qu’il n’y a personne ici qui deust prendre à mal telle lettre; & mesment là où ils considéreront, comme de facit ils font, qu’il sont forcés de prendre & tenir plus que jamais votre party, & d’advantage asseureray bien que la plus grant prinse qu’ils ayent peû avoir suz luy du commencement, & qui plus leur a servi à le brouiller envers le Roy, a esté qu’il déclara à ma venuë decza trop ouvertement de vouloir aller à Cambray, car les aultres persuaderent au maistre ce que c’estoient, seulement pour éviter d’estre à l’expédition du mariage, & outre cela vous promets que sans luy les aultres mectoyent ce Roy en ung terrible train de rompre la pratique de paix dont vous escripvis quelque mot en ce temps-la, mais j’en laissay dix
  • 84. fois en la plume, voyant que tout estoit rabillé, je vous les diray estant là, & je suis seur que le trouverez fort estrange: Il me semble, Monsieur, que à tout cela, & plusieurs aultres choses que bien entendez de vous-mesmes, on doibt avoir quelque égard, vous donnerez, s’il vous plaist, advis au Roy & à Madame de tout cecy, affin qu’ils advisent ce qu’il leur plaira en faire, s’ils pensent n’empirer par cela leurs affaires, je croy que voulentiers, outre ce que sera quelque charité, ils vouldront qu’on cognoisse qu’ils ayent retiré ung leur affectionné serviteur, & tenu pour tel par chescun, des portes d’enfer; mais sur tout, Monseigneur, il desire que ce Roy ne connoisse qu’ils en ayent esté requis, & que il les en ay fait requerir en façon du monde, cela l’acheveroit d’affoller; car pour vous dire le vray, & hormis toute affection, je vous asseure que la plus grant prinse que ses ennemis ayent euë sur luy, outre celle du mariage, ce a esté de persuader ce Roy que il avoit tousjours eu en temps de paix et de guerre intelligence secrette à Madame, de laquelle ladite guerre durant il avoit eu des grants presens, qui furent cause que Suffolc estant à Montdidier, il ne le secourut d’argent comme il debvoit, dont avint que il ne prit Paris; mais ils en parlent en l’oreille de ce propos, afin que je n’en soy adverty. Quant auxdits presens, il espère que Madame ne le nuyra où il en sera parlé, de toutes aultres choses il s’en recommande en sa bonne grâce. La fantaisie de ces seigneurs est que luy mort ou ruiné, il deffèrent incontinent icy l’estat de l’Eglise, & prendront tous leurs biens, qu’il seroit ja besoing que je misse en chiffre, car ils le crient en plaine table; je croy qu’ils feront de beaux miracles, si m’a dict vostre grant prophète au visaige bronsé, que ce Roy ne vivre gueres plus que........ au quel, comme vous sçavez, à ce que je voy par ses escriptures, il n’a baillé terme que de la monstre de May. Je ne veulx oublier à vous dire que si le Roy & Madame veullent faire quelque chose pour le Légat, il faudroit se haster, encores ne seront jamais icy ses lettres que il n’ait perdu le sceau, toutefois il ne pense plus à cela, elles serviront pour le demourant, aussi venant icy mon successeur, comme chascun s’attend qu’il viendra dans peu des jours, ils luy donnassent charge d’en parler; le pis de son mal est que Mademoiselle de Boulen a faict promettre à son amy que il ne
  • 85. Welcome to our website – the perfect destination for book lovers and knowledge seekers. We believe that every book holds a new world, offering opportunities for learning, discovery, and personal growth. That’s why we are dedicated to bringing you a diverse collection of books, ranging from classic literature and specialized publications to self-development guides and children's books. More than just a book-buying platform, we strive to be a bridge connecting you with timeless cultural and intellectual values. With an elegant, user-friendly interface and a smart search system, you can quickly find the books that best suit your interests. Additionally, our special promotions and home delivery services help you save time and fully enjoy the joy of reading. Join us on a journey of knowledge exploration, passion nurturing, and personal growth every day! ebookbell.com