0% found this document useful (0 votes)
24 views

PDF Reviewing Java Second Edition Alex Maureau download

The document promotes various ebooks available for download on ebookgate.com, including 'Reviewing Java Second Edition' by Alex Maureau, which serves as a comprehensive resource for beginners learning Java programming. It outlines the structure of the book, including chapters on fundamental Java concepts such as variables, operators, and object-oriented programming. Additionally, it provides links to other educational materials and resources related to Java and programming challenges.

Uploaded by

wytykaasim
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

PDF Reviewing Java Second Edition Alex Maureau download

The document promotes various ebooks available for download on ebookgate.com, including 'Reviewing Java Second Edition' by Alex Maureau, which serves as a comprehensive resource for beginners learning Java programming. It outlines the structure of the book, including chapters on fundamental Java concepts such as variables, operators, and object-oriented programming. Additionally, it provides links to other educational materials and resources related to Java and programming challenges.

Uploaded by

wytykaasim
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 76

Get the full ebook with Bonus Features for a Better Reading Experience on ebookgate.

com

Reviewing Java Second Edition Alex Maureau

https://ebookgate.com/product/reviewing-java-second-edition-
alex-maureau/

OR CLICK HERE

DOWLOAD NOW

Download more ebook instantly today at https://ebookgate.com


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

Corporations and contract law Second Edition. Edition Alex


Wan

https://ebookgate.com/product/corporations-and-contract-law-second-
edition-edition-alex-wan/

ebookgate.com

Polaris The second book in the Alex Benedict series First


Edition Jack Mcdevitt

https://ebookgate.com/product/polaris-the-second-book-in-the-alex-
benedict-series-first-edition-jack-mcdevitt/

ebookgate.com

Building Java Programs A Back to Basics Approach Second


Edition Stuart Reges

https://ebookgate.com/product/building-java-programs-a-back-to-basics-
approach-second-edition-stuart-reges/

ebookgate.com

Schaum s Outline sof Data Structures with Java Second


Edition John Hubbard

https://ebookgate.com/product/schaum-s-outline-sof-data-structures-
with-java-second-edition-john-hubbard/

ebookgate.com
Introduction to Neural Networks with Java 1 st Edition
Second printing Heaton Jeff.

https://ebookgate.com/product/introduction-to-neural-networks-with-
java-1-st-edition-second-printing-heaton-jeff/

ebookgate.com

Reviewing Qualitative Research in the Social Sciences 1st


Edition Audrey A. Trainor

https://ebookgate.com/product/reviewing-qualitative-research-in-the-
social-sciences-1st-edition-audrey-a-trainor/

ebookgate.com

Reviewing Research Evidence for Nursing Practice


Systematic Reviews 1st Edition Christine Webb

https://ebookgate.com/product/reviewing-research-evidence-for-nursing-
practice-systematic-reviews-1st-edition-christine-webb/

ebookgate.com

Java 2 micro edition Java in small things James White

https://ebookgate.com/product/java-2-micro-edition-java-in-small-
things-james-white/

ebookgate.com

Bait 1st Edition Alex Sanchez

https://ebookgate.com/product/bait-1st-edition-alex-sanchez/

ebookgate.com
REVIEWING JAVA
SECOND EDITION
The Best Resource for Beginners

Alex Maureau
2
Visit:
www.cstutoringcenter.com/problems
for some fun programming challenges in Java.

Also, visit www.cstutoringcenter.com/reviewingjava


to download all the source code for the examples
in each section. When prompted, enter the code
javaCodeLULU (exactly as it appears, as it is case
sensitive). You will then be granted access to
the source files for each chapter’s examples.

Copyright © 2009, 2011, 2013, 2019 by Alex Maureau.


Edited by Dani Maureau.
ISBN: 978-0-557-04355-2

All rights reserved, including the right of reproduction,


in whole or any part.

3
Special Thanks To

Department of Computer Science, CUNY Queens


College
Without them, I would not be where I am today.

Dani Maureau
My beautiful, supportive wife & the English teacher who
helped edit this book. I love you now and forever.

Matthew McClure
Computer Science wizard who initially inspired me to update
my books with his total nerdgasm once he found out I wrote
them.

Anne Smith-Thompson
For making last minute contributions and changes to this
book. And for being a great professor and friend!

Stephanie Gallagher
For giving me the last bit of inspiration I needed to
update this book. And who also gave me this funny exchange:

Her: “I saw him with your book and I was like ‘I know that
guy!’”
Me: “That’s awesome. What a small world!”
Her: “And I thought, ‘Oh, Java? Like Java the Hut!’”
Me: “It’s not Java the Hut!!...but that’s so going in the
book now.”

4
PREFACE

As many students embark on learning Java, some find it a challenge, and others find it
as easy as others find it impossible. I’ve learned that there are many students who are
willing to just give up at the drop of a hat or even after they fail miserably on the first
exam (i.e. the “JOptionPane” exam).

During my own experiences, I realized that there are quite a few students who do not
want to come into my office and ask me questions. To this day I still do not know why.
Perhaps it is the stigma of the tutor or aide; too nerdy or “geeky” for some, or not
important enough to others. I was once the latter, but quickly snapped out of it once I
embarked on my computer science career.

This material is written to give hope to those lost students who have to take a
programming class as it is mandated by their degree requirements, or those students
who are anxious to learn a new subject. I hope you find this information helpful and
understandable, so that you have a pleasant experience with Java programming. The
material contained herein is a summary of the major topics of Java.

5
TABLE OF CONTENTS

Material

CHAPTER 1
An Introduction to Java ……………………....……………………………… 9

CHAPTER 2
Variables & Operators .…………………….…………………………….. 16

CHAPTER 3
Wrapper Classes & Parsing ..……………………………………………. 39

CHAPTER 4
Input/Output Techniques .…….…………………………………………. 49

CHAPTER 5
Decisions & Logic ………..…….……………………………………….... 59

CHAPTER 6
Strings in Java ………...……..…………………………………………... 88

CHAPTER 7
Looping ………..……….…….…………………………………………... 114

CHAPTER 8
Methods ………..……….…….………………………………………….. 143

CHAPTER 9
Recursion ...………………….…………………………………………… 175

CHAPTER 10
Arrays ..…………………….…………………………………………..... 196

CHAPTER 11
Some Useful Libraries .….……………………………………………..… 249

6
CHAPTER 12
Some Sorting Techniques …….……………………………………...….. 278

CHAPTER 13
Working with Classes & Objects ……………………………………..…. 288

CHAPTER 14
Inheritance ...…………………………………………………………….. 309

CHAPTER 15
Exceptions ………...……………………………………………………… 338

CHAPTER 16
File Input/Output ………..……………….……………………………… 351

CHAPTER 17
Abstract Classes & Interfaces .…………………………………………… 369

CHAPTER 18
Threading & Multitasking ...…………………………………………….. 395

CHAPTER 19
Introduction to Generics, Collections, & Enums ………………………… 408

CHAPTER 20
Data Structures & the java.util Library ...………………………………... 430

CHAPTER 21
Dealing with Dates & Times ...………………………………………….. 482

Appendices

APPENDIX A
ASCII Chart ……………………………………………………………… 521

APPENDIX B
Number Conversions ………………………………………………….…. 522

7
APPENDIX C
The Game of Keno ……………..………………………………………… 535

APPENDIX D
Programming Challenges…………………………………………………. 565

APPENDIX E
Jeopardy! Fun! How Much Can You Win on the Game of Jeopardy! …… 575

8
CHAPTER 1
An Introduction to Java

This chapter covers a basic introduction to the Java language,


including the standard “Hello World” program.

TOPICS

1. Console Input/Output 10
2. Hello World Program 11
3. Command Line Arguments 12
4. Documentation & Javadoc 14
5. Terminating Programs 15

9
Java is a high level programming language that is strictly object-oriented. That means
there is nothing but objects and classes that make up the language. So what parts are
there to a class?

Constructor
A constructor will build the class. A class or object does not exist
until you construct it. All classes are instantiated with the word
new.

Instance variables (see Chapter 2)


There are data variables that are part of each instance of a class.
These can be integers, Strings, characters, etc… or any other Object.

Methods (see Chapter 8)


These are the most essential part of a class, since these do work on a
variable, Object, etc…

Much more on the above will be seen as this book progresses.

All Java programs, AT THE BARE MINIMUM, will look like this:

public class Name{


public static void main(String args[]){
//code here for program
}
}

Where in the above, Name is the useful name of the object (class) for the start of the
program; and the main method always looks like that. The argument of the main
method is an array of Strings that represent command line arguments.

A lot has happened here in just a short time. Each part will become clearer as each
chapter unfolds.

CONSOLE INPUT/OUTPUT

All basic input and output streams are contained in the System library. Below is a
description of some methods contained in that library:

10
System.out.print( things to print )
This will simply print something to the console. It can print a
variable, String, character, double, Object, etc… When attempting to
print something, it will look for a toString method that will handle
the conversion needed. This method does not print a new line character
at the end.

System.out.println( things to print )


This will function the same as the above print, but it now will print
the new line character at the end; hence the “ln” contained in the
method name.

For console input, please see Scanners in Chapter 4.

“HELLO WORLD” PROGRAM

Let’s create the most basic program. The program is collectively called the “Hello
World” program, which will simply print a message to the console.

public class Hello{


public static void main(String args[]){
System.out.println("Hello World!");
}
}

As stated, the above program will print the message to the console.

COMPILING JAVA PROGRAMS

To compile a Java program, you need to use the built in compiler for the command line
called javac. That stands for “java compiler.” The general format for compiling a
program is:

javac FileName.java

where FileName is the name of the java file to compile. To compile multiple Java
programs all at once, you may do this:

11
javac *.java

where the * will compile all filenames with the java extension. So using the above
example of “Hello World,” here is how to compile it:

javac Hello.java

COMMAND LINE ARGUMENTS

A Java program can contain what’s called a command line argument. When compiling
a program, you can give certain values to the main method’s array of arguments.

EXAMPLE 1: Command Line Arguments

Let’s see an example that will allow you to enter your first and last name in the
command line.

public class Example1{


public static void main(String args[]){
if(args.length != 2){
System.out.println("First + Last name needed");
System.exit(1);
}
System.out.println("Hello " + args[0] + " "
+ args[1]);
}
}

The above program will execute first by checking the number of command line
arguments (more details emerge on this aspect later in Chapter 10). It will then print
out the name entered by the user, since we know the arguments are correct. The user’s
first name is contained in args[0] and the last name is contained in args[1]. More on
Strings and arrays will follow later.

Take note that in the above the + operator is used to join (or concatenate) Strings.

12
Here is the command line for compiling and executing. To compile the program:

javac Example1.java

To run the program, simply replace the message in the quotes with your first and last
name, respectively, WITHOUT THE BRACKETS:

java Example1 [your first name] [your last name]

Also note that the arguments are separated by a space. This allows the array to note the
separate arguments. Say that we ran the program above with the following command
line:

java Example1 Alex

We will get an error message and the output would be:

First + Last name needed

We get the error message because the program did not contain the proper number of
command line arguments. Now if we ran the program with this command line:

java Example1 Alex Maureau

We get the output:

Hello Alex Maureau

Please see Chapter 3 (Wrapper Classes & Parsing) for more on command line
arguments and their use.

13
DOCUMENTATION & JAVADOC

An important part of programming is documentation. Without it, you can run into a lot
of trouble when trying to debug a program. There are three types of documentation for
a program in Java; in-line comments, block comments and Javadoc comments.

The first type of comment is an in-line comment that may look like this:

public static void main(String args[]){


//check for arguments here
}

The in-line comment is denoted by the two forward slashes. Anything appearing on
that line past those two markers is ignored by the compiler.

The second type of comment is the block comment that may look like this in a code
snippet:

public static void main(String args[]){


/*
*check for arguments here
*/
}

Note that to START the block comment, there is the /* while to END the block
comment, there is the */. They are different from each other so be careful.

The final piece of commenting is Javadoc. The Javadoc comments are written thusly:

/**
* Javadoc writing here. The Javadoc will explain
* and document a method.
*/
public static void main(String args[]){
//code here for main
}

14
One important note is to realize that there is a /** to begin the Javadoc and the */ to
finish it. If you are using a fancy schmancy environment such as Eclipse, it will turn
blue to signify Javadoc. A block comment and in-line comment will turn green.

A good view of Javadoc is to take a look at the current Java APIs online at
https://docs.oracle.com/en/java/

TERMINATING PROGRAMS

To terminate a program earlier than it should be, you can use the exit() method in the
System library. The syntax will be as follows:

System.exit(1);

You can of course replace the number 1 with any integer of your choosing. Mostly, 0
and 1 are used. One is used to denote a problem and signal to a debugger that there is
an early termination. Zero is used to state that there are no issues. Again, it is not a
requirement to just use 0 and 1, but rather the most commonly-used integers for this
purpose.

15
CHAPTER 2
Variables & Operators

This chapter discovers what variables are and how we can work
with them in a program. Variables are essential to programming.
This chapter covers the many different data types of variables and
how we can operate on them.

TOPICS

1. Declaring Variables 17
2. Data Types 17
3. Variable Exercises 19
4. Operators 19
5. Operator Exercises 27
6. Example Programs 28
7. Types of Variables 31
8. Type Casting 34
9. Overflow 35
10.Overflow Exercises 37

16
In Java, a variable will be used to hold some form of data. That data can be of any type,
such as an integer, decimal or character, or a custom data type (we will explore that
later in the book), just to name a few.

While variables hold some form of data, we want to be able to work with them in a
program, or “operate” on them as it’s called. By operating on variables, you can assign
information/data to them, modify data, perform mathematical operations, perform
logical operations -- basically anything you need to do run your program.

DECLARING VARIABLES

There are numerous ways to use and declare variables in Java. Here is one of the ways
to declare a variable:

[identifier] type var_name;

Where in the above, identifier can be public, private, protected or nothing (see later); type
is the data type of the variable and var_name is a useful name of the variable.

You can also declare a variable and assign a value to it. This is called initializing the
variable.

[identifier] type var_name = initial_value;

Where in the above, identifier can be public, private, protected or nothing (see later); type
is the data type of the variable; var_name is a useful name of the variable; and
initial_value is the default value given to a variable.

DATA TYPES

While we now know how to declare a variable, we need to know both the different data
types, as well as how to operate on them. The below chart consists of the primitive data
types used in Java (note: String is not primitive, but will be used frequently throughout
the book).

17
Type Name Description Size
char Character or small integer. 1 byte
Signed range: -128 to 127
Unsigned range: 0 to 255
short Short Integer. 2 bytes
Signed: -32768 to 32767
Unsigned: 0 to 65535
int Integer. 4 bytes
Signed: -2147483648 to 2147483647
Unsigned: 0 to 4294967295
long Long Integer. 4 bytes
Signed: -2147483648 to 2147483647
Unsigned: 0 to 4294967295
boolean Boolean value. Either true or false. 1 byte
Acceptable as 1 or 0, respectively.
float Floating point number. 4 bytes
3.4e +/- 38 (7 digits)
double Double precision floating point number. 8 bytes
1.7e +/- 308 (15 digits)
String A class dedicated to strings in Java (more on this in
Chapter 6). Note, the S is capitalized and must be in
order for Java to recognize this type.

Let’s show a few examples of declaring variables below with the certain data types:

//declares an integer variable named x


int x;

//declares a double variable named avg


double avg;

//declares a Boolean variable named truth


boolean truth;

//declares a short variable named sh


short sh;

//declares a String variable named first_name


String first_name;

18
VARIABLE EXERCISES

DIRECTIONS: Answer each question below to the best of your ability. Solutions on page 588.

Problem 1:
Declare each of the following types of variables. Do not initialize, just declare them.

a. A double precision variable called num.


b. A float variable called flt.
c. Two short variables called s1 and s2.
d. Four integer variables called x1, x2, y1 and y2.
e. A long int variable called zzz.
f. Three char variables called AA, BB and CC.
g. Two float variables called F1 and F2.
h. A boolean variable called isPrime.
i. a String variable called last_name;
j. A short variable called shorty.

Problem 2:
Declare and initialize each of the above variables in problem 1. You may choose to
initialize them to any value (in its correct range), as well as any way you wish. They
must match the data type of the variable.

OPERATORS

Now that we know a bit about variables, we can now know how to operate on them.
An operator performs an action on a variable(s). It can assign values (the = operator),
perform arithmetic (+, -, *, /), concatenate String objects (the + operator), as well as many
more things that we will explore.

Below is a collection of operators and the category under which each falls. Examples for
each of these operators will follow the chart.

Operator Type Name Function


= Assignment Assignment Assigns a value to a variable(s)
+ Arithmetic/ Addition Performs the addition of a variable(s).
Concatenation Also can concatenate strings.
- Arithmetic Subtraction Performs the subtraction of a variable(s)

19
* Arithmetic Multiplication Performs the multiplication of a
variable(s)
/ Arithmetic Division Performs the division of a variable(s)
% Arithmetic Modular Performs the modular division of a
Division variable(s)
++ Arithmetic Pre/post Increase the value of a variable by 1
increment
-- Arithmetic Pre/post Decrease the value of a variable by 1
decrement
== Relational Equals Evaluates whether both sides of an
expression have the same truth value.
!= Relational Does not equal Evaluates whether both sides of an
expression do not have the same truth
value.
> Relational Strictly greater One side of an expression must be
than strictly greater than the other side in
order to return an overall value of true.
>= Relational Greater than or One side of an expression can be greater
equal to than or equal to the other side, in order
to return an overall value of true.
< Relational Strictly less One side of an expression must be
than strictly less than the other side in order
to return an overall value of true.
<= Relational Less than or One side of an expression can be less
equal to than or equal to the other to return an
overall value of true.
&& Logical Logical And All elements of an expression must be
true in order to return an overall value
of true.
|| Logical Logical Or One side of an expression must be true
in order to return an overall value of
true.
! Logical Logical Not (or This will invert (or negate) a piece of or
Negate) the entire expression, turning true to
false and false to true.
+= Compound Plus Equals Performs the addition of an expression
Assignment/ or concatenation of String objects and
Compound then assigns that value to the variable.
Concatenation

20
-= Compound Minus Equals Performs the subtraction of an
Assignment expression and then assigns that value
to the variable.
*= Compound Multiply Performs the multiplication of an
Assignment Equals expression and then assigns that value
to the variable.
/= Compound Divide Equals Performs the division of an expression
Assignment and then assigns that value to the
variable.
%/ Compound Mod Equals Performs the modular division of an
Assignment expression and then assigns that value
to the variable.

Assignment Operators

= Assignment
This operator assigns a value to a variable(s).

Such examples can be:

//assigns the value 4 to the declared integer variable x


int x;
x = 4;

//declares a double variable named avg and initializes it to 0.0


double avg = 0.0;

//declares a Boolean variable named truth and assigns true to it


boolean truth = true;

//declare two String variables fname and lname and assign values
String fname, lname;
fname = "Alex";
lname = "Maureau";

This operator also can assign multiple values at once:

//declares two short variables x and y and assigns 5 to both of them


short x, y;

21
x = y = 5;

//declares 3 char variables and assigns the character ‘C’ to all 3


//notice that the only variable that is initialized is c
char a, b, c = 'C';
a = b = c;

Arithmetic Operators

+ Addition
Performs the addition of a variable(s).

- Subtraction
Performs the subtraction of a variable(s).

* Multiplication
Performs the multiplication of a variable(s).

/ Division
Performs the division of a variable(s).

Such examples can be:

//assume the following to begin:


int sum = 0, diff = 0, prod = 0, quotient = 0, x, y;

//finds the sum of the variables named x and y and assigns the value to
//the sum variable
sum = x+y;

//finds the difference of the variables named x and y and assigns the
//value to the diff variable
diff = x-y;

//multiplies the variables named x and y and assigns the value to the
//prod variable
prod = x*y;

//divides two variables named x and y (ASSUMES Y IS NOT ZERO!)and


//assigns the value to the quotient variable
quotient = x/y;

22
There are also times when you may want to perform modular division. This can be
represented as follows:

% Modular Division
The modulo division of two numbers is the remainder when the number on
the left is divided by the number on the right.

Such examples can be:

3 % 5
Evaluates to 3 as 5 goes into 3 ZERO times, with a remainder of 3.

19 % 10
Evaluates to 9 as 10 goes into 19 ONE time, with a remainder of 9.

7 % 3
Evaluates to 1, since 3 goes into 7 TWO times, with a remainder of 1.

15 % 1
Evaluates to 0, since any number MOD 1 is 0 as 1 goes into that number
fully.

12 % 0
This will evaluate to a compiler error, since you cannot divide by 0.

4 % 4
This will evaluate to 0, since any number MOD itself goes into itself
fully with no remainder.

Now an actual code snippet showcasing modular division:

//declares two integer variables a and b


int a, b, mod;

//assign initial values


a = 10;
b = 5;

//perform the modular division (value of mod would be 0 as 10%5 is 0)


mod = a % b;

23
Relational/Equality Operators

== Logical Equals
Both sides of a statement must have the EXACT same value in order to
return an overall value of true.

!= Logical Not Equals


Both sides of a statement must have DIFFERENT values in order to return
an overall value of true.

> Logical Strictly Greater Than


A value on the left hand side of the operator must be strictly greater
than the value on the right hand side of the operator in order to
return an overall value of true.

< Logical Strictly Less Than


A value on the left hand side of the operator must be strictly less
than the value on the right hand side of the operator in order to
return an overall value of true.

>= Logical Greater Than or Equal To


A value on the left hand side of the operator can be greater than or
equal to the value on the right hand side of the operator in order to
return an overall value of true.

<= Logical Less Than or Equal To


A value on the left hand side of the operator can be less than or equal
to the value on the right hand side of the operator in order to return
an overall value of true.

Such examples can be:

(7 == 5)
Evaluates to FALSE as 7 does not equal the value of 5.

((4 + 5) == (5 + 3 + 1)
Evaluates to TRUE, since 9 is equal to 9. This performs the operations
inside the parentheses first and then evaluates the logic.

(5 % 2 == 1)
Evaluates to TRUE, since 5 MOD 2 is 1. This first evaluates the modular
division and then evaluates the logic.

(9 > 12)
Evaluates to FALSE, since 9 is not strictly greater than 12.

24
(9 >= 9)
Evaluates to TRUE, since 9 is greater than or equal to 9.

(12 – 4 <= 7 * 2)
Evaluates to TRUE, since 8 is less than or equal to 14.

(4 != (3 + 1))
Evaluates to FALSE as 4 is, in fact, equal to 4. This performs the
action inside the parentheses first and then evaluates the expression.

((6 – 3 * 2) == (10 % 1))


Evaluates to FALSE, since 0 (value from the left parentheses) does not
equal 1 (value from the right parentheses). Recall that anything MOD 1
will evaluate to 0.

Logical Operators

&& Logical And


ALL elements of the statement must be true in order to return an
overall value of true.

|| Logical Or
One or more elements of the statement must be true in order to return
an overall value of true.

! Logical Not
This will “invert” or “negate” a piece of the expression. In other
words, if a piece of the expression evaluates to true, this will invert
that to false and vice versa.

Some examples can be:

((4 != 3) && (3 != 4))


Evaluates to TRUE, as both sides of the expression evaluate to true.
With the logical && operator, both sides need to have the same truth
value, which in this case, they do.

((4 != 3) || (5 != 5))
Evaluates to TRUE, since one side of the expression evaluates to true.
With the logical || operator, only one side needs to have a truth value
of true in order for the entire statement to be true.

( ((10 – 3) * 4) == 27 || ( (14 * 2) != 18 && 4 < 5))


Evaluates to TRUE as the right side of the expression evaluates to
TRUE, since 28 does not equal 18, and 4 is, in fact, strictly less than

25
5. The logical OR only requires one side of the expression to be true
in order to return the overall value of true.

!(7 == 5)
Evaluates to TRUE as 7 does not equal the value of 5 however, we are
inverting the overall value by use of the ! operator.

Increase/Decrease Operators

++ Pre/Post Increment
Increase the value of a variable by 1. If the ++ comes before the
variable you want to increment, it will increase the value FIRST before
using it. If it comes AFTER the variable, the program uses the current
value of the variable first, THEN increases it.

++k -> Increment, THEN use


k++ -> Use, THEN increment

-- Pre/Post Decrement
Decrease the value of a variable by 1. If the -- comes before the
variable you want to decrement, it will decrease the value FIRST before
using it. If it comes AFTER the variable, the program uses the current
value of the variable first, THEN decreases it.

--k -> Decrement, THEN use


k-- -> Use, THEN decrement

Compound Assignment Operators

+= Plus Equals
Shorthand operator for adding and then assigning a value to a variable.
This can be translated to something similar to the below:

a += 3 MEANS a = a + 3;
x += x MEANS x = x + x;

-= Minus Equals
Shorthand operator for subtracting and then assigning a value to a
variable. This can be translated to something similar to the below:

a -= 3 MEANS a = a - 3;
x -= x MEANS x = x - x;

*= Multiply Equals

26
Shorthand operator for multiplying and then assigning a value to a
variable. This can be translated to something similar to the below:

a *= 3 MEANS a = a * 3;
x *= x MEANS x = x * x;

/= Divide Equals
Shorthand operator for dividing and then assigning a value to a
variable. This can be translated to something similar to the below:

a /= 3 MEANS a = a / 3;
x /= 8 MEANS x = x / 8;

%= Mod Equals
Shorthand operator for performing modular division and then assigning a
value to a variable. This can be translated to something similar to the
below:

a %= 3 MEANS a = a % 3;
x %= 2 MEANS x = x % 2;

Each operator above may have different meanings when dealing with different topics.
For example, the + operator relates to addition, but it can also concatenate strings. More
on those scenarios as the book progresses.

OPERATOR EXERCISES

DIRECTIONS: Answer each question below to the best of your ability. Solutions on page 588.

Problem 1:
Identify each of the following operators and briefly explain what it does:

a. &&
b. ||
c. =
d. +=
e. %
f. ++
g. %=
h. *
i. <
j. >=
k. ==

27
Problem 2:
Given the following examples, answer to the best of your ability:

a. 12 % 3 ___________
b. 4 % 7 ___________
c. 6 % 3 ___________
d. 77 % 10 ___________
e. 100 % 100 ___________
f. 99 % 1 ___________
g. (9 % 9) % 9 ___________
h. (((44% 10) % 10) % 10) ___________

Problem 3:
Given the following snippets, what will be produced as the truth value:

a. (9 <= 16) ___________


b. (12 > 12) ___________
c. !(12 > 12) ___________
d. !(!(4 == 4)) ___________
e. ((55 > 99) || (44 < 99)) ___________
f. (3 != 4 && 3 != 5) ___________
g. !(5 != 5 && 4 <= 5) ___________
h. (!(!(!(!(8 < 8)))) ___________

EXAMPLE PROGRAMS

Below are some examples that show the use of most of the above operators. Each
example is explained in detail following the code. NOTE: Some of these programs will be
modified later in the book when dealing with wrapper classes and objects.

EXAMPLE 1: Arithmetic Showcase

This program will perform addition, subtraction, multiplication, division, and modular
division on two integers.

public class Example1{


public static void main(String args[]){
//declare two variables
int a = 5, b = 4;

28
//addition
System.out.println("The sum is: " + (a+b));

//subtraction
System.out.println("The difference is: " + (a-b));

//multiplication
System.out.println("The product is: " + (a*b));

//division
System.out.println("The quotient is: " + (a/b));

//modular division
System.out.println("The a mod b is: " + (a%b));
} //main
} //class

A sample run of the program will produce the following output:

The sum is: 9


The difference is: 1
The product is: 20
The quotient is: 1
The a mod b is: 1

EXAMPLE 2: Change in Coins

This program will calculate the change needed in the number of quarters, dimes,
nickels and pennies.

public class Example2{


public static void main(String args[]){
int x = 90;

//print message to user


System.out.println("Change for " + x + " cents:");

//quarters, dimes, nickels and cents wanted


int q, d, n, c;

q = x / 25;
x = x % 25;
d = x / 10;

29
x = x % 10;
n = x / 5;
c = x % 5;

System.out.println("Quarters: " + q + "\nDimes: " + d +


"\nNickels: " + n + "\nCents: " + c);
} //main
} //class

Say that the user needs 90 cents in change. The first thing that the program needs to do
is calculate the quarters. Here, 90 divided by 25 is 3. Note that the int DOES NOT
handle decimals and only looks at whole numbers. It then stores 3 into the variable q.

Then, the new value of x is calculated by placing the remainder when 90 is divided by
25. Here, it is 15.

Now, the dimes are calculated by taking 15 (since that is current value of x) and
dividing it by 10 which produces 1 (again, the int ignores the decimals). Now, the new
value of x is 15 mod 10, which is 5.

The program will then calculate the nickels and cents accordingly.

The output from running the above program is:

Change for 90 cents:


Quarters: 3
Dimes: 1
Nickels: 1
Pennies: 0

EXAMPLE 3: Incrementing/Decrementing

This program will show the use of the operators for incrementing and decrementing a
number. This also shows the order of the operators.

public class Example3{


public static void main(String args[]){
int num = 5;

//allows user to enter an integer

30
System.out.println("The number 5:");

//once entered, use the operators


//"post" increment:
System.out.print(num++);

//"pre" increment:
System.out.print(++num);

//"post" decrement:
System.out.print(num--);

//"pre" decrement:
System.out.print(--num);
} //main
} //class

Let’s see why the output is this way. First, the value of the variable num is 5. The first
operator that is used on the variable is the "post" increment operator. This uses the
variable first (for output) THEN increments it. So the output is 5, BUT THE VARIABLE
HOLDS THE VALUE 6.

Next, the variable is "pre" incremented so it is incremented FIRST, THEN outputted.


The output is 7, since it was already incremented. The same applies for the
decrementing.

The output from running the above program is:

The number 5:
5775

TYPES OF VARIABLES

While we have a basic understanding of variables and operators, we need to know that
there are different categories of variables used in this language. Those are local
variables, static variables, and instance variables. But first, we must learn about access
levels.

Access Levels

As we observed earlier in the chapter when declaring a variable:

31
[identifier] type var_name;

Where identifier can be either public, private or protected, or nothing; type is the data
type of the variable; and var_name is a useful name of the variable.

Access levels determine whether or not other classes can see and use a particular
method or variable. There are 4 types of access levels as can be declared:

Public
A class, variable, or method can be declared public, in which case it
is visible to all classes everywhere.

Private
A variable or method can be declared private, but they cannot be
accessed outside the class in which they appear. A class cannot be
declared private.

Default [no access level declared]


A default level of access is declared by not writing any identifier
before a class, variable, or method. The class, variable, or method is
only visible within its package.

Protected
Methods or data members declared as protected are accessible within the
same package or subclasses in a different package.

Local Variables

Local variables are just as they sound; they are only able to be accessed & used within
the method or block of code in which they are declared. For example, see the program
below:

public class Example{


public static void main(String args[]){
int x = 4;
char c = 'C';
System.out.println(x);
}
}

32
The int variable x and the char variable c are local to the main() method in the Example
class. They can not be accessed or used anywhere else in the program. The output from
above will simply be 4, since that is the variable’s initial value.

Instance Variables

A class or object can have its own variables. These are what’s called instance variables.
By its definition, an instance variable is unique to each instance of the object; so in
general, each time a class is constructed, there is another instance of the variable
associated with it.

These variables are declared outside any methods you may have, including main().
These variables are declared either public, private, protected, or with no identifier, as
mentioned earlier. They are global to the class or object in which they appear. Let's see a
small example.

public class Variables{


//declare instance variables
private int x = 6;
public double d = 0.0;
private char c = 'A';

public static void main(String args[]){

//code

}
} //class

Static Variables

Static variables are quite a bit harder to understand. Do not be confused with a static
variable from C++. They are very different.

In Java, a static variable (also called a class variable), is a variable that is given a fixed
block of memory. The static keyword tells the compiler that there is exactly one copy of
this variable in existence, no matter how many times the class has been constructed.

Let's just think of a real world example. Say you own a car. The car will always have
four wheels. If you made a class in Java called Car, a variable called numWheels can be

33
made static, since it will be the same for every car. Similarly with fruit, an orange will
always be an orange color, so a color variable in an Orange class can be static.

Final Variables

In C++, we can declare variables constant if we know their values will not change. In
Java, we do not use the keyword const, but we use the keyword final. Final variables
cannot be changed and are made constant. They can be either instance, static or local
variables or even local to a method.

A common practice is to make the final variable’s name all capital letters. So here is
what something may look like:

public class Car{


static final int WHEELS = 4;

//rest of code below


}

TYPE CASTING

In Java, we can allow a variable to change its current data type by casting it to another
data type. There are two types of casting: implicit and explicit.

Implicit Casting

Implicit casting is when the data type is changed automatically in the program. We do
not need to explicitly tell the program to cast.

Automatic casting
This occurs in the compiler as it tries to compile your program:
int x = 5.667; //automatically changed to 5
float f = 7; //automatically changed to 7.0

“Promotion” casting
This occurs when more space is given to a number (i.e. short to int or int to long):
int I = 6;
long u = I; //promoted here to long.

34
“Demotion” casting
This occurs when less space is given to a number (i.e. int to short):
double d = 8.9;
float f = d; //demoted here from double.

Explicit Casting

Explicit casting is when we need to tell the program to change the type. This is done by
placing the data type in parentheses next to the expression.

Say we wanted to compute the average of some integers, and just wanted to output the
whole number from the average, ignoring the decimal places. Here is a program that
will do this:

public class Example{


public static void main(String args[]){
int a = 5, b = 7, c = 10;
double avg = ((double) a+b+c) / 3.0; //cast here

int ans = (int) avg; //cast here


System.out.println(ans);
}
}

We cast in two places with the above program. First, we cast the sum of the 3 integers
to a double precision value and divide by 3.0. We need to do this, otherwise we get
incorrect division.

We also cast in the final result changing the answer from the double precision value to
an int value. This program will output 7 when run, but note that the real average is
7.333333333333333.

OVERFLOW

In Java, variables can overflow their capacity. For instance, if you were to declare the
following piece of code:

short z = 10000;

z = z + 40000;

35
System.out.println( z );

You would see something like this as the output:

-15536

The reason behind this is that you ran out of room to represent the number in its binary
form. That is a bit technical to discuss here, but just know that if you see a negative
number when it is supposed to be positive, you overflowed the number!!! The solution
is to use a bigger data type.

EXAMPLE 4: Overflowed on Purpose

Here is a program that will purposefully overflow some numbers.

public class Example4{


public static void main(String args[]){
System.out.println( (short)(10000) );
System.out.println( (short)(33000) );
System.out.println( (int)(10000000) );
System.out.println( (int)(123456789) );
System.out.println( (long)(101010101010101010) );
System.out.println( (long)(99999999999999999) );
} //main
} //class

The output from running the above program is:

10000
-32536
10000000
123456789
-714149102
1569325055

NOTE: Depending on the compiler you have, it may not even compile (for instance in
Eclipse). If you use command line Java, it may work out to the output above.

36
The first number will work just fine (being the short(10000)), since that is in range. The
following short(33000) is just a bit out of range, so it will give you the -32536 you see on
screen.

Then, both the int values are still in range, so they will be just fine, however both the
long values are not! It may appear that a long holds more numbers, but certainly not
numbers that big!!!

CASTING EXERCISES

DIRECTIONS: Answer each question below to the best of your ability. Solutions on page 589.

Problem 1:
Observe each type of casting and explain what will be printed on screen with the
println statement:

a.
int x = 99;
short xx = x;
System.out.println( xx );

b.
double c = 55.344;
System.out.println( ((int) c) );

c.
long n = 9999.999;
double nn = n;
System.out.println( nn );

d.
int q = 499;
double x = 2.1;
long qq = q + ((int) x);
System.out.println( qq );

Problem 2:
Identify which of the following values are out of range (or in other words, overflow) for
the following lines of println statements:

a. System.out.println( (int) 4999999 );


b. System.out.println( (short) 32333 );
c. System.out.println( (long) 444444444 );

37
d. System.out.println( (long) 44444444444 );
e. System.out.println( (char) 257 );
f. System.out.println( (double) 999999.9999999 );
g. System.out.println( (float) 43*100+7 );
h. System.out.println( (double) 777*777*10 );
i. System.out.println( (short) -40000 );
j. System.out.println( (int) -99955533322 );

38
CHAPTER 3
Wrapper Classes & Parsing

This chapter covers how to convert Strings to numerical values. It


also covers how to use this concept from the command line. There
are some example programs that showcase the use of many different
types of parsing.

TOPICS

1. Wrapper Classes 40
2. Character Wrapper Class 44
3. Defining Numbers 44

39
Each primitive data type in Java (int, short, long, float, double, char, and boolean) has
its own wrapper class. But what is a wrapper class?

WRAPPER CLASSES

A wrapper class is simply an object version of a primitive data type. It contains


methods or constants that can be useful for a program. Here is a list of the wrapper
classes for the primitive data types:

Integer
Methods for an int data type.

Short
Methods for a short data type.

Long
Methods for a long data type.

Double
Methods for a double data type.

Float
Methods for a float data type.

Character
Methods for a char data type.

Boolean
Methods for a boolean data type.

Each of the above wrapper classes contains a very important method that will parse (or
convert) any String, either a command line argument or a String object, into the
appropriate data type. Those methods are defined below:

Integer.parseInt(String val)
Returns an int value from a String representation of a number. A
NumberFormatException is thrown if the argument is not a String
representation of a number.

Short.parseShort(String val)
Returns a short value from a String representation of a number. A
NumberFormatException is thrown if the argument is not a String
representation of a number.

40
Long.parseLong(String val)
Returns a long value from a String representation of a number. A
NumberFormatException is thrown if the argument is not a String
representation of a number.

Double.parseDouble(String val)
Returns a double precision value from a String representation of a
number. A NumberFormatException is thrown if the argument is not a
String representation of a number.

Float.parseFloat(String val)
Returns a float value from a String representation of a number. A
NumberFormatException is thrown if the argument is not a String
representation of a number.

(Exceptions will be explained further in Chapter 15).

A few examples will show some of the above in play.

EXAMPLE 1: Modified Arithmetic Showcase

This program will perform addition, subtraction, multiplication, division, and modular
division of two integers. This is the modified version of the program from the previous
chapter. This one uses two command line arguments and parses them accordingly to
perform the arithmetic.

public class Example1{


public static void main(String args[]){
int a = 0, b = 0;

//convert (parse) the entered Strings to an int value


//with the use of the Integer wrapper class
a = Integer.parseInt(args[0]);
b = Integer.parseInt(args[1]);

//addition
System.out.println("The sum is: " + (a+b));

//subtraction
System.out.println("The difference is: " + (a-b));

//multiplication
System.out.println("The product is: " + (a*b));

41
//division
System.out.println("The quotient is: " + (a/b));

//modular division
System.out.println("The a mod b is: " + (a%b));

} //main
} //class

The difference between this program and the previous chapter is the fact that you are
now using command line arguments.

A sample run of the program will produce the following output (with command line
arguments 5 4:

The sum is: 9


The difference is: 1
The product is: 20
The quotient is: 1
The a mod b is: 1

EXAMPLE 2: Modified Change in Coins

This program will calculate the change needed in the number of quarters, dimes,
nickels, and pennies. The value is entered from the command line and will be parsed to
an int.

public class Example2{


public static void main(String args[]){
//convert the command line argument here with the use
//of the Integer wrapper class
int x = Integer.parseInt(args[0]);

System.out.println("Change for " + x + " cents:");


int q, d, n, c; //quarters, dimes, nickels and cents wanted

q = x / 25;
x = x % 25;
d = x / 10;
x = x % 10;
n = x / 5;
c = x % 5;

42
System.out.println("Quarters: " + q + "\nDimes: " + d +
"\nNickels: " + n + "\nCents: " + c);
} //main
} //class

Running it off the command line and giving it the command line argument of 90, a
sample run of this program from the above is:

Change for 90 cents:


Quarters: 3
Dimes: 1
Nickels: 1
Pennies: 0

EXAMPLE 3: Finding the Average

This program will take 3 command line arguments and calculate the average of those
values. It makes use of the Double wrapper class to do the calculations as needed.

public class Example3{


public static void main(String args[]){
//the 3 numbers desired
double n1, n2, n3, avg;

//convert each argument entered to a double


//value with the use of the Double wrapper class
n1 = Double.parseDouble(args[0]);
n2 = Double.parseDouble(args[1]);
n3 = Double.parseDouble(args[2]);

//find the average & display result


avg = (n1 + n2 + n3) / 3.0;

System.out.println("The average is: " + avg);


} //main
} //class

The program output with command line arguments 5 10 12 will be:

The average is 9.0

43
CHARACTER WRAPPER CLASS

An important class that contains some useful methods is the character wrapper class.
There are methods that will check if a character is a digit, letter, etc… as well as
uppercase, lowercase, etc…

boolean isDigit(char c)
This method will return true if the character argument is a digit from
0 to 9. Else, it will return false.

boolean isLetter(char c)
This method will return true if the character argument is a letter
from, EITHER UPPERCASE OR LOWERCASE. Else, it will return false.

boolean isUpperCase(char c)
This method will return true if the character argument is an uppercase
letter. Else, it will return false.

boolean isLowerCase(char c)
This method will return true if the character argument is a lowercase
letter. Else, it will return false.

boolean isWhiteSpace(char c)
This method will return true if the character argument is a white space
character. Else, it will return false.

As seen in the program, these methods are utilized to keep track of the different types
of characters in the String argument.

These will be shown in action in Chapter 6, when discussing Strings.

DEFINING NUMBERS

Each respective numeric wrapper class (Short, Integer, Long, Float, and Double), have
methods that return its value as a primitive data type (short, int, long, float, and
double). They are defined below and can be accessed from the respective wrapper class:

short shortValue()
This method will return a short value representing the numeric value of
the object.

44
int intValue()
This method will return an int value representing the numeric value of
the object.

long longValue()
This method will return a long value representing the numeric value of
the object.

float floatValue()
This method will return a float value representing the numeric value of
the object.

double doubleValue()
This method will return a double precision value representing the
numeric value of the object.

So far, we have just used primitive data types for our desired numeric variables.
However, it is perfectly acceptable to do something like this:

Integer num = new Integer("10");


Short num = new Short("100");
Double num = new Double("5.54321");

Etc…

It is also acceptable to do the following (good practice is to be sure the values will not
overflow):

Integer num = 10;


Short num = 100;
Double num = 5.54321;

Etc…

EXAMPLE 4: Defining Numbers

The below program will showcase the numerous value methods as described above.

public class Example4{


public static void main(String args[]){

45
Double n1 = new Double("4.59234");
Integer n2 = 5;

//display results for n1


System.out.println("current value: " + n1);
System.out.println("short value: " + n1.shortValue());
System.out.println("int value: " + n1.intValue());
System.out.println("long value: " + n1.longValue());
System.out.println("float value: " + n1.floatValue());
System.out.println("double value: " + n1.doubleValue());
System.out.println();

//display results for n2


System.out.println("current value: " + n2);
System.out.println("short value: " + n2.shortValue());
System.out.println("int value: " + n2.intValue());
System.out.println("long value: " + n2.longValue());
System.out.println("float value: " + n2.floatValue());
System.out.println("double value: " + n2.doubleValue());
} //main
} //class

The output from running the above program is:

current value: 4.59234


short value: 4
int value: 4
long value: 4
float value: 4.59234
double value: 4.59234

current value: 5
short value: 5
int value: 5
long value: 5
float value: 5.0
double value: 5.0

EXAMPLE 5: More Change in Coins

This program will again calculate the change needed in the number of quarters, dimes,
nickels, and pennies. The value is entered from the command line.

46
public class Example5{
public static void main(String args[]){
//convert the command line argument here
Integer x = new Integer(args[0]);

System.out.println("Change for " + x + " cents:");


int q, d, n, c; //quarters, dimes, nickels and cents wanted

q = x / 25;
x = x % 25;
d = x / 10;
x = x % 10;
n = x / 5;
c = x % 5;

System.out.println("Quarters: " + q + "\nDimes: " + d +


"\nNickels: " + n + "\nCents: " + c);
} //main
} //class

Running it off the command line and giving it the command line argument of 90, a
sample run of this program from the above is:

Change for 90 cents:


Quarters: 3
Dimes: 1
Nickels: 1
Pennies: 0

EXAMPLE 6: Another Way to Find the Average

This program will take 3 command line arguments and calculate the average of those
values. It makes use of the Double wrapper class to do the calculations as needed.

public class Example6{


public static void main(String args[]){
//the 3 numbers desired
Double n1, n2, n3, avg;

//convert each argument entered to a double


//value with the use of the Double wrapper class
n1 = new Double(args[0]);
n2 = new Double(args[1]);

47
n3 = new Double(args[2]);

//find the average


avg = (n1.doubleValue() + n2.doubleValue() +
n3.doubleValue()) / 3.0;

//display result
System.out.println("The average is: " + avg);
} //main
} //class

The program output with command line arguments 5 10 12 will be:

The average is 9.0

The output is the same as example 3 above. This was just another way of writing the
code.

48
CHAPTER 4
Input/Output Techniques

This chapter discusses the different methods of input and output in


Java. We will explore Scanners that handle input from the console
and JOptionPanes that handle both input and output, but in a more
graphical approach.

TOPICS

1. Scanners 50
2. JOptionPanes 55

49
As mentioned in the first chapter, there are some different types of input and output
techniques. There is the console technique using a Scanner object, and the graphical
technique using a JOptionPane. When deciding on which one to use, it will depend on
the type of Operating System you are using, since a JOptionPane will not work on a
UNIX/LINUX environment.

SCANNERS

A Scanner will allow you to input data from the console at some point(s) in a program.
A Scanner is part of the java.util library, so this needs to be imported in order to be
used.

import java.util.Scanner;

To define and use a Scanner in a program, most generally:

Scanner var_name = new Scanner(System.in);

Where in the above, var_name is a useful name for the Scanner object.

The Scanner class has some methods associated with it to gather input from a user:

nextInt()
Reads an int value from the user.

nextShort()
Reads a short value from the user.

nextLong()
Reads a long value from the user.

nextDouble()
Reads a double value from the user.

nextFloat()
Reads a float value from the user.

nextBoolean()
Reads a boolean value from the user.

50
Another Random Scribd Document
with Unrelated Content
“Wait,” he said.
He raised his head to listen. The night was still as a tomb. A cry
even from the most distant corner of the city, it seemed to him,
must carry to this open square of darkness above them. He had
time. “Yes, wait,” he repeated, and he went apart into the shadowy
patio. Never had he been set to face so tragic a dilemma. He knew
Si El Hadj Arrifa too well to doubt him. Nor indeed had he any real
doubt as to the choice which he himself would make. The choice
was in truth made, had been made from the moment he was sure
that torture and massacre threatened those who remained in Fez as
much as those who marched to Rabat. But he stood in that shadowy
court of marble and tiles, gazing with a great sorrow upon many
lovely cherished things which he was now forever to forego, his own
hopes and ambitions, a little circle of good friends, honour and good
report, a career of active service and study well-applied, and at the
end of it all a name cleansed of its stain, and—even now the picture
rose before his mind—a dreamlike high garden fragrant with roses,
from which one looked out over moonlit country to the misty barrier
of the Downs. It was such a farewell as he had never thought to
make and when he turned back into the room his face was twisted
as with a physical pain and anguish lay deep in his brooding eyes.
He took the envelope from his breast.
“I shall trust you with more than my life,” he said.
“Your Excellency has honoured me with his friendship. I am his
servant in all things.”
“I have been for three nights writing this letter. I had it in my
mind to open it here and read it to you. But the bad news you have
given me points to another way. It may be that there will be no need
to use it. I give it into your hands and I beg you to keep it sealed as
it is, until you are certain of my death. If I am alive I shall find a
means to let you know. If I am dead, I pray you to do all that I have
written here.”
Si El Hadj Arrifa took the letter and bowed his forehead upon it,
as though it carried the very Sultan’s seal.
“With God’s will, I will do as you direct.”
Paul took his friend by the hand, and looked him in the eyes.
“I could not rest quiet in my grave if my wishes written there
were not fulfilled—if misfortune struck where there is no need that it
should strike. A voice would call to me, in sorrow and distress, and I
should hear it and stir in my grave though I was buried metres deep
in clay. It is a promise?”
“Yes.”
Si El Hadj Arrifa struck a bell and a man came out to him from
the servants’ quarters.
“All is quiet, Mohammed?”
“Up till this hour.”
“His Excellency’s horse then! You will go in front of him with a
lantern as far as the Bab Segma. His Excellency returns to the camp
at Dar-Debibagh.”
The servant’s eyes opened wide in fear. He looked from his
master to his master’s guest, as though both of them had been
smitten with madness. Then he went out upon his business, and the
two men in the court heard the fall of the bars and the grinding of
the lock of the door.
“I will put this away,” said Si El Hadj Arrifa, balancing the letter in
his hands; and he went upstairs to his own room. When he came
down Paul was standing in the patio, with his cap upon his head.
“I will bid you good-bye here my friend,” said Paul, but his host,
terrified though he was, would not so far fall short of his duties. He
went out with Paul Ravenel to the street. The city all about them
was very quiet. There was no light anywhere but the light in the big
lantern which Mohammed was carrying in one hand whilst he held
the bridle of Paul’s horse with the other. Paul mounted quickly and
without a word. Si El Hadj Arrifa stood in the doorway of his house.
He watched the lantern dwindle to a spark, he heard the sharp loud
crack of the horse’s shoes upon the cobbles soften and grow dull. He
waited until the spark had vanished, and, a little time afterwards, the
beat of the hoofs had ceased. And still there was no sign of any
trouble, no distant clamour as of men gathering, no shrill cries from
the women on the roofs. He went back into his house.

A William Fox Production. The Winding Stair.


PAUL FIRST MEETS MARGUERITE, DANCER IN THE CAFE IRIS.
CHAPTER XII

The Little Door in the Angle

S i El Hadj Arrifa squatted upon his cushions and stared


at the flames of the candles in his branched silver candlestick.
Captain Paul Ravenel would be half way through the Tala now.
It was always in that quarter of the town that turbulence began. He
would be half way through the Tala, therefore half way between this
house and the Bab Segma too. And as yet there was not a cry. Si El
Hadj Arrifa had never known a night so still. But then he had never
listened before with such an intensity of fear, fear for himself, fear
for that friend of his riding through the silent town, with the lantern
swinging close to the ground in front of him. The sky had cleared
after the rain and the stars were bright above the open square of
the roof. But it was dark and once past the Bab Segma and clear of
the town, Paul Ravenel would slip like a swift shadow over the soft
ground to Dar-Debibagh. He must be near the gates by now. Si El
Hadj Arrifa pictured him now skirting the gardens of Bou Djeloud
and very close to the gate; a few yards more, that was all. Si El Hadj
Arrifa imagined him knocking upon the gate for the watchman to
open it. A sense of relief stole over the Moor. Mohammed would be
back very soon now. Upon the relief followed drowsiness. Si El Hadj
Arrifa’s head fell forward upon his breast and his body slipped into
an easier attitude. . . .
Yes, Paul Ravenel was undoubtedly rapping upon the Segma
gate, but rapping rather urgently, rather insistently. How those dogs
of watchmen slept, to be sure! And Si El Hadj Arrifa woke with a
start and very cold. It was upon his own outer door that some one
knocked urgently and insistently.
The Moor rose to his feet and stopped. His eyes had fallen upon
his fine silver candlesticks and he stood upright and stiff in a
paralysis of terror. The candles had burnt low. He had slept there for
a long time. Mohammed should have been back an hour ago. The
sound of his knocking, too, urgent, yet with all its urgency, discreet,
spoke, like a voice of fear. Something untoward then had happened.
Yet the city still slept. Si El Hadj Arrifa was no braver than most of
his fellow townsmen. He shivered suddenly and violently and little
whimpers of panic broke from his lips. Massacres were not
conducted quietly. Uproar and clamour waited upon them; and the
strange and eerie silence brooding over the town daunted the soft
luxurious Moor till his bones seemed to melt within his body. It was
stealthy and sinister like an enemy hidden in the dark. He crept into
the passage and listened. There was nothing to hear but the urgent
scratching and rapping upon the door.
“Is that you, Mohammed?” he asked.
“Yes, Master.”
Si El Hadj Arrifa unfastened the door and held it ajar, looking out.
Mohammed was alone, and there was no longer a lantern in his
hand.
“Come in! And make no noise!” said Si El Hadj Arrifa.
Mohammed slipped into the passage, closed the strong door so
cautiously that not a hinge whined, then locked and bolted and
barred it.
“Now follow me!”
The Moor led the way back to the room with the brass bedstead
and sank like a man tired out on to the cushions. His servant stood
in front of him with a passive mask-like face and eyes which shone
bright with fear in the light of the candles. “Speak low!” said Si El
Hadj Arrifa; and this is the story which Mohammed told in a voice
hardly above a whisper.
The French officer did not ride to the Segma Gate. He called in a
quiet voice to Mohammed and turned off towards the Bab-el-Hadid
on the south of the town.
“The Bab-el-Hadid,” Si El Hadj Arrifa repeated in wonderment.
“But his Excellency did not go as far as the gate. He stopped at
the hospital and dismounted,” said Mohammed.
Si El Hadj Arrifa’s face lightened. The hospital was the
headquarters of the military command. Paul Ravenel had taken his
story there.
Paul had remained for a long time in the hospital. Two officers
came out with him at length, one of whom was dressed in slippers
and pyjamas with a dressing gown thrown on as if he had been
wakened from his bed.
“Was his Excellency smiling?” asked Si El Hadj Arrifa.
“No. The other two were smiling. His Excellency shrugged his
shoulders and mounted his horse heavily like a man in trouble.”
Si El Hadj Arrifa nodded his head and muttered to himself.
“They will not believe,” he said. “No, they will not believe.” He
looked towards Mohammed. “Then he went out by the Bab-el-
Hadid?”
But Paul had not. He had turned his back to the Bab-el-Hadid
and bade Mohammed lead to the Karouein quarter.
They went for a while through silent empty streets, Mohammed
ten paces or so ahead, holding the lantern so that the light shone
upon the ground and Paul Ravenel following upon his horse.
Mohammed did not turn round at all to see that the Captain was
following him, but the shoes of the horse clacked on the cobbles just
behind him and echoed from wall to wall. They came to the first
gate and it was open. The great doors stood back against the wall
and the watchman was not at his post. Mohammed was frightened.
An omission to shut off the quarters of the city one from the other at
night could not be due to negligence. This was an order given by
authority. However, no one stopped them; they saw no one; they
heard no one.
They came to a second gate. This too stood wide. Beyond the
gate the street was built over for a long way making a black tunnel,
and half way down the tunnel it turned sharply at a right angle.
When this corner had been turned, a glimmer of twilight far ahead
would show where the tunnel ceased.
Mohammed passed in under the roof over the street and after he
had walked some twenty paces forward, he judged that Captain
Ravenel had fallen a little behind, the shoes of the horse no longer
rang so clearly on the stones. He turned then, and saw horse and
rider outlined against the dark sky, as they reached the tunnel’s
mouth. He noticed Paul Ravenel bent forward over the neck of his
horse to prevent his head from knocking against the low roof. Then
he entered the tunnel and was at once swallowed up in the
blackness of it.
Mohammed walked forward again rather quickly. For he was
afraid of this uncanny place, and turned the angle of the street
without looking round again. He did not think at all. If he had, he
would have understood that once the feeble flicker of his lantern
were lost beyond the corner, Paul Ravenel would be left in the
darkness of the blind, the mouth of the tunnel behind him, a blank
wall before his face. Mohammed was in a fever to reach the open
street again and now that he saw it in front of him at the end of the
passage opaquely glimmering as an uncurtained window on a dark
night will glimmer to one in a room, he pushed eagerly forward. He
was close to the outlet when he realised that no horse’s hoofs rang
on the cobbles behind him.
He turned and peered back into the tunnel. There was nothing to
be seen and there was no sound. Mohammed did not dare to call
out. He stood wavering between his duty and his fear; and suddenly
a tremendous clatter broke the silence and frightened Mohammed
out of his wits. Mohammed had just time to draw back close against
the wall when a horse dashed past him at a full gallop. A stirrup iron
struck and tore his djellaba and the horse was gone—out of the
tunnel up the street. But Mohammed’s eyes were now accustomed
to the darkness. He was able to see against the sky that the horse
was riderless.
Something had startled the horse and the French Captain was
thrown. He was lying on the ground back there, in the darkness.
That was all! Thus Mohammed reasoned, listening. Yes, certainly
that was all—except that it might well be that the French Captain
was hurt.
Mohammed must return and find out. Quaking with alarm he
retraced his steps, throwing the light of his lantern on one side of
the passage after the other. But so far the passage was empty. No
doubt the Captain would be lying on the ground beyond the angle
where the tunnel turned. But here too he searched in vain. The
Captain had disappeared: somewhere between the two outlets in
this black place. He had gone!
Mohammed lifted the lantern above his head, swinging it this
way and that so that the light flickered and danced upon the walls.
Then his arm grew steady. Opposite it to him in the darkest corner
there was a little door studded with great nails—a door you never
perceived though you passed through the tunnel ten times a day.
Mohammed crossed to it, touched it, shook it. It was locked and
bolted. He was debating whether he should knock upon it or no. But
he dared not. This was the beginning of that Holy War which was to
free El Magreb from the clutch of the Christians,—the stealthy
beginning. To-morrow there would not be one of them alive in Fez,
and outside Fez the land would be one flame of vengeance. If the
French Captain were behind that little door he must be praying for a
swift death!
Mohammed drew back and suddenly the mouth of the tunnel
was obscured and he saw the figures of two men. Panic had been
hovering about Mohammed these many minutes since. It took him
by the throat and the heart now. With a cry he dashed his lantern on
the ground and fled leaping, past the two men. He was not followed.
This is the story which Mohammed told to Si El Hadj Arrifa in the
room with the clocks and the brass bedstead and the silver
candelabra.
“That is the gate by Karouein Mosque?” said the master, when
his servant had done.
“Yes.”
Si El Hadj Arrifa nodded his head thoughtfully. He did not believe
that the Captain had been captured or slain in this noiseless fashion.
He himself had been bidden not to open that big envelope locked
away upstairs until he was very certain that Paul Ravenel was dead.
The Captain had his plans into which it was no business of his friend
to pry.
“As to that little door, Mohammed,” he said. “It will be well to
forget it.”
“It is forgotten, Master,” answered Mohammed, and far away but
very clear and musical in the silence of the night the voice of a
mueddin on a lofty minaret called the Faithful to their prayers.
CHAPTER XIII

The Companions of the Night

S i El Hadj Arrifa was right. When Mohammed saw Paul


Ravenel ride forward out of the loom of the night into the
darkness of the tunnel, bending his head so that it might not
strike the roof, he missed a slight action which was much more
significant. Paul slipped his right hand into his pocket and took out a
heavy key. He had been seeing to it that Mohammed should draw
gradually ahead and by the time when he came opposite to the little
door in the angle, Mohammed was far beyond the turn and there
was not the faintest glimmer of light from the lantern. Paul slipped
from his saddle, gave his horse a sharp cut across the buttocks with
his riding whip, and as the startled animal galloped off, turned
quickly to the little door.
He was in a darkness so complete that he could not see the key
in his hand nor the hand that held it. Yet he found the keyhole at
once and in another second he was within the house. The passage
in which he found himself was as black as the tunnel outside. Yet he
locked the door, picked up and fitted the stout transverse bars into
their sockets as neatly as though he worked in the broad noon. He
had made no sound at all. Yet he had shut a door between the world
and himself, and the effort of his life now must be to keep it for ever
closed. He had a queer fancy that a door thus momentously closing
upon his fortunes ought to clang so loudly that the noise of it would
reach across the city.
“There was once a Paul Ravenel,” he said to himself.
The lantern in Mohammed’s hands flickering upon the walls of
the tunnel and every second dwindling a little more, receding a little
more, danced before his eyes. There went the soul and spirit of that
Paul Ravenel.
He was aroused from his misery by the sound of Mohammed’s
hands sliding curiously over the panels of the door. The cry of panic
followed quickly and the clatter of the lantern upon the cobble
stones. Paul waited with his pistol in his hand, wondering what had
startled his attendant. But silence only ensued and he turned away
from the door into the house. At the end of a short passage he
opened a second door and stood on the threshold of a small court
brightly lit and beautiful. A round pool from which a jet of water
sprang and cooled the sultry air was in the centre of the white-tiled
floor. Wooden pillars gaily painted and gilded and ornamented in the
Moorish fashion, not by carving but by little squares and cubes and
slips of wood delicately glued on in an intricate pattern, supported
arches giving entrance to rooms. There was a cool sound of river
water running along an open conduit waist-high against a wall; and
poised in an archway across the court with her eyes eagerly fixed
upon the passage stood Marguerite Lambert, a tender and happy
smile upon her lips.
When Paul Ravenel saw her, the remorse which had been
stinging him during the ride and had reached a climax of pain as he
stood behind the door, was stilled. Marguerite had changed during
this year. The hollows of her shoulders and throat had filled. The
haggard look of apprehension had vanished from her face. Colour
had come into her cheeks and gaiety into her eyes and a bright
gloss upon her hair. She wore a fragile little white frock embroidered
with silver which a girl might have worn at a dance in a ball room of
London or Paris; and in the exotic setting of that court she seemed
to him a flame of wonder and beauty. And she was his. He held her
in his arms, the softness of her cheek against his.
“Marguerite!” he said. “Each time I see you it is for the first time.
How is that?” But Marguerite did not answer to his laugh. She held
him off and scanned him with anxious eyes.
“Something has happened, Paul.”
“No.”
“When you came in, you were troubled.”
“When I saw you the trouble passed. I was afraid that you might
be angry. I am very late.”
Marguerite did not believe one word of that explanation, but the
way to discover the true one did not lie through argument. She drew
Paul across the court, holding him by the hand and saying lightly:
“Foolish one, should I quarrel with you on the evening before you
march away? You might never come back to me.”
She led him into a side room and drew him down beside her on
the thick, low cushions. Upstairs there were chairs and tables and
the paraphernalia of a western home. Here on the level of the patio
and the street they had for prudence’ sake kept it all of the country.
There was no brass bedstead, it is true, to ornament the room, but
there were three tall grandfather clocks, though only one of them
was going and that marked the true time. Marguerite laid her head
in the hollow of his shoulder and her arm went round his waist.
“Paul, you won’t get killed!” she whispered. “Oh, take care! take
care! I am afraid. This year has been so perfect.”
“You must have been lonely many days.”
“And many nights,” whispered Marguerite, with a little grimace.
Then she laughed with the trill of a bird. “But you had just gone or
you were soon returning and my thoughts were full of you. I am not
difficult and thorny, am I, Paul? Say so! Say so at once!”
He laid her down so that her shoulders rested on his knee and
her face smiled up at him, and bending he kissed her on the mouth
for an answer.
“You are the most golden thing that ever happened in this world,”
he said. “I think of all those years that I lived through, before I met
you, quite contented with myself and knowing nothing—no,
absolutely nothing of the great miracle.”
“What miracle, Paul?”
“The miracle of man and woman,—of you and me—who want to
be together—who are hungry when we are not together,—who walk
amongst rainbows when we are.”
Paul was the “grand serieux,” as Gerard de Montignac had called
him, warning him too of that very fate which had befallen him. Love
of this girl had swept him off his feet, calf-love and man’s love had
come to him at once. Marguerite was new and entrancingly strange
to him as Eve to Adam. He made much of her judgment, as lovers
will, marvelling when she swept to some swift, sane decision whilst
he was debating the this and the that. She entertained him one
moment as though he were an audience and she a company of
players; she was the tenderest of companions the next: in her
moments of passion she made him equal with the gods; and the
pride and glory to both of them was that each had been the first to
enter the heart and know the embraces of the other.
“Paul, what are you thinking about?” she asked.
“That’s the prettiest frock I have seen you in,” said he, and with a
smile of pleasure she raised herself and sat at his side.
“It’s the prettiest I have got,” she returned.
Paul lifted a strip of the fragile skirt between his fingers.
“It’s a funny thing, Marguerite,” he said. “But until I knew you, I
never noticed at all whether a girl was wearing a topping frock or
whether she was dowdy. So long as they had something over their
shoulders, they were all pretty much the same to me.”
“And now?” asked Marguerite.
“Well, it’s different,” said Paul, disappointing her of her expected
flattery. “That’s all.”
Marguerite laughed, as she could afford to. As she knew very
well, he loved to see her straight and slim in her fine clothes and it
gave him an entrancing little sensuous thrill to feel the delicate
fabrics draping exquisitely her firm young body.
Paul, before he had set out with Colonel Gouraud’s supply column
on the expedition to Fez, had sent Marguerite across the Straits and
up to Madrid, where a credit was opened for her at one of the
banks. Paul had been afraid lest she should stint herself, not only of
luxuries but of things needed. But she had answered, “Of course I’ll
take from you, my dear. I am proud to take from you.”
She looked back upon that journey now and said:
“I had six glorious weeks in Madrid. Fittings and fittings and
choosing colours, and buying shoes and stockings and hats and all
sorts of things. I began at half past nine every morning and was
never finished till the shops closed. I had never had any money to
spend before. Oh, it was an orgy!”
“And you regret those weeks?” asked Paul, misled by the
enjoyment with which she remembered them.
“Nonsense. I had more fun still when I came back with what I
had bought. I was going to make myself beautiful in the eyes of my
lord!” and mockingly she pushed her elbow into his side, as she sat
beside him.
Marguerite, upon her return, had waited for some weeks in
Tangier. Paul had to make sure that he was to be stationed at Fez.
Afterwards he had to find and buy this house, furnish it and provide
a staff of servants on whose fidelity he could rely. He had secured
two negresses and an Algerian, an old soldier who had served with
him in the Beni-Snassen campaign before he had ever come on
service to Morocco. Even when all was ready at Fez there was a
further delay, since the road from Tangier to Fez was for a time
unsafe.
“I was tired of waiting, long before Selim and the negress and
the little escort you sent for me appeared,” she said. “But the
journey up country I adored.”
It was early in the year. The ten villages with their hedges of
cactus; the rolling plains of turf over-scattered with clumps of
asphodel in flower; the aspect of little white-walled towns tucked
away high up in the folds of hills; the bright strong sun by day, the
freshness of the nights, and the camp fires in that open and
spacious country were a miracle of freedom and delight to this girl
who had choked for so long in the hot and tawdry bars of the coast
towns. And every step brought her nearer to her lover. It was the
season of flowers. Great fields of marigold smiled at her. Yellow-
striped purple iris nodded a welcome. Rosy thrift, and pale-blue
chicory, and little congregations of crimson poppies, and acres of
wild mustard drew her on through a land of colour. And here and
there on a small knoll a solitary palm overshadowed a solitary white-
domed tomb.
She rode a mule and wore the dress of a Moorish woman. All had
been done secretly, even to the purchase of the house in Fez, which
was held in the name of a Moorish friend of Paul’s. It was
Marguerite’s wish from first to last. Paul would have proclaimed her
from the roof tops, had she but lifted an eyebrow. But she knew
very well that it would not help Paul in his career were he to bring a
pretty mistress up from the coast and parade her openly in Fez. He
would get a name for levity and indiscretion. Moreover, the secrecy
was for itself delightful to her. It was to her like a new toy to a child.
“I love a secret,” she had said once to Paul, when he urged that
her life was dull. “It sets us a little further apart from others and a
little nearer together. It will be fun keeping it up, and we shall laugh
of an evening, locked safely away in the midst of Fez in our little
hidden palace.” It was fun, too, for Marguerite to dress herself in a
fine silk caftan of pink or pale blue reaching to her feet, to pass over
the mansouriya, to slip her bare feet into little purple embroidered
heelless slippers, to wind a bright scarf about her hair, to burden her
ankles and arms with heavy clashing rings of silver, to blacken her
long eyelashes and veil the lower part of her face and go shopping
with one of the negresses in the Souk-Ben-Safi. It was fun also to
return home and transform herself into a fashionable girl of the day
and wait in this southern patio for the coming of her lover.
“I love routine like a dog,” she said on this evening. She was
sitting on the low cushion by Paul’s side. Her slim legs showing pink
through the fine white silk of her stockings were stretched out in
front of her. She contemplated the tips of her small white satin
slippers. “I don’t want any more surprises,” and Paul’s face grew for
a moment grave and twitched with a stab of pain. “I don’t want any
more people. I have had enough of both. I love going up on the roof
and watching that great upper city of women, and wondering what’s
going on in the narrow streets at the bottom of the deep chasms
between the houses. I have books, too, and work when I’m not too
lazy to do it, and I am learning the little two-stringed guitar, and I
want one person, one foolish dear person, and since I’ve got him,
I’m very happy.”
Paul reached forward and, closing a hand round one of her
ankles, shook it tenderly.
“Listen to me, Marguerite!” he began, but she was upon her feet
in an instant. She snatched up Paul’s kêpi and cocked it jauntily on
her curls.
“Canada?” she cried in a sharp, manly voice, and saluted,
bringing her high heels together with a click and standing very stiff
and upright. She hummed the tune of “The Maple Leaf,”
interpolating noises meant to parody the instruments of an
orchestra, and she marched in front of Paul and round the patio
quickly and briskly like a girl in a pantomime procession, until she
came back to her starting point.
“Australia!”
Again she saluted and marched round to the tune of “Australia
will be there.”
“The U-nited States of America!” she announced, and this time
she skimmed round the patio in a sort of two-step dance, swift as a
bird, her white and silver frock glinting and rippling as she moved.
“Yankee Doodle went to town
Upon a little pony,”
she sang, and she returned to her starting point.
“Great Britain!” she cried.
Here she saluted for a long time while marking time and calling
out in a gruff voice: “One, two, one, two! Can’t you girls keep time!
Miss Montmorenci, you’ve a ladder in your stocking, and if you think
any one is going to take the trouble to climb up it, you flatter
yourself. Miss de Bourbon, you haven’t marked your face and it can
do with a lot!” and off she went to the tune of the “British
Grenadiers.” When she came opposite to Paul again she held out her
short skirt on each side, dropped a low curtsey and declared:
“And that, ladies and gentlemen, will conclude our entertainment
for this evening.”
It was to conclude their entertainment for many and many an
evening, for whilst Paul laughed and applauded, from right above
their heads, it seemed, a voice vibrant and loud and clear dropped
its call to prayer through the open roof of the court.
“Allah Akbar! God is above all. There is no God but God and
Mohammed is his prophet. Rise and pray! Rise and do the thing that
is good. There is no God but God!”
It was the same voice to which Si El Hadj Arrifa was listening in
another quarter of the city. Paul’s house was built in the very shadow
of the Karouein Mosque, and the voice pealing from its high minaret
in the silence of the night, familiar though both Marguerite and he
were with it, never failed to startle them. It was a voice deep,
resonant, a voice of music and majesty.
“The Companions of the Sick!” said Paul, as they listened to it
without moving, caught in the spell of its beauty.
“There are ten of them,” said Marguerite. “Like all the rank and
fashion of Fez, I set my clocks by their voices.”
“Yes, ten,” Paul explained. “Ben Hayoun, a rich man lay very ill in
this city, and night after night he could get no sleep. The silence
became terrible to him. He felt an appalling sense of loneliness as
the hours dragged by and not a sound varied them. So, when he
recovered, he founded this order of ten mueddins, each of whom
must chant the summons to prayer for a half of one of the five hours
which precede the dawn, so that those in pain shall be no more
alone. They call them the companions of the sick.”
Marguerite looked up to the open roof and the stars above it.
“I often wonder what they think when they look down upon this
bright square of light beneath them: whether they speculate who
live here and why they stay up so late of nights. I fancy sometimes
that the mueddin is looking down and watching us as we move
about the court.”
She stood for a moment gazing upwards, and then her mood
changed.
“One o’clock,” she cried, and running to the clock against the
wall, she opened the glass which protected its face and adjusted the
hands. “Paul, I’ll give you a whiskey and soda, and you must go.”
She turned to him, trying to laugh gaily, but her voice broke.
“You have to be on parade at six and you have miles to go before
you reach your camp.” Her gaiety deserted her altogether. She flung
herself into his arms and clung to him, pressing her face against his
coat. “Oh, my dear, when shall I see you again? I wish that you
weren’t going. Yes, I do! Though I pretend to laugh and to think
nothing of it when I am with you, I have been praying for a week
with all my heart that something might happen to keep you here.”
“Something has happened,” said Paul.
Marguerite lifted her face.
“You are not going?”
“No.”
“Paul, Paul!” she cried joyfully. But there was a look on his face
which dashed her joy. Marguerite was quick in those days to fall
from a high buoyancy of spirit to forebodings and alarm. This miracle
of her happiness was balanced on so fine a needle point that
sometime it must drop and break into a thousand useless shining
splinters. “Why aren’t you going?” she asked suspiciously.
“Because of the rain.” Paul Ravenel explained. “The departure of
the Mission is postponed for three days.”
“Only for three days?” Marguerite repeated with a wistful droop
of the corners of her mouth.
“It won’t leave after three days,” said Paul. “It won’t leave Fez for
a long while.”
He spoke very gravely and after a moment of silence Marguerite
disengaged herself gently from his embrace. A trace of the haggard
look which had once been so familiar upon her face was visible there
again: so visible that Paul wondered whether some hint of the
threatened massacre had not been given to her by Selim or the
negresses.
“Yes, you were in great trouble when you came into the court to-
night, and when I asked you why, you put me off with an excuse.
The truth now, Paul, please!” she pleaded though she caught her
breath at the thought of what the truth might mean to her.
“You have courage, Marguerite.”
The girl’s eyelids closed and fluttered over her eyes.
“I shall need it?”
“Yes.”
She sank down upon the cushions, for her knees had given under
her. Paul did not understand the real cause of her distress until she
took his hand between both of hers and spoke.
“You needn’t hesitate, my dear. Of course I have always lived in
fear that our life together couldn’t go on. In my happiest moments,
deep down, I have felt that dread. Perfection’s not allowed, is it?
There’s a jealousy that will shatter it. I was sure of that. But I always
hoped—not yet. I always prayed for a little longer time to make up
for the wretched years before.”
If trouble was mentioned to Marguerite Lambert in those days
she had just the one interpretation of the word. It meant separation
from Paul and therefore the ending of all things. Her passion
occupied her, heart and brain and blood. She had waited for it,
curiously certain that she would not be denied it. Now that the great
gift was hers, she was in a desperate alarm lest she should wake
one morning to discover that it had been filched from her in the
night. Paul dropped down upon the cushions at her side and with a
tender laugh drew away her hands from her face.
“Marguerite, you are foolish. It isn’t separation, of course. You
haven’t to fear that—no, nor ever will have to. Believe me,
Marguerite! Look at me and say you believe me!”
He turned her face towards him and held it between his hands
and her eyes lost their trouble and smiled at him.
“That’s right. Now listen, Marguerite!”
He gave her a little shake. For since she knew that the one evil
which she dreaded was not to befall her she had ceased to attend.
“I am listening, Paul.”
“I dined with a friend of mine to-night. I went there to leave him
a letter of instructions about you if anything happened to me on our
march down to the coast.”
“Happened to you?” she exclaimed with a sharp intake of her
breath.
“I expected an attack. Si El Hadj Arrifa would have seen that you
were sent safely down to the coast. My agents there would have
taken care of you. You would of course never want for anything
again.”
“I should want for everything,” said Marguerite slowly. “I don’t
think, Paul, that I could go on living. . . . I was told of a girl . . .
when her husband died, she dressed herself in her wedding gown—I
couldn’t do that, my dear,” she interpolated with a little whimsical
smile. “Then she lay down on her bed and took poison. . . . I often
think of that girl.”
“Marguerite, you shouldn’t. It’s morbid. You are young. Even if I
went—” but there came a stubborn look upon Marguerite Lambert’s
face against which he was well aware his finest arguments would
beat in vain. “I’ll discuss that with you when it’s necessary,” he said.
“To-night my friend Si El Hadj Arrifa warned me that not only was
the Mission to be attacked on its way to the coast, but that there
would also be a rising here.”
He had Marguerite’s attention now. She looked at him with
startled eyes.
“In Fez?”
“Yes.”
“That will mean—?”
“Yes, let us face it. A massacre.”
Marguerite shivered and caught Paul’s hand. She looked about
the court outside the lighted room in which they sat. There were
shadowy corners which daunted her. She looked upwards, straining
Welcome to Our Bookstore - The Ultimate Destination for Book Lovers
Are you passionate about books and eager to explore new worlds of
knowledge? At our website, we offer a vast collection of books that
cater to every interest and age group. From classic literature to
specialized publications, self-help books, and children’s stories, we
have it all! Each book is a gateway to new adventures, helping you
expand your knowledge and nourish your soul
Experience Convenient and Enjoyable Book Shopping Our website is more
than just an online bookstore—it’s a bridge connecting readers to the
timeless values of culture and wisdom. With a sleek and user-friendly
interface and a smart search system, you can find your favorite books
quickly and easily. Enjoy special promotions, fast home delivery, and
a seamless shopping experience that saves you time and enhances your
love for reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!

ebookgate.com

You might also like