100% found this document useful (5 votes)
31 views84 pages

Object Oriented Programming With Java 1st Edition by Hanumanth Ladwa ISBN 8450193403 9788450193403 - Get The Ebook Instantly With Just One Click

The document provides information about various eBooks on Object Oriented Programming (OOP) with Java and C, including titles, authors, and ISBNs. It discusses the fundamentals of OOP, its concepts, advantages, and applications, as well as the evolution of Java as a programming language. The content emphasizes the importance of OOP in modern programming and highlights key features of Java, making it a versatile and secure language for various applications.

Uploaded by

caryanhgel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (5 votes)
31 views84 pages

Object Oriented Programming With Java 1st Edition by Hanumanth Ladwa ISBN 8450193403 9788450193403 - Get The Ebook Instantly With Just One Click

The document provides information about various eBooks on Object Oriented Programming (OOP) with Java and C, including titles, authors, and ISBNs. It discusses the fundamentals of OOP, its concepts, advantages, and applications, as well as the evolution of Java as a programming language. The content emphasizes the importance of OOP in modern programming and highlights key features of Java, making it a versatile and secure language for various applications.

Uploaded by

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

Instant Ebook Access, One Click Away – Begin at ebookball.

com

Object Oriented Programming with Java 1st edition


By Hanumanth Ladwa ISBN 8450193403 9788450193403

https://ebookball.com/product/object-oriented-programming-
with-java-1st-edition-by-hanumanth-ladwa-
isbn-8450193403-9788450193403-25034/

OR CLICK BUTTON

DOWLOAD EBOOK

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


Your digital treasures (PDF, ePub, MOBI) await
Download instantly and pick your perfect format...

Read anywhere, anytime, on any device!

An Introduction to Object Oriented Programming with Java


5th Edition by Thomas Wu ISBN 9780073523309 0073523305

https://ebookball.com/product/an-introduction-to-object-oriented-
programming-with-java-5th-edition-by-thomas-wu-
isbn-9780073523309-0073523305-15552/

ebookball.com

An Introduction to Object Oriented Programming with Java


5th Edition by Thomas Wu ISBN 0073523305 9780073523309

https://ebookball.com/product/an-introduction-to-object-oriented-
programming-with-java-5th-edition-by-thomas-wu-
isbn-0073523305-9780073523309-16398/

ebookball.com

An Introduction to Object Oriented Programming With Java


5th Edition by Thomas Wu 0073523305 9780073523309

https://ebookball.com/product/an-introduction-to-object-oriented-
programming-with-java-5th-edition-by-thomas-
wu-0073523305-9780073523309-17244/

ebookball.com

An Introduction to Object Oriented Programming With Java


5th Edition by Thomas Wu 0073523305 9780073523309

https://ebookball.com/product/an-introduction-to-object-oriented-
programming-with-java-5th-edition-by-thomas-
wu-0073523305-9780073523309-15256/

ebookball.com
An Introduction to Object Oriented Programming With Java
5th Edition by Thomas Wu 0073523305 9780073523309

https://ebookball.com/product/an-introduction-to-object-oriented-
programming-with-java-5th-edition-by-thomas-
wu-0073523305-9780073523309-15330/

ebookball.com

Object Oriented Programming and Java 1st Edition by Danny


Poo, Derek Kiong 9813083964 9789813083967

https://ebookball.com/product/object-oriented-programming-and-
java-1st-edition-by-danny-poo-derek-
kiong-9813083964-9789813083967-15306/

ebookball.com

Object Oriented Programming and Java 1st Edition by Danny


Poo, Derek Kiong 9813083964 9789813083967

https://ebookball.com/product/object-oriented-programming-and-
java-1st-edition-by-danny-poo-derek-
kiong-9813083964-9789813083967-15278/

ebookball.com

Beginning Object Oriented Programming with C 1st Edition


by Jack Purdum 1118336925 978-1118336922

https://ebookball.com/product/beginning-object-oriented-programming-
with-c-1st-edition-by-jack-purdum-1118336925-978-1118336922-15290/

ebookball.com

Java Java Java Object Oriented Problem Solving 3rd Edition


by Ralph Morelli, Ralph Walde ISBN 0131474340
9780131474345

https://ebookball.com/product/java-java-java-object-oriented-problem-
solving-3rd-edition-by-ralph-morelli-ralph-walde-
isbn-0131474340-9780131474345-12410/

ebookball.com
Object Oriented Programming
with

JAVA

Hanumanth Ladwa
Dedicated to my Parents and
Sisters

Contents
Chapter
Chapter Title Page no.
no.

Fundamentals of object oriented


1 1–7
programming
2 Evolution of java 8 – 14

3 Overview of java 15 – 27

4 Data types 28 – 35

5 Operators 36 – 48
6 Selection and iterative statements 49 – 68

7 Class 69 – 106
107 –
8 Arrays strings and vectors
130
131 –
9 Packages
138
139 –
10 Programming threads
158
159 –
11 Java exceptions
177
178 –
12 Applet programming
188
189 –
13 Graphics programming
199
200 –
14 Event handling
250
251 –
15 Swing
259
260 –
16 File handling
267
LAB ASSIGNMENTS 268 - 325
CHAPTER 1
FUNDAMENTALS OF OBJECT ORIENTED
PROGRAMMING
Introduction: As we move ahead with the new programming
languages, it indicates that we are improving the previous version of
the same programming language or creating a new programming
language to tackle the overheads of existing programming language
and making it more flexible and user friendly. The programmer must
be able to write the programs in such a way that the program should
take optimum memory space and increase its execution speed.
The drawbacks of procedural programming and structured
programming language are eliminated as it has certain loopholes in
the programming techniques and it makes a program too complex.
Hence, in order to eliminate the limitations of the structured and
procedural programming techniques programmers have developed a
new programming approach called Object Oriented
Programming (OOP) that emphasizes data rather than procedure.
Each problem is treated as an object rather than procedure. This
new programming technique uses the bottom-up approach. Some of
the programming languages that uses OOP technique is, C++, Small
Talk, VC++, Simula 67, C# and Java.
Object Oriented Programming Paradigm: In object oriented
programming paradigm every problem is viewed as an object rather
than the procedure. Hence, the object is a combination of data and
methods that operate on data. Some of the features of object
oriented programming language is as follows:
- Focus is one data rather than the procedure.
- Programs are decomposed into objects.
- Data can be protected by the external non-member
functions.
- Objects may communicate with each other through methods.
- OOP follows a bottom-up approach.
The naming conventions used in Procedural Oriented Programming
(POP) and Object Oriented Programming (OOP) are listed as below.
Procedural oriented Object oriented
programming (POP) programming (OOP)
Variable Objects
User-defined data types Classes
Structure members Instance variables
Functions Methods
Function call Message passing
Difference between procedural oriented programming and
object-oriented programming.
Procedural oriented Object oriented
programming programming
1. Emphasizes on the 1. Emphasizes on the
procedure rather than data rather than the
data. procedure.
2. Data is not secured. 2. Data is secured.
3. Uses a top-down 3. Uses bottom-up
approach. approach.
4. It does not model real 4. It models real world
world entities. entities.
5. Programs are 5. Programs are
decomposed into decomposed into
functions or objects.
procedures.
OOP emphasizes on data rather than procedure. Every given
problem is viewed as an object rather than procedure. The ideology
here is to unite both data and functions that operate on data into a
single unit called object.
Concepts of OOP:
- Objects
- Class
- Data abstraction
- Data encapsulation
- inheritance
- polymorphism
- dynamic binding
- message passing
Object: Object is an identifiable entity with some characteristics and
behaviour. Object may be a person, place or table of data. Let us
take an example, a mobile cell phone consisting of its features such
as color, weight, price etc. are data whereas a mobile cell phone is
used to make an audio or video call, take photographs, make videos
etc are the operations performed are called functions. Each object is
having both of these two features i.e. data and functions. An object
is any real-world entity that has its existence has both features
called data members and operations called function members.
- Example, apple, orange, banana etc are the objects of the
group called fruit.
- Similarly, roses, jasmine, lilies etc are the objects of the
group called flowers.

Object: student

Data members
Rollno.
Name
percentage
Methods
getdata()
putdata()
Class: class is a fundamental building block of object-oriented
program which serves as a blueprint. Class is a user defined data
type. Class acts as a template using which we will be able to create
any number of objects of that type. A class is a collection of similar
objects that share common features.
Example: in the above example of objects, the group of fruit is
called class. A group of flowers is called class.
Similarly, the solar system is a class whereas, an individual planet in
a solar system is called an object.
class
Data members
Data1
Data2

Data-n
Methods
Method 1
Method 2

Method-n
Data abstraction: the act of including only essential details of an
entity without including background details about it is called data
abstraction.
Example, let us consider the mobile cell phone with attributes such
as, color, Bluetooth, mobile cell phone camera etc. we are not
considering how Bluetooth works, or how the camera works or even
how the circuit inside the mobile is designed and what is happening
inside. We are interested only in using the mobile cell phone and its
features. Therefore, it is required to know how to operate a mobile
cell phone rather than its internal working, the internal working is
hidden from the user is called abstracted data.
Data encapsulation: the process of wrapping up data and
functions into a single unit called class is called data encapsulation.
Data encapsulation makes data hidden; data hiding is an act of
insulating data from outside programs. The data is not accessible
directly to the outside world, except for the functions defined inside
the class definition. These function members provide an interface
between the data and outside world to access the data out of class.
Inheritance: it is a process of acquiring properties from an object
of one class to properties of an object of another class. The class
that inherits the properties to the other class is called base class or
parent class or super class.
The class that inherits the properties from the other class is called
derived class or child class or subclass.
The programmers can add new features to the already existing class
without modifying that class. This is achieved by deriving a new
class from the already existing class. The derived class has its base
class features, in addition to that it has its own features.

Here, the employee is the base class whereas manager, supervisor


and clerk are derived classes. Employee class inherit properties to
the derived class and manager, supervisor and clerk inherited by the
base class employee. In addition to the properties inherited from the
base class, derived classes manager, supervisor and clerk have their
own properties.
Polymorphism: it is an ability of the message to process in more
than one form. Poly means many, morph means forms.
Polymorphism means many forms. The best examples for
polymorphism are, operator overloading and function overloading.
The process of making an operator exhibit different behaviors in
different instances is known as operator overloading.
Example: consider an addition operator, when used with numbers,
acts as an arithmetic operator to perform addition. Let’s say, 2+3
gives 5 whereas the same operator is used with the strings let’s say
“Lot”+”us” then it combines two strings together, it acts as a string
concatenation operator which results in “Lotus”. This different
behaviour of the same operator at different instances is known as
operator overloading.

The process of two or more functions having the same name with
different return types or different number of arguments is called
function overloading.
Here paint() items are single interface and paint() furniture, paint()
vehicle, paint() building and paint() fabric are many methods.
Example:
int add (int a, int b);
float add (float x, float y) ;
Here, add is a function name which is common in both the functions
but return types of these two functions are different, one is int and
another is float. And the number of arguments is the same in both
the functions i.e. 2. Function overloading is used when we want to
perform the same operations on different data. Function overloading
has the same interface but many methods. You can observe in the
above example add is the function name i.e. interface and many
methods means we have addition operations to be performed on
two different data types.
Dynamic binding: binding is the process of providing reference
between more than one module. Dynamic binding means the code
associated with a given procedure call is not known until the time of
the call at run-time or at the time of program execution.
Message passing: message passing is a request for execution of a
procedure for an object. Therefore, a message invokes a procedure
in the receiving object to generate the desired output.

For example, consider an object obj and we have calculated the


‘sum’ (information) by taking add (message) then it is possible to
pass message to this obj object as shown below:
Advantages of OOPs
- Using class and objects, programs are modularized.
- Linking code and object allows related objects to share common
code. This reduces code duplication and code reusability.
- As the data is encapsulated along with functions, the non-member
functions cannot access or modify data. Thus, providing data
security.
- Complexity of the program development is reduced through the
use of inheritance.
- Reduces time, as creation and implementation of OOP code is easy.
- Through message passing OOP communicates to the outside
system.

Applications of OOP:
- Computer graphic applications.
- CAD/CAM software.
- Object oriented databases.
- User interface design such as windows.
- Real-time systems.
- Simulation and modelling.
- Artificial intelligence and expert systems.
- Hypermedia, expert text and hypertext.
- Decision support systems and office automation systems.
- Parallel programming and neural networks.

EXERCISES
1. What are the features of OOP?
2. List the naming conventions used in POP and OOP.
3. Differentiate between POP and OOP.
4. Explain the basic concepts of OOP.
5. Describe the advantages of OOP.
6. List the applications of OOP.
CHAPTER 2
EVOLUTION OF JAVA
Java history:
Java is a general purpose object oriented programming language
developed by Sun Microsystems of USA in 1991. Earlier java was
called oak (because it is a symbol of strength and chosen as a
national tree of many countries) by James Gosling (One of the
inventors of the language) who is known as Father of Java. In 1995
Oak was renamed as Java. Java is an island in Indonesia. Developed
this language to make it platform independent meaning that the
programs written in java can be executed on any of the systems
irrespective of hardware and operating system. Java programs are
written and executed on any of the computer systems, because java
produces the intermediate code called bytecode that can be
interpreted by any system as it is not tied with hardware and
software configuration of the computer system. The team members
of java also known as Green Team, initiated the project to develop a
programming language for digital devices like, set-top box,
interactive television etc. It was best suited for internet
programming. Presently, Java is used in internet programming, like
mobile devices. Electronic games, electronic business solutions etc.
Features of Java:
The primary objective of developing Java programming language
was to make it portable, simple and secure programming language.
In addition to this, there are some other features of Java as
described below.
- Simple: Java is simple, easy to learn and easy to understand
because Java syntax is similar to C++ programming language.
Java is made simple by removing some complicated features of
C++ such as explicit pointers, friend functions, inline functions,
goto statements, operator overloading etc. Java allocates and
deallocates memory for the object at runtime hence, the
objects are allocated dynamically and deleted by automatic
garbage collection once the program execution terminates.
- Object Oriented: Everything in java is considered as an
object. The software is organized as a combination of different
types of objects that incorporate both data and behavior.
Object oriented methodology makes the software development
process easy and provides certain rules for maintenance.
- Platform independent: Java is not dependent on machine
hardware as well as software. It is completely independent of
any platforms. A platform is the hardware or software
environment in which a program runs. Java can be executed on
multiple platforms, for example, windows, Linux, sun Solaris,
Mac/OS, etc. Java is compiled by the compiler and converted
into byte code. This byte code is also called as intermediate
code that can be interpreted by the Java Virtual Machine (JVM).
This byte code can be executed on any of the platforms
irrespective of their configurations. Hence, java is a portable
programming language. Java programs can be easily moved
from one computer system to another. Java is architecture
neutral, in C programming, int data type takes 2 bytes of
memory for 32 bit architecture and 4 bytes for 64 bit
architecture. However, it takes 4 bytes of memory for both 32
and 64 bit architecture in Java.
- Secured: Java is known for security. As java is used to
develop internet applications called applets, java ensures that
no viruses are communicated with an applet. As java does not
support pointers, it ensures that the programs cannot gain
access to memory locations without proper authorization.
- High performance: Java is both a compiled and interpreted
programming language. Java compiler produces an
intermediate code called byte code. This byte code can be
executed on any of the computer systems. This intermediate
code of java makes the java program execute the program
faster. Hence, provides high performance.
- Robust: java has the ability to use strong memory
management. As there is no use of pointers in java avoids
security issues. It provides garbage collection which runs on
the java virtual machine to delete the unwanted objects that
are no longer required. Java strongly checks for type and has
an exception handling mechanism. Hence, makes Java a robust
programming language.
- Distributed: Java is designed to distribute the applications
on the networks. Java applications allows programmers to
access remote objects on the internet, enables multiple
programmers at remote locations to collaborate with one
another and work together on a single project.
- Multi-threaded: A thread is a sequence of finite sets of
instructions written as a separate program, executing
concurrently. If multiple threads are to be executed, then the
advantage of using multi thread is that, instead of allocating
memory for each thread, it shares the common memory
location. Threads are used for multimedia, web applications
etc.
- Dynamic: Java is capable of dynamically linking in new class
libraries, methods and objects. Java supports functions written
in C and C++ programming languages. These functions are
known as native methods. These methods are linked
dynamically at runtime. Even the objects are allocated memory
space at the time of program execution and frees up the
memory locations by the built-in system called garbage
collection, as soon as the program terminates its execution.
How does Java differ from C?
Some of the features of the C programming language that causes
problems are eliminated from java. Those features are list as below:
- The user defined data types structures and unions are not
included.
- In java, header files or preprocessor directives are not
required.
- No sizeof and typedef statements are used.
- Java does not support the type modifiers such as auto ,
extern , register , signed and unsigned .
- The goto statement is omitted.
- Java does not support explicit pointers.
- Java adds new operators such as instanceof and >>>.
- Java adds labeled break and continue statements.
- Functions in java that accept no parameters must be declared
with empty brackets and not using void .
How does Java differ from C++?
Some of the features present in C++ programming language are
eliminated in java that are listed as below.
- Java does not support operator overloading.
- Java does not use default arguments.
- Java doesn’t support multiple inheritance (instead java uses
interface).
- Java does not support global variables. Every variable and
method must be declared in a class.
- Java does not support destructor functions. Instead, java
uses a method called finalize().
- Java is both a compiled and interpreted programming
language. Java source code is converted into byte code at
compile time and the interpreter executes this bytecode at
runtime and produces output.
Java and internet: Java is associated with the internet. Web
browsers to run applets on the internet. Java programming language
is used to create applet programs and run them locally using a java
enabled browser such as hot java, used to download an applet
located on the internet and it on the local computer system. Internet
users can set their websites containing java applets that could be
used by other remote users of the internet. Because of this fact, java
is also known as an internet language.
Java and World Wide Web: java communicates with a web page
through a special tag called <applet>. Java users send a request for
an HTML document to the remote computers and browser. The web
browser is a program that accepts a request, processes the request
and sends the required documents to the local computer. The
document contains the applet tag which identifies the applet. The
corresponding applet is transferred to the local computer. The java
enabled browser on the local computer interprets the byte code and
provides output.
www is a collection of information stored on the internet. It is an
information retrieval system. www contains web pages that provide
both information and controls. Web pages contain HTML tags that
enable us to retrieve, manipulate and display documents across the
globe. Java enables web pages to display animation, graphics, and
special effects. The following figure depicts exactly how the local
computer system user communicates to the java applet on the
remote computer system.
Web browsers: web browser is an application software used to
locate, fetch and show the content on the world wide web. Web
browser acts as a client whereas the remote computer holding
information acts as a web server. Web browser sends a request
object for information to the remote web server. The web server
responds back by sending a response object to the web browser that
contains information. The information fetched from the server
contains HTML tags that are interpreted by the browser. Some of the
examples for web browsers are, hot java, Netscape navigator,
internet explorer, google chrome, firefox mozilla etc.
Java environment: java environment includes a large number of
development tools and number of classes and methods. The
development tools are present in a unit called Java Development
Kit (JDK) and the classes and methods are present in a unit called
Java Standard Library (JSL) or Application Programming
Interface (API)
Java Development Kit:
Tools Description
Applet Enables to run java applets.
viewer
Java Java interpreter which runs both
applet and application by interpreting
byte code.
Javac The java compiler which translates
java source code to byte code.
Javadoc Create HTML format documentation.
Javah Produces header files for use with
native methods.
Javap Java disassembler enables to convert
byte code into program description.
Jdb Java debugger helps to find errors in
the program.

Application Programming Interface (API): most commonly


used packages are listed below:
Language support package: it is a collection of classes and
methods required for implementing basic features of java.
Utilities package: it is a collection of classes to provide utility
functions such as, date and time functions.
Input-output package: it is a collection of classes required for
input-output manipulation.
Networking package: it is a collection of classes for
communicating with other computers via the internet.
Applet package: it is a collection of classes that allows one to
create a java applet.
The following diagram depicts the process of building and running a
java application program.
Java Runtime Environment: java runtime environment facilitates
the execution of programs. It consisting of the following:
- Java Virtual Machine (JVM): JVM interprets the byte code
and produces an output. This byte code is also called an
intermediate code that can be executed on any system. It
follows the Write Once and Read Anywhere (WORA) principle.
- Runtime class libraries: it is a collection of class libraries
used to execute java programs.
- User interface toolkits: Abstract Window Toolkit (AWT)
and swing support various input methods to interact with the
application program.
- Deployment tools: Java Runtime Environment consisting
the following tools.
Java plug-in: This plug-in enables the execution of a
java applet on the browser.
Java web start: This tool enables remote deployment of
an application.
EXERCISES
1. Explain the evolution of java.
2. Describe the features of java.
3. How does Java differ from C?
4. How does Java differ from C++?
5. Explain how java and the internet are related.
6. Explain the relation between java and www.
7. What are web browsers? Explain with examples.
8. Explain the tools available in JDK.
9. Describe API with its components.
10. Briefly explain Java Runtime Environment.
CHAPTER 3
OVERVIEW OF JAVA
Introduction: Java is a general purpose, object oriented
programming language. Java programming language is used to
develop two types of programs.
- Standalone applications
- Web applets
Standalone applications are those programs that are executed on the
local computer system whereas web applets are developed for
internet applications. An applet is a program situated on a remote
computer system (server) that can be downloaded and executed on
a local computer (client). Let us discuss java standalone applications
first.

Java program structure:


Document section: in this section, a textual information for the
other programmer to understand the purpose of the statements or
program can be written either in a single line comment (begins with
//) or multiline comment (/*comment text here*/).
Package statement: package consisting of numerous classes that
tells the compiler to import into our program. The classes that are
present in the package that are to be utilized in our program can be
imported.
Import statements: import statement tells the compiler to include
certain packages that consist of classes that are to be utilized in our
program. import statement is similar to #include statements in C
and C++ programming languages.
Example: import employee.Sample;
This import statement tells the compiler to import or include the
class called Sample present in the employee package.
Interface statements: In java we cannot implement multiple
inheritance, instead we use interfaces. It contains a collection of
method declarations.
Class definition: Everything in java is written in class definition
only. Class is used to map the objects of real world problems.
Main method class: Every java standalone program must contain
a main method. The main method creates objects of various classes
and establishes the communications between them. When the
program terminates the control is then transferred back to the
operating system.
Simple java program:
class FirstProgram
{
public static void main(String args[])
{
System.out.println(“Welcome to the world of Java”);
}
}
Here, class is a keyword used to define a class. Everything will be
enclosed within the class definition. FirstProgram is a valid identifier
name given to the class definition. Opening brace indicates the
beginning of the class body. And respective closing brace is required
for proper execution of the program. (In C++ programs class
definition is used to terminate by semicolon (;) whereas in Java the
class definition is not terminated by a semi colon). public static void
main(String args[]) is a main function as in C/C++. It consists of a
public access specifier, making it accessible to all other classes. The
keyword static is used by the interpreter before any objects are
created. And the keyword void specifies that the main method does
not return any value. String args[] declares a parameter named
args, which contains an array of objects of the class type String.
System.out.println(“Welcome to the world of Java ''); is similar to
printf and cout statements in C and C++ programming language.
You can observe the hierarchy. System is a class, class contains
objects, cout is an object, object contains methods, println is a
method. This statement prints the string Welcome to the world of
Java.
Note: Java program must be saved with the same name as
that of the class name with the file extension .java.
Executing java program: execution of java program involves two
steps:
1. Compiling source code into intermediate (byte code) using
javac compiler.
2. Executing the byte code using java interpreter.
The above java program can be compiled as,
javac FirstProgram.java
When there are no errors in the program, java creates a file called
FirstProgram.class containing byte code.
To run the program type the following command.
java FirstProgram
This command interprets a standalone program and displays the
output Welcome to the world of Java.
Machine independent: The source code written in the Java
programming language is compiled and converted into byte code.
The same is depicted in the following figure.

FirstProgram.java FirstProgram.class

The java virtual machine (JVM) interprets bytecode into machine


code. The same process is depicted in the following figure.

Virtual machine Real machine


Command line arguments: In some situations we expect our
program to act in a particular way depending on the input provided
at the time of execution. This is achieved by command line
arguments.
As we are familiar with args in the main function which is used as an
array of strings. Any arguments provided in the command line are
passed to the array args as its elements.
Example: java FirstProgram robust secure distributed
This command line contains three arguments. These are assigned to
the array args as follows:
args[0]=robust
args[1]=secure
args[2]=distributed
the individual elements of an array can be accessed by using an
index.
Tokens: Tokens are the smallest or basic elements of a program.
The program instructions are built by using tokens. There are five
types of tokens available in java. They are,
- Keywords
- Identifiers
- Literals or constants
- Operators
- Separators
Keywords: Keywords are the reserved words that has fixed
meaning to the java compiler that cannot be changed by the
programmer. These words cannot be used as an identifier name.
These words have syntactical and semantic meaning to the compiler.
As java is case sensitive language, keywords should be written in
lowercase letters only.
Some of the keywords are listed in the following table:
if case else new try finally break class
byte for import long native int interface
private static this public super
package throw catch char continue
goto final const extends do instanceof
protected switch volatile while synchronized
etc.
Identifiers: identifiers are the name given to the programming
elements such as, classes, methods, variables, objects, labels,
packages and interfaces. The rules for declaring identifier names are
given below:
- Identifiers can have alphabets, digits, underscore (_) and
dollar sign ($) characters.
- Identifiers must not begin with numbers.
- Both uppercase and lowercase letters are distinct.
- Identifiers can be of any length (maximum is 256 characters).
Java follows some of the naming conventions as given below:
- Instance variables and methods are to be written in
lowercase letters. If it contains more than one word then, first
letter of the second word and the subsequent word with a
leading uppercase letter.
Example: sample, avg, myName, obtainedMarks, total_marks
etc.
- Classes and interfaces must begin with uppercase letters and
each subsequent word with a leading uppercase letter.
Example: Employee, Student, Account etc.
- Variables that are made constant values use all uppercase
letters and underscore between words.
Example: GRAND_TOTAL, GROSS_SALARY, TAX,
PRINCIPAL_AMOUNT etc.
Literals or constants: The quantity or value that does not change
during the execution of a program is called literals or constants. Java
supports the following types of literals.
- Integer
- Floating-point
- Character
- String
- Boolean
- Null
All of these will be discussed in detail with examples in the
forthcoming chapters.
Operators: It is a symbol that tells the compiler to perform some
specific mathematical or logical manipulation.
Operators are broadly classified as, unary, binary and ternary
operators. We will discuss each one of them in detail with examples
in the forthcoming chapters.
Separators: These are the symbols used to indicate the code
separation and arrangement. Separators are listed as,
round parentheses ()
curly braces {}
square brackets []
semicolon ;
comma ,
period .
Installing and configuring java:
Step 1: download Java Development Kit (JDK) from the
https://www.oracle.com/java/technologies/javase-jdk16-
downloads.html website.
Step 2: Once the download is complete, double click the .exe file to
begin the installation process as shown below.
Step 3: click on next button to begin java installation. The next
custom setup wizard appears as shown below.
Step 4: this screen allows the user to change the default installation
path. Click on the next button to continue installation. The
installation progress appears as shown below.

Step 5: Once the installation completes it shows the following dialog


box.
Click on close to move further settings.
Configuring java: after installation of java, configure it by adding
the java path to the environment variable. i.e. we need to set the
path. Following steps show how to configure java.
Step 1: Right click on this pc icon (or my computer or computer
icon) and click on properties from the dropdown list. The system
window appears as shown below.
Step 2: Click the advanced system settings link to open the system
properties dialog box as shown below.
Step 3: Click the environment variables button to open the
environment variables dialog box as shown below.
Step 4: The environmental variables dialog box is divided into two
sections – user variables and system variables . Under the
system variables section, select the path option below the variable
column and click the edit button. The edit system variable dialog box
appears, as shown below.
Step 5: By default, the path variable is already set to multiple
locations. Click on the New button to set the java directory path in
the variable value text box, separated by a semi-colon, as shown
below.
Step 6: Click OK to close the edit system variable dialog box.
Step 7: Click OK to close the environment variables dialog box.
Step 8: Click OK to close the system properties dialog box and
complete the process of configuring java.
EXERCISES
1. Explain java program structure with an example.
2. How to compile and run java programs?
3. Explain about command line arguments.
4. What is a token? Specify the types.
5. Define an identifier. Write its rules for writing.
6. Explain about literals, operators and separators.
7. Describe the steps involved in java installation.
8. Explain the steps involved in the java configuration.
CHAPTER 4
DATA TYPES
Introduction: In this chapter we will learn about constant variables
and data types that are to be used in java programs. These basic
elements are necessary to understand to learn any programming
language.
Constants: Constants are the quantities that do not change during
the execution of a program.
Constants are classified as follows:

Integer constants: these are the whole numbers without any


decimal point. Integer constants are prefixed with plus or minus sign.
Further integer constants are classified as decimal constants, octal
constants, hexadecimal constants and unsigned constants.
Decimal constants: these are the constants whose base or radix of
the number system is 10. Decimal constants range from 0-9. Any big
number can be generated that consists of a combination of digits
between 0 to 9.
Example, 123, -410 etc are decimal constants.
Octal constants: these are the constants whose base or radix of
the number system is 8. Octal constants range from 0-7. Any number
generated must have digits between 0-7 and octal constants always
begin with 0.
Example, 0345, -0145
0825 // this integer is an invalid octal number because 8 is not an
octal digit
Hexadecimal constants: these are the constants whose base or
radix of the number system is 16. Hexadecimal range from 0 – 9 and
a – f or A – F. hexadecimal digits a (or A) through f (or F) represent
value from 10 through 15. Any number generated must be between
the range of 0 – 9 and a (or A) through f (or F) and hexadecimal
constants prefixed with 0x or 0X.
Example, 0x8FFFAD, -0X3ADEF etc.
Unsigned constants: to specify an unsigned type we use either u
or U suffix. To specify a long type, we use either l or L suffixes.
Example, 478u; // unsigned constant
0x7777ffL // hexadecimal long type
07524ul //octal unsigned long type
Floating-point constants: these are the constants with the
decimal point and fractional part are called floating point constants.
Floating-point constants are also called real numbers. These
constants can be represented in two forms,
- Fractional form
- Mantissa exponent form
Fractional form: fractional form of floating-point numbers can be
represented as integer part followed by decimal point followed by
fractional part.
Example, 20.05
20 . 05
Integer part Decimal point Fractional part
Mantissa exponent notation: any big number or any small
number can be written in the form of power of 10.
Example,
2
4.523e2 // 4.523 x 10
-2
4.523E-2 // 4.523 x 10
-2
-0.4523e-2 // -0.4523 x 10
The exponent may be specified using e or E followed by an optional
sign (+ or -) and a sequence of digits.
Character constants: a single character enclosed within a pair of
single quotation marks.
For example, ‘a’, ‘@’, ‘&’ etc.
Each of these characters are assigned with the integer constant
values called ASCII (American Standard Code for Information
Interchange) values standardized by ANSI (American National
Standard Institute). For example, ASCII value of A is 65, B is 66 and
so on Z is 90 (uppercase letters), a is 97, b is 98 and so on z is 122
(lowercase letters), 0 is 48, 1 is 49 and so on 9 is 57 (digits).
There is another class of character, which are non-printable, but they
have special meaning. For example, space bar, tab button, enter
button, back space etc. such character constants are called escape
sequences . This type of character constants is always used with the
output statements and these types of constants begin with \
(backslash).
Following table shows the list of escape sequences used in Java,
Escape sequence Description
\a system alarm (beep)
\b Backspace
\f Form feed
\n New line (line feed)
\r Carriage return
\t Horizontal tab
\v Vertical tab
\” Double quote
\’ Single quote (apostrophe)
\0 Null character (end of string)
\\ Backslash itself

String constant: a string constant is a sequence of characters


enclosed within a pair of double quotation marks. Strings are
sequences of arrays of characters. By default, the compiler inserts a
special symbol called null character (‘\0’) at the end of the string.
Example, “Computer”, “C programming”, “Lotus”, etc.
“Computer” is represented as “Computer\0” in memory.

Classification of data types: data types are classified as follows.


Fundamental data types: these data types are also called as
primitive data types or basic data types or primary data types or
simple data types or built-in data types.
Fundamental data types include: int, char, float, double and void.
int: integers are whole numbers without decimal point and fractional
part. Integer numbers can be both positive and negative. Integer
numbers occupy 4 bytes of memory. The range of integers depends
on the word length of the computer. Word length means the number
of bits that the CPU can process at a time. The word length of the
integer is from -2147483648 to +2147483647.
Valid integers: -120, 1500, 32000, +19000, 0 etc.
Invalid integers: 13,300 //comma is not allowed
-130.5 //decimal point is not allowed
56,000.30 //comma and decimal number is not allowed
Java supports the following three types of integers as well,
Type Size Range
byte 1 byte -128 to +127
short 2 bytes -32768 to +32767
Long 8 bytes -9223372036854775808 to
+9223372036854775807

char: a single character enclosed within a pair of single quotation


marks is character constant. Characters could be a single letter, a
single digit, a single special symbol enclosed within a pair of single
quotation marks. Example, ‘a’, ‘5’, ‘#’ etc. a char type takes 2 bytes of
data in memory. These characters represent a unique number called
ASCII codes. The range of characters is, -128 to +127. If the
characters are unsigned then, it is ranging from 0 to 255.
float: these are the numbers with the fractional part. Floating-point
numbers can be both positive and negative. Example, -85.25, 0.0,
33.20, etc. the range of floating-point numbers is, -3.4e-38 to
+3.4e+38. Floating point numbers will occupy 4 bytes of memory.
double: these are also the floating-point numbers with the higher
precision than float type of data. The data type double will give a
more accurate value up to 16 digits after the decimal point, whereas,
float will give an approximate value up to 6 digits after the decimal
point. This type of data takes 8 bytes of memory. The range of
double types of data is, -1.7e-308 to +1.7e+308.
boolean: This type of data will return one of the two values, either
true or false . This type of data takes 1 bit of memory.
Variables: a variable is a quantity that changes during execution of
the program. Java encourages us to use meaningful names for
variables. Variables are declared in the declaration section before
using them in the program. In the Java program, the variable
represents the memory location that holds the value assigned to it.
Declaration of a variable: the syntax for declaring a variable is,
Data_type variable_name;
Here, the variable_name is the identifier name that must satisfy all
the rules for declaring an identifier. The variables are named storage
locations whose values can be manipulated during program
execution.
Some valid variables:
Roll_no data date_of_birth percentage
Some invalid variables:
float //it is a keyword
total_% //special symbol % is not allowed
2subjects //started with the digit
My result //blank space is not allowed
Initializing a variable:
The general form of initializing a variable is,
Data_type variable_name=value;
Example: int a=10;
Here, int is one of the primitive data types. And a is a variable that
holds integer type of data. The variable a is a named storage
location. 10 is a constant value assigned to the variable a of type
integer. A semicolon indicated termination of variable declaration.
How to make a value of the variable constant?
Example, int a=10;
In this example, the variable a is of type integer with value 10 is
assigned to it can be changed at any point of time. In order to make
it constant we use a keyword final before the data types as follows:
final int a=10;
now, the value of the variable a is constant, that cannot be changed
during the program execution.
Scope of variables: scope of the variable is part of the program
where the variable can be accessed. If the variable is declared inside
the block then it can be accessed within that block of code. If the
variable is declared before the main function then it can be accessed
anywhere in the program. Hence, there are two scopes for the
variables viz;
Local variables: the variables declared inside the method or block
of code can be accessed within that block are called local variables.
Global variables: the variables declared before the main() method
can be accessed throughout the program are called global variables.
Data type conversion: it is a process of converting one type of
data into another type. It is also called type casting.
There are two types of type castings, they are:
- Implicit type conversion
- Explicit type conversion
Implicit type conversion: in implicit conversion, low order data
type gets converted into high order data type automatically by the
compiler.
Example, int a=10;
float b=a;
Here, a is of low order data gets automatically converted into higher
order data type. b assigns value 10.0.
explicit type conversion: in explicit type conversion, high order
data type gets converted into low order data type manually by the
programmer.
The general form of type casting is,
(data type) variable;
Example, int a=5;
float b;
b=1/a;
b=1/5;
b=0 (result after integer division)
since, b is of float type, the actual value should be 0.2. but it is
displaying result 0. Therefore, to get the actual value, data
conversion is required. This can be achieved by rewriting the
statement b=1/a as,
b=1/(float)a;
The process of assigning a smaller type to a larger type is called
widening or promotion . Assigning a larger type to a smaller type
is called narrowing . Narrowing may result in loss of information.
// Write a program to illustrate the use of type casting
class Typecast
{
public static void main(String args[])
{
char ch=’a’;
byte b=10;
short s=20;
int i=12345;
long l=12345678L;
float f=3.142f;
double d=0.000000045;
System.out.println(“(short)b=”+(short)b);
System.out.println(“(short)i=”+(short)i);
System.out.println(“(float)l=”+(float)b);
System.out.println(“(int)f=”+(int)f);
}
}
Output:
F:\java programs >javac Typecast.java

F:\java programs >java Typecast


(short)b=10
(short)i=12345
(float)l=10.0
(int)f=3
Note: floating point constants have a default type of double .
If we wish to initialize a constant value to the variable of type float,
float f=1.23;
this statement will generate error;
“incompatible type for declaration. Explicit cast needed to convert
double to float.”
The above same declaration should be written as:
float f=1.23F;
EXERCISES
1. What are constants? Explain various types of constants.
2. What are data types? Explain primitive data types with
an example for each.
3. Define a variable. Explain how to declare and initialize
variables.
4. What is type casting? Explain its types with an example.
5. Write a program to illustrate the use of type casting.
Another Random Document on
Scribd Without Any Related Topics
“‘But thou would’st not alone
Be saved, my father! alone
Conquer and come to thy goal,
Leaving the rest in the wild.’

“The Buried Life seems to me one of the most beautiful, hopeful


and inspiring poems I have ever read—the thought that man’s life and
development goes on, and that his real life is realized despite the
spoiling of himself which he does continuously in the meaningless
follies of his daily round.

“‘Fate . . .
Bade through the deep recesses of our breast
The unregarded river of our life
Pursue with indiscernible flow its way;

And that we should not see


The buried stream, and seem to be
Eddying at large in blind uncertainty,
Though driving on with it eternally.’

“And then how—

“‘. . . often, in the world’s most crowded streets,


But often, in the din of strife,
There rises an unspeakable desire
After the knowledge of our buried life.’

“The room where we sat before a grate fire seemed filled with the
thought of the noble man who penned the poem, and the evening
was a most enjoyable one.”
Harper’s was a nature quick to respond to the beautiful and true
wherever found, whether in prose or verse, in music or painting, or in
the actions of daily life. He was, moreover, intensely sympathetic, and
what he read or saw always impressed, and sometimes affected, him
deeply. He would often rise from the reading of a beautiful poem, or
the story of some heroic human effort, with eyes filled and voice
completely overcome, and then, as a means of gaining relief, and at
the same time of giving expression to his feelings, would pen in a
single sentence or two the thought that was most in his mind at the
time.
Such little entries as the following are a characteristic feature of
his diary, and reveal his sympathetic appreciation of what he read,
and of the subject treated:
“To-night I read the sad story of Keats’ life. How sad it is to see so
promising a man pass so soon! How admirably he declared a great
truth when he said,

“‘“Beauty is truth, truth beauty,”—that is all


Ye know on earth, and all ye need to know.’”

“To-night I read over again Lanier’s A Ballad of Trees and the


Master, which, I think, most beautiful. The poem appealed to me
strongly as illustrating the subduing calm of the woods. Before going
to bed I read Ward’s biography of Lanier, a story of the heroic struggle
of a soul steeped in music and high purpose.”

“In the afternoon I read Matthew Arnold’s Essay on Shelley, whose


life was a strange mixture of genius and weakness. But for his poetry
his weakness would have made him detestable. But for his weakness
his poetical genius might have made him one of the most beautiful of
all our authors. As he is, he is one of those strange paradoxes who
give rise to speculation as to the necessary qualities of genius. Much
can be forgiven in one who has created the ode, To a Skylark and The
Sensitive Plant.”

“Matthew Arnold seems to me above all a critic, clear, impartial,


appreciative, kindly, bravely severe, when this is necessary to do
justice. In what he says in these Essays on Criticism, one feels how
sad it is that noble work is marred by a something wanting; half
results because of the want of something,—‘many are called, few
chosen.’”

“Next, of the features of the fortnight, was the completion of The


Idylls of the King, from which I have drawn much healthy inspiration.
We read Pelleas and Ettarre, The Last Tournament, Guinevere and
The Passing of Arthur. At the close I was struck by the wonderful way
in which the truth of the words,—

“‘It is the little rift within the lute,


That by and by will make the music mute,
And ever widening slowly silence all,’—

was unfolded. Even that beautifully conceived court, with its noble
King, its high ideals and its battle-tried knights, went to utter ruin
through the example of one sin. Another thing which struck me was
that Tennyson, like others, shows that the deadliest enemy is the
Judas. The most cherished knight and beloved Queen poisoned the
court by betraying friend and husband. But Tennyson holds out the
beautiful hope of the thief upon the cross. Lancelot was allowed to die
a holy man; and Guinevere, by true repentance and goodly works,
was able to purge her soul so as to be prepared for the reunion
hereafter. The gentle teaching of the poem is that we must be swayed
by high resolves and noble motives.

“‘We needs must love the highest when we see it,


Not Lancelot, nor another.’

“My admiration for the poem increased towards the close. The
delicate portrayal of character, and of utter pain and remorse in
Guinevere, and the beautiful imagery of The Passing of Arthur are
sublime—

“‘From the great deep to the great deep he goes.’”

“To-day R—— and I read several chapters of Past and Present.


Grand, bluff, sturdy old Carlyle is becoming a reality to me. In his
chapters leading up to the selection of Samson as Abbot of St.
Edmundsbury, he throws much light upon a really important view of
public policy, how necessary it is to select the best as Governor, and
how that best is to be recognized and selected. Carlyle I find to be
healthy, wholesome and full of moral fibre.”

“Even to the outcry against the fleeting nature of our impressions


of beauty, and, for a time, satisfying, comes an answer in the story of
Shelley’s Sensitive Plant. The author concludes the beautiful yet sad
story by saying:

“‘I dare not guess; but in this life


Of error, ignorance, and strife,
Where nothing is, but all things seem,
And we the shadows of the dream,

“‘It is a modest creed, and yet


Pleasant if one considers it,
To own that death itself must be,
Like all the rest, a mockery.

“‘That garden sweet, that lady fair,


And all sweet shapes and odours there,
In truth have never past away:
’Tis we, ’tis ours, are changed; not they.

“‘For love, and beauty, and delight,


There is no death nor change: their might
Exceeds our organs, which endure
No light, being themselves obscure.’

“If this be so, can we not increase and make more lasting our
knowledge of these things by mastering ourselves and giving scope to
the spiritual side of us?”
THE LOVE OF OTHERS

In love for others human nature manifests its highest expression.


It is the quality of soul by which, in his relations with his fellows, a
man’s capacity for service is determined; it is the fount at which all
the finer springs of action are fed. Generosity, mercy, pity, friendship,
devotion, sacrifice, flow from this one source, which conscious effort
may help to replenish, but which conscious or unconscious borrowing
can never exhaust.
In his love for others lay the absorbing passion of Harper’s life. It
was a love which begot him the strongest and most enduring of
friendships, and it was a love which carried his influence, and the
sweet purpose of his life, away out beyond the circles of those with
whom he was in daily association to where the tide of affection is
wont to ebb, or, apparently, wastes itself in the reefs and shallows
which abound. Man, woman, or child, he felt their kinship to the race;
their lives were related to his life; misfortune only heightened his
sympathy, and failure his compassion. Day after day gave new
expression to the wealth of generous purpose in that great human
heart of his. It dictated the fields into which he directed his activities;
it inspired his impulses, and was the sustaining power in his work.
Nor was this, with Harper, a blind love, an unreasoned passion. On
the contrary, whatever its origin, it derived its strength from a
carefully thought out philosophy of life, a philosophy based on a belief
in a divine order and purpose in the universe, and in the sanctity of
individual lives. He had faith in both God and man, and he held that
the will of the one could only be fulfilled as it was realized in the life
of the other. This belief explains his efforts on behalf of individuals, it
interprets the views he held on such questions as those of social and
political reform.
He loved men because of the belief he had in their natures. “After
all,” he writes, “it is not the external appearance of a man, nor what
he says or does, that ought to excite our admiration or distrust, but
that inner personality, the individuality, the soul, which is ‘the all and
in all,’ and of which appearances are but imperfect representations
and expressions.” He was not a man given to professions, or to the
public performance of good deeds; in fact, the being seen of men
caused him to hesitate in the doing of much which a less sensitive
nature would have allowed. He did not shrink, however, from
manifesting a personal interest in lives which seemed to demand it of
him, or from revealing his purpose to those whom he knew could
appreciate it aright.
One incident, among two or three which he has recorded, but one
of a great many known only to those with whom the occasion was
shared, is sufficient to illustrate how practical expression was given to
this belief. It occurred within a short time after he had left the
university, and before he had entered upon his journalistic career.
“I was returning home one night after a social evening, when I
saw a young man in the hands of a policeman. He was what some
people would have called a ‘bad boy,’ kept rather doubtful company,
and was under arrest for having raised a disturbance during a
drunken row. Well, I managed to get the boy, who was about
eighteen years of age, out of the cells on bail, and, in company with a
fellow who had been ‘painting the town’ with him, I undertook to take
him home. I contrived, after some time, to get rid of his ‘pal,’ and, as
soon as the boy was sober enough, I undertook to find out whether
he had a conscience.
“After walking about the streets with him for a couple of hours in
the beautiful moonlight, by the aid of a power which was certainly not
my own, I discovered that he had; and the boy opened up his heart
to me. I showed him the uselessness and folly of the life into which
he was rapidly drifting, and, in a voice convulsed with sobs, he told
me that what I said was true. My own eyes moistened as he
confessed what a fool he was. He concluded by promising me in a
voice and with a pressure of the hand which meant truth, that he
would never touch a drop of liquor again. From the frank manner in
which he meets my eyes when I now see him occasionally, I believe
that he has thoroughly reformed. That night, as I went home, I knew
that one prayer had not been in vain.”
For society as a whole, as for its individual members, his aim was
a constant betterment.
“There are so few men who couple the capacity for appreciating
the troubles of struggling humanity with an earnest desire to remove
them, that I can see in such a life a tremendous power for good, and,
after all, is not that the highest ideal a man can hold before him?”
In this sentence, penned in reference to another, he wrote of
himself more truly than he knew. His journals are full of passages
which disclose his “capacity to appreciate,” and his “earnest desire to
remove,” the obstacles which thwart the upward and onward progress
of men engaged in the competitive rivalries of the world, and in the
struggle for daily bread. Whether it was pursuing an uncongenial task
in the wilds of Muskoka, or immersed in the cares and unrest of
journalism, or busied in research for material from which to construct
an article for the Labour Gazette, a human interest in the life and the
lot of the mass of men was ever before him, and a purpose to
understand and improve that lot his aim.
“During the course of my stay here,” he writes of Muskoka, in the
winter of 1895, “I have had some chance to notice the type of
inhabitants of this inhospitable district. First and foremost come the
lumbermen, not the miners who live in the town, but the stout fellows
in smock and jersey, with their pants shoved into stockings, which are
in turn encased in stout rubbers. Overcoats are scarce, they don’t
seem to be needed. Altogether, though these fellows lead a hard life,
and are often coarse and dissipated, they have opinions of their own,
and must be reckoned with by the rulers of the country.
“Next comes the Muskoka farmer living in his shanty, for that is
pretty much the rule, although there is, of course, an occasional
farmhouse of more pretentious appearance, and drawing a bare
livelihood by his constant toil with antiquated implements; most of the
hay (the chief product, since it requires little care,) being cut by the
scythe on patches of land cleared by years of toil, and in most cases
thickly strewn with rocks, the only satisfaction that they have in their
poverty being that they are independent.
“It is difficult to conceive of culture and refinement under such
circumstances. It may be well, however, to have one part of our
population comparatively free from the two dangerous influences of
our time, riches and luxury on the one hand, and, on the other,
embittered and ignorant combinations actuated by selfish interests
and swayed too largely by demagogues.
“My sojourn here, though not pleasant and not profitable from a
business point of view, has opened an extensive field of thought. Of
my companions the most interesting was the lumberman whose wife
was sick, and who as a result was leaving the woods. I was quite
interested by his ideas of human life, although they were not given in
a scientific way. He was evidently a man of energy; one who took life
seriously and who had his share of troubles. It was pathetic to hear
the way he spoke of how his wife’s family usually died at about
twenty-four years of age, how his wife was now at that age and was
sick. In fact, there are worse places than the lumber woods for the
study of man.”
In the spring of 1898 he was rejoiced at having the opportunity of
conducting a more or less extended inquiry into the conditions of
working men in the several trades.
“The Mail,” he writes, “intends, during the coming summer, to
publish a series of articles concerning the conditions, social, moral and
economic, governing each of the various trades, the facts to be
gathered by personal observation and enquiry from journeymen,
apprentices, employers and employees. The work is to be a feature of
each day’s paper, and, mirabile dictu, the entire charge of the matter,
design and detail, has been handed over to me. I need not say that I
am pleased. I have at once an opportunity of examining into the
industrial and sociological conditions of the city and province, and
possibly of doing good to my fellow men as the result of these
observations. Incidentally, also, I have an opportunity of
strengthening myself in my own profession, although that is a thing
that one can do in journalism no matter what line of work one is
pursuing. Roughly described, the aim of the series of sketches is to
indicate to the parent what qualifications are required for, and what
returns are to be expected from, the several vocations, in order that
he may the better decide what to do with his boy or girl. I appreciate
the responsibility which the work places upon me, and pray that I
may be able to meet it.”
The articles which were written by Harper, then twenty-four years
of age, and which appeared under the caption “What to do with your
boy or girl,” were continued in the Mail from day to day for several
months, and attracted very considerable attention at the time. They
disclose a remarkable ability to get at facts, and the strongest
sympathy with the end in view, and constitute a not unimportant
contribution to the scanty literature which has thus far appeared,
having to do with industrial and labour conditions in the Dominion.
The human interest which made even the dry language of statutes
to glow with animation for him, is abundantly apparent from the
following passages in reference to some of his work in the department
of labour:
“I spent most of the day in the Library of Parliament, reading up
the provincial acts concerning mining. The thing which impressed me,
as I read, was the uninviting nature of the task of the miner, cut off
from the light of day, hewing away in the bowels of the earth,
exposed to the danger of cave-ins, explosions, and a living
entombment, as the result of carelessness on the part of his
employers, or his associates, or the will of nature. How can such men,
if they are crowded down almost to the margin of subsistence,
develop a roseate view of life! Ever facing almost terrorizing
conditions, they must become brave, sturdy, self-reliant and earnest
enough, but how can they fail to be out of sympathy with the shams,
hypocrisies and dilettantisms of modern society!”
And again:
“At the office, I have been much interested in working upon the
article on the Fisheries of Canada, inasmuch as it has shown to me a
sturdy class of men toiling under conditions of hardship and danger
for what is comparatively a small return. Doubtless the isolation of the
fishing villages, the system of part proprietorship, and the passion for
a sea-faring life, account for the relative immobility of the population.
“I am becoming more and more convinced daily of the fact that
this country is going through a transition stage which must influence
it to the bottom. The use of machinery, the weakening of the artisan
by removing the rewards of skill, the work and wages of girls, the
prevalence of piece work and its results, the effects of pauper and
convict labour, and a thousand other problems are brought daily
before my notice in terms of flesh and blood.
“It is important to know and understand all sorts and conditions of
men if society as a whole is to be led towards what is better. Certainly
the ‘better class of people’ need leading as well as the others, for with
them the opportunity offered by leisure is too often wasted in
dilettantism and folly.”
To “society,” in the highly specialized meaning of that word, a
reference may not be out of place. In its ambitions, its mandates,
Harper saw but little which made for the development of true
manhood or womanhood, while he saw much which aimed directly at
the destruction of both. There was never any one who enjoyed more
the pleasure of good company, whose temperament, frank, hearty
and mirthful, and whose manner, courteous and sincere, made him a
more welcome guest wherever he went. It was no affectation,
therefore, which caused Harper to feel as he did; it was his belief in
the true purpose of life. What to some, and to himself, was a pastime,
he saw, to others, was becoming an end; instead of developing, it
was robbing, natures of their finer sensibilities. Many of its
conventions were wholly artificial, some of its relationships altogether
false. The following short sentences are sufficient to reveal this view:
“Social engagements may, I think, be a healthy relaxation, if kept
in their place, and if one does not forget to keep hold of one’s self,
and remembers the force of example. With many people here in
Ottawa, I fear the social round is becoming an end in itself, and
therefore a danger to themselves and others.
“I am coming to the conclusion that if a man is to wield any
influence worth while in this world, he has to cut this folly out of his
life. The past fortnight has shown me how impossible it is for a man
to do what the social world expects of him, and do justice to himself.”
Commenting on a wedding notice which appeared in a local paper,
he writes:
“So spoke the society editor this morning. The important thing,
really, was the happy union for life of two loving hearts. Apparently
what the public is supposed to be interested in, is the gown of white
something or other. It may be salutary, as a means of developing an
æsthetic taste generally, to have space in our public prints for such
trifles. For my own part, I often think the world would be better and
saner if the society editor had never been born.”
And of the “better part,” in a personal letter to a friend:
“If you will pardon me for making the remark, I was very pleased
to see the lively interest your sisters take in the great work of
improving the condition of the masses. It is one which is bound to
widen their sympathies, and remove any possibility of their becoming
enthralled by the chains of hollow conventionality, which, more than
anything else, prevents the development of true womanhood, under
the conditions of our modern society.”
How, according to his view, true womanhood might be developed,
may be gathered from a letter written by Harper to one of his sisters
a short time before his death. It is one of many home letters which
might be quoted, but it may be taken by itself as characteristic. In
speaking of his love for others, its reproduction here may not be out
of place:
“Ottawa, Oct. 4th, 1901.

“My Dear L——:


“I am not writing to give you news, for there is little to give. I have
been having a quiet happy little evening all by myself, and I thought I
could not do better than let you into the secret of my happiness. I
think I have told you before that I am an admirer of the high-
mindedness of Matthew Arnold, ‘the apostle of sweetness and light.’
Latterly, I have been taking a great deal of true pleasure from his
poems, and one of the best of them, The Buried Life, I have just
finished reading, not for the first time, for they stand many readings;
and I am sure you would find it hopeful and inspiring. I wish you
would read Matthew Arnold’s works, particularly some of the poems,
such as Rugby Chapel, Dover Beach, Self Dependence and The Buried
Life; the last, most of all. There is a good deal of the stoical Greek
about Matthew Arnold, but his is a beautiful, noble, pure mind whose
example makes the pursuit of perfection meaningful, and beautiful to
contemplate. There is much in his philosophy with which you
doubtless will not agree, but there is a richness, beauty and purity,
which you will find most inspiring.
“And this brings me still to another question. Why should not you
and E—— turn this winter to profit by spending a part of every day
reading aloud to each other, choosing, preferably, such works as The
Idylls of the King, Matthew Arnold’s poems, or other writings of the
great masters in literature which take one away from the sordidness
of life, and tend to develop the best that is in one. This, with an
adulteration of fiction, would make the winter very profitable as well
as very enjoyable to you both. When E—— can find time, he could
read with you, and direct your reading course. My dear L——, I am
becoming more and more convinced every day that the most
important duty we have is the moulding of our character; for it is in
the strength and richness of our character that we obtain the title to
self-respect, and are able to influence others. It is by bringing
ourselves into closer contact with the highest thought that we are
going to be enabled to obtain high-mindedness and purity ourselves.
There is a world of truth in the statement, ‘Blessed are the pure in
heart, for they shall see God,’ and these things of which I speak are
some of the ways of attaining that purity of heart which makes life
richer, deeper and happier.
“Longfellow, in his prose romance, Hyperion, has something of
what I have in mind, when he says:
“‘It is the part of an indiscreet and troublesome ambition to care
too much about fame, about what the world says of us; to be always
looking into the faces of others for approval; to be always anxious for
the effect of what we do and say; to be always shouting to hear the
echo of our own voices. If you look about you, you will see men who
are wearing life away in feverish anxiety of fame, and the last we shall
ever hear of them will be the funeral bell which tolls them to their
early graves! Unhappy men and unsuccessful! because their purpose
is, not to accomplish well their task, but to clutch the “fantasy and
trick of fame”; and they go to their graves with purposes
unaccomplished, and wishes unfulfilled. Better for them, and for the
world in their example, had they known how to wait! Believe me, the
talent of success is nothing more than doing what you can do well;
and doing well whatever you do,—without a thought of fame. If it
comes at all, it will come because it is deserved, not because it is
sought after. And, moreover, there will be no misgivings, no
disappointment, no hasty, feverish, exhausting excitement.’
“This is rather a heavy quotation for a letter, but I wished you to
catch the thought, you will find it in the chapter in Hyperion on
Literary Fame. You will see the truth of it, if you allow your mind to
dwell upon it for a moment. Longfellow has no thought of
discouraging ambition. Far from it. He simply wants to emphasize the
folly of hoping for fame which is undeserved, and, as he points out,
the way to deserve it is by doing well what is to be done. But as you
are not fame hunting, it is not the fame part of it that I wish to dwell
upon here, so much as the parallel thought, that it is the inner life,
the inner strength which comes from resolute effort and familiarity
with the best thought, which tells, and which makes for true
happiness.
“I have often told you that your worst danger is your tendency to
worry, a tendency which is based, I know, upon the depth of the
interest which you take in those who are dear to you. What you must
do is to prevent that tendency from casting a shadow over your life. I
have a picture of you—a copy which W—— enlarged from the little
sunbeam of you, with a big white hat, you remember,—in a gold
frame over my desk. It is much admired, and I am proud to introduce
it as my sister. As I look at it, I can see my dear little sister, bright,
happy and devoted, and now I don’t want to think of her with any
unnecessary cares. Now do be good, and you and E—— try and make
the winter profitable to both of you. Take walks, get exercise in the
open air, be cheerful, read, and generally try and make life happier by
the means which you have at hand. I am neither scolding nor
lecturing, and I have said nothing which you do not already know, but
somehow to-night, you have been running in my mind, and I wanted
to tell you what I thought and wished, so that, in due course of time,
you will look back to the winter of 1901 as one of the happiest
chapters in your life. I am sorry that, when we were in Barrie, the
shadow of memories and the pressure of many things must have
made me seem selfish and not kind enough to my sisters, but I need
not tell you, L——, that your happiness is dear to me.
“And now I must close. So good-night, my dear little sister.
“With much love,
“Ever your affectionate brother,
“Bert.”
Just how characteristic this letter is of the interest taken by Harper
in the welfare and happiness of those to whom he was united by the
closest of ties, will be apparent from another letter, written many
months previous, to a brother in New York, after returning from a
short visit to that city. It reveals the same earnest endeavour of a life
to impart its own secret to the lives of others, and to establish a
standard of happiness which could bring no deceptions. Its practical
common sense will make it no less commendable as an evidence of
the truest affection.
He writes:
“Ottawa, Dec. 30, 1900.

“My Dear Will:


“Since returning to Ottawa there has been little happening that
would be of interest to you. I have been busy enough, and have
managed to control a tendency, fostered by the invitations of a
number of kind people here, and my own disposition, to be drawn
into the social whirl. It is weak, and life is earnest, so I have decided
to do with as little of it as possible. No man who desires to make
progress in this world, can hope to do so if he squanders his
evenings. There are two ways in which a man may equip himself so
that he may be in the van of progress:—first, by strengthening his
own mind through a study of what is and has been in the minds of
great men of thought,—this, one can do from books;—secondly, by
pursuing positive original work along the special line to which he has
devoted himself. These things I am attempting to do. The difficulty
lies in selection. What we have to do is to get away from the
semblances, and get at the realities of life.
“Of Carlyle’s Hero Worship, I have already spoken to you. It is
healthy and sturdy. I am now reading Carlyle’s Past and Present, and
do not know anything in literature more wholesome or worth reading.
Do not neglect to read it. Men of the stamp of Carlyle, Emerson and
Matthew Arnold go to the root of questions, and their books will do
you one hundred times as much good as all the novels which are
going the rounds. Every man owes it to himself to supply his mind
with the best material available, and, although Carlyle may seem a
little heavy in parts, where one may not have become familiar with
the subject matter he refers to, you will find the influence of his
sturdy personality upon your own views of life.
“With regard to the second point,—work along one’s own special
line,—I am plodding along at work in the field of economics, and hope
to be able to get out a book in the more or less near future. You know
best what will be profitable for you. What I would suggest is, that you
lose no opportunity of familiarizing yourself with the best writings on
architecture; that you devote time and thought to studying
architectural models of buildings as they are, and otherwise; and, that
you take every opportunity to attend lectures or discussions where
architectural subjects are being considered. In this way you will find
your interest in your work, and in life generally, as well as your
usefulness to your employers, increasing at a surprising rate. I know
how hard it is for a man living in a great, interesting place like New
York, to do deliberate, consecutive work, and to keep control of
himself and his time, but he must do this, if he is going to get along.
Life is real and earnest, and a man who is going to hold up his end in
dull times, and in the autumn of life, must take every opportunity to
equip himself, and to save his dollars. A man need not be mean, he
can go to things worth going to, he can dress decently, and hold up
his end generally; but there are lots of things upon which money is
often spent, which are absolute folly. Money is hard to make, and a
man cannot justify himself in throwing it away.
“I hope you will pardon all this which may appear like a lecture. It
is not, I can assure you, dear old Will. It is simply a few conclusions
which I have come to, and which I believe to be absolutely true. If
they are, why should we not follow them? I want us both to live
fruitful and useful lives, and it is by such conscious, deliberate work as
I have referred to, that we both can do it. Let us cut asunder what of
empty, unprofitable conviviality, and the like, may have grown into our
lives, and let us live so that when we are old men,—if we are spared,
—we may look back upon our lives without regret, and feel that we
have been worthy of the best that is in us, and of the trust which our
dear parents placed in us.
“My visit to New York was thoroughly profitable; it has given me
much food for thought, and has enabled me to see some things more
clearly than ever before. I cannot tell you of all the impressions New
York brought, and has left upon me. I have never quite managed to
shake off the attitude of mind of a student, and I find myself
constantly weaving my experiences in New York into my philosophy of
life. The two events which seem to stand out most clearly are the visit
to the Art Museum, and the concert at the Metropolitan. That was a
glorious day, for it showed how men in the rush and flurry of business
life have at hand the means of soul purifying and refreshment in art
and music, two great agencies which bring men’s minds back from
semblances to truth. Will you ever forget the music we heard? The
singing of Rossini’s Stabat Mater was to me like wandering through a
sea of dreams, beautiful yet sad. Greatest of all, I thought, was
Nordica’s Inflammatus, a soul-stirring song, splendidly set off by the
orchestra and chorus, and which stirred the vast audience to its
depths. It was the great victory of the evening. How strong must be
the satisfaction of the possession of so magnificent a voice, both in
the capacity to interpret such beautiful music, and in the ability to
thrill and purge the human soul. For is it not the case that great music
ever does this? I know little of the technique of music, but for years I
have felt its influence upon me for good.
“Every hour of my visit was profitable, and I need not say that it
would have been a blind, stupid ramble without your assistance. I
know what it meant in sacrifice of time and hard-earned money to
you. I would have liked to have controlled your generosity. However, I
know the spirit which moved you, and I am deeply grateful to you.
“And now, my dear brother Will, I trust that this New Year which
ushers in a new century, will bring to you true happiness, and the
accomplishment of your most worthy ambitions.
“Your affectionate brother,
“Bert.”
It is not surprising to find in a remote corner of the diary of a man
whose feelings were so genuine, and sympathies so sincere, such
mention as the following, of an evening spent with “The
Woodcutters,” a society he had helped to organize the year after he
left the university, and the purposes of which will be sufficiently clear
from the reference:
“We went to old Thomas Mahoney’s where we worked hard from
about 8:30 to 11:00 P. M., sawing and splitting wood. The family
consisted of Mrs. Mahoney, an old woman of about sixty or sixty-five,
and her daughter. The daughter, who is half-witted, goes out washing
and scrubbing, while the old lady has to saw and split all the wood
necessary to keep their hovel warm, it being situated in an exposed
place on the edge of the common. The interior does not betoken
wealth, but the old woman and her daughter seem to be not
unhappy, this probably because of their having come from the
Emerald Isle. I shall try and follow up the acquaintance with a view to
discovering to what causes their poverty is due. This institution is a
good one, for besides the hard work, it affords undoubtedly a good
way of helping the deserving poor, and gives one a splendid chance
for economic study.”
Nor is the following entry less surprising, written, as it was, in part
justification of himself, lest he should have erred in having aided
financially, and in other ways, a deaf-mute boy who came to him for
assistance, but into whose circumstances he had not, at the time, had
opportunity of making a personal inquiry. A file of correspondence
with the Charity Organizations officer, and the superintendent of The
Institute for the Deaf and Dumb, reveals the care with which he
subsequently satisfied his conscience in this particular case of one
who belonged to “the dependent and neglected poor.”
“Whatever may be held regarding the unwisdom of a paternal
system with regard to society generally,—and while my own best
judgment inclines me to be individualistic,—I have a strong sympathy
with those who are robbed of the use of their senses, to whom so
much of the beauty of God’s world is as a sealed book. I felt this
strongly as I dictated the letters which he could not hear. The bright
intelligence on his face as he learned my intention, and indicated his
approval of some of my suggestions, was beautiful to see. I trust that
he will not prove a disappointment, and that I shall not be deceived.”
Harper had the faith which led him at times to cast his bread upon
the waters. Had he been asked why he did so, he would have replied,
because he loved to. If questioned further, he would, with Tennyson,
have said:

“That nothing walks with aimless feet;


That not one life shall be destroy’d,
Or cast as rubbish to the void,
When God hath made the pile complete.”
SOCIAL AND POLITICAL IDEALS

Few men of his years have thought as deeply as Harper did, or


had clearer perceptions, concerning conditions and forces which make
for happiness and progress in social life, and the development of
national greatness. Had he been spared he would have been an
earnest and practical reformer; silent as his voice is now, the words
he once uttered are not without their value to our day and generation.
He was a true patriot in sentiment and aspiration.
Harper loved his country and its people, and in all that he
undertook, which was of a public nature, he was animated by an
enthusiasm for the common good. Of the self-imposed tasks he had
undertaken in addition to his regular duties at the department of
labour, and in each of which he had made some progress, were
treatises on “Labour Legislation in Canada,” and the “Outlines of an
Industrial History of the Dominion.” Among his contributions to
publications other than the Labour Gazette, was a short essay on
Colleges and Citizenship in a Christmas number of the Acta Victoriana
of Victoria College, one or two articles in The Commonwealth on
Canada’s Attitude Towards Labour, and an uncompleted monograph,
intended for publication, on The Study of Political Economy in the
High Schools. He was president of the Ottawa Social Science Club,
secretary-treasurer of the Ottawa section of the University of Toronto
Alumni Association, and an active member of the Ottawa Literary and
Scientific Society. He was at the same time promoting the
organization of a University Club, a plan of which he had carefully
prepared, and the object of which was to bring the university men of
the city into closer touch with each other, and make their influence
more widely felt in the civic and social life of the community.
The background of all Harper’s thinking on social and political
problems was coloured by his belief in a moral order; in the forefront
was ever the individual proclaiming this order, and seeking to realize it
in his own life. Institutions of whatever kind, whether national or
religious, were to him of human creation. Their usefulness was in
proportion to the degree to which they helped to give expression to
the unseen purpose in the universe. Nature and man, alone, were
divine. It followed logically from this that man’s work among his
fellows in the world was to discover the moral order, reveal and
maintain it, so far as within him the power lay. Harmony with this
order meant happiness, want of harmony, whether by the individual
or the state, unhappiness. In this view, the individual is vastly superior
to any institution he and his fellows may construct, superior as an
end, and as a means to an end. If a set of conditions exist which are
counter to the moral order, or obstruct its fulfillment in the lives of
men, these conditions should be changed, the individual should not
be sacrificed to them. On the other hand, change may be, and ought
to be accomplished more by men than by institutions, and can only be
accomplished in the degree to which beliefs become active, potent
factors in individual lives.
It is true that human knowledge is limited, and that the purpose of
God is infinite, and so there may rightly be among men differences of
opinion as to what, under any circumstances, are the ends to be
sought, and the best means to attain those ends; and humility may
well characterize all expressions of belief relative thereto; but, to the
extent of knowledge gained, the ground underfoot is firm, and
humility will not excuse the want of assertion, where right reason is
set at naught by wrongful conduct. Moreover, there is much on which
men can be agreed, broken arcs visible to all, though the perfect
round is seen by none. There are right and wrong, truth and
falsehood, honesty and dishonesty, love and hate, purity and vice,
honour and dishonour, and the difference between them is as
apparent and real as the difference ’twixt day and night, albeit, now
and again, a twilight of uncertainty may render doubtful the confines
of separation. Harper’s exclusive insistence was only upon what in this
way was acceptable to all; and knowing that it was acceptable, he
was sure the appeal would find a response in those to whom it was
addressed. Whatever men might be in seeking privately their own
selfish ends, their belief in a moral order was apparent once action
became collective; the public had a conscience to which it was
generally true, though men at times might seem to betray their better
selves; and public opinion might be expected to guard for society as a
whole a right for which individuals sometimes lost respect. How great,
therefore, was the responsibility upon those who had the capacity, or
opportunity, to see that public opinion was rightly formed and
directed, and that, in social and political affairs, truth and right should
be made to prevail!
This insistence upon the recognition of responsibility in those
favoured by educational training or opportunity, is well brought out in
a paragraph or two in the short essay on Colleges and Citizenship.
Referring to a quotation from Sir Alfred Milner’s life of Arnold Toynbee,
in which “the estrangement of the men of thought from the leaders of
the people” is referred to as having constituted, in Toynbee’s mind,
the great danger of the democratic upheaval of the time, Harper
writes:
“People in Canada to-day are doubtless not so anxious about
democratic upheaval. Fortunately the aggravated conditions of an old
world metropolis have not yet been developed. The task is easier; the
duty none the less imperative. It is more possible to secure the
confidence of men who are not embittered by the pangs of slumdom.
But because conditions here are not as distressing as they have been
and are elsewhere, it is surely no less desirable, with a view to
promoting industrial peace and healthy national development, that the
men who have opportunity and capacity for the serious study of social
and economic problems, should not allow themselves to become
fenced off by a wall of indifference of their own creation from those to
whom the mass of the people look for direction, inspiration and
suggestion. It is reasonable to expect that he who claims to be
engaged in the pursuit of truth should not give countenance to what
makes for social disorder and national decay.
“Men are as much open to reason, as liable to accept truth, when
they have been convinced of it, as when Arnold Toynbee studied,
lectured and wrote. They are as prone to prefer what is genuine to
what is pretense and dissimulation. Surely a peculiar obligation to see
that men think rightly and act sanely, devolves upon those whose
vantage ground should enable them to distinguish what is genuine.
Sir Alfred Milner, having in mind the earnest friend of his
undergraduate days, said six years ago to the members of Toynbee
Hall: ‘I do not go so far as to say that what Oxford thinks to-day
England will do to-morrow, but certainly any new movement of
thought at the universities in these days rapidly finds its echo in the
press and in public opinion.’ Indeed, is there not fair ground for the
belief that much of the virtue which has marked the conduct of Great
Britain’s High Commissioner at Cape Town, throughout the South
African crisis is due to association with the high-minded student, who,
in the congenial atmosphere of Oxford, did not forget that he was a
citizen?”
It was his belief in the importance of men recognizing their duties
as citizens, and being able to discharge these duties with intelligence
and for the common good, which led Harper to prepare a scheme for
the teaching of Political Economy in the high schools. The merits of
this plan he had summarized as follows:
“Such a study would tend to remedy the great evil of democratic
institutions, the susceptibility of the masses to the influence of
demagogues, and their liability to misconstrue the relations of cause
and effect because of ignorance. It would tend to promote mental
development, especially in the direction of individual thought. It
would tend to raise the standard of such studies in the universities,
and this in time would react upon the high schools in the way of
more competent teachers, and, in the end, create great possibilities
for the prosecution of research in this all important branch of
knowledge in our country. It would tend to remedy social evils by
giving the philanthropist and the public generally, something like an
accurate idea of the true state of society. It would react beneficially
upon the government, which, with a more critical observation, would
be more careful in its actions.”
He modestly concludes,
“I simply put forward a proposal which, I think, if carried out,
would tend to modify the evils fostered by ignorance. I have to a
great extent taken it as an axiom that whatever tends to disseminate
knowledge, to advance truth, and to develop the intellect, cannot be
wrong, and should be accepted by all liberal minded men; and this, I
think, would be the result of the study of Political Economy in our
high schools.”
From the notes he had made, and from what is contained in the
body of the article, it would appear that he had in mind a course on
Civic Ethics, quite as much as on the Elements of Economics, and
that he would have liked, if possible, to have had a beginning made
in the public schools.
Scattered throughout his diary are such observations as the
following:
“I am becoming more and more convinced that the true rulers of
the nation are outside of our parliaments and our law courts, and
that the safety of society lies in informing those who form public
opinion.”
“I feel more and more the necessity of emphasizing the
importance of the scientific study of economic and political problems
in a country in which every man has the franchise, and is supposed
to be in a position to express an intelligent opinion upon public
questions, and particularly at a time when labour and kindred
problems are prominent in the public mind.”

“A man who truly loves his country should be disposed to do his


utmost to see it rightly governed.”

“The poor downtrodden have more to hope for from men who,
having a specialized training in the operation of social forces, apply
themselves to the proper remedy, than from all the windy, ultra-
radical demagogues.”
“It is the alienation—partly, no doubt, due to indolence—of the
men of thought from those from whom the mass of the people
habitually receive their inspiration, which accounts for much of the
crass ignorance and purposeless passion of the people and their
demagogues.”

“For myself, I have long deplored the foolish worship of this or


that set of political machinery by apparently well intentioned men. In
Matthew Arnold’s Culture and Anarchy, there is a solution for much
of our distressing bluster and blunder. With confidence in the
possibilities of man and a resolute endeavour to strive towards
perfection, to allow our best consciousness to play about our stock
notions and our painful conditions of society, we should be able to
see the real value of things, and ultimately to approach more nearly
to right and truth. If our well-intentioned, but perhaps ‘over-
Hebraized’ ultra-socialists and ultra-individualists would have
perfection more prominently in mind than the pet panacea they have
ever before them, and would allow their best consciousness to play
about their notions of society and its evils, there would be less of
viciousness and ignorance in their propaganda.”
“The fallacy of political panaceas! And the vital importance of
improving the individual morally, and encouraging him to elevate his
ideals! What a splendid thing it would be if every labour agitator,
every demagogue, every member of parliament, every professor,
teacher and minister, and, in fact, every one who exerts an influence
upon the public mind, could realize and act upon the truth which
came to Alton Locke after his life of bitter trial: ‘My only ground was
now the bare realities of life and duty. The problem of society—self-
sacrifice, the one solution.’”

“We are too apt to regard social phenomena as if they are


entities in themselves, instead of incidents in the development of
society, a fact which a man who is amidst the strife of existing social
and economic conditions should not lose sight of.”

“I am continually impressed with the wisdom of keeping a mind


open to suggestion and impressions from the men one meets in the
ordinary course of life, in fine, the importance of keeping an open
mind. If one can accomplish this, even the din of ‘the world’s most
crowded streets’ becomes interesting and instructive, even beautiful,
because of the opportunities of seeing truth and discovering the
remedy for evils.”
“Justice and truth must prevail over tyranny and ignorance.”

The true mind is revealed in its unconscious moments, and it is,


therefore, from passages like these, casually expressed, and
constantly recurring in much that he wrote, which was of a private
nature, that his real views and beliefs are to be gathered. One or
two other passages in a similar vein will disclose these views more
fully.
During Christmas week of 1900 he visited New York for the first
time. Of the many impressions made upon his mind, the contrasts of
wealth and poverty, and all that they implied, were to him more real
than aught else.
“What was particularly irritating to me,” he writes in his journal,
after returning from this trip, “was the constant evidence of the
power of money rule in that throbbing metropolis. The story is
written, even on the store signs on Broadway, that this, the greatest
commercial city in America, is practically owned by monied persons,
whose tastes and ambitions strike one as being essentially low,
mean and vulgar. I felt strongly a growing pride in British institutions
and British character compared with what I saw about me. The
ground taken by Mr. Mulock, on behalf of labour, came strongly
before me. I felt that selfishness must be reckoned with in the
solution of social problems. What is to be hoped is that strong men
may be brought to see that right legislation is good politics, that
they may thus be persuaded to lend their aid to those who hope to
avoid the growth in Canada of a corrupt system by which the power
is in the hands of the octopus who owns the money bags, and who
fattens on the blood of the people whom he crowds under him.
There is luxury and magnificence on Fifth Avenue, but I envied not
the proud possessors of those costly mansions. I want naught but
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!

ebookball.com

You might also like