Programming in Java Sachin Malhotra install
download
https://textbookfull.com/product/programming-in-java-sachin-
malhotra/
Download more ebook instantly today - get yours now at textbookfull.com
We believe these products will be a great fit for you. Click
the link to download now, or visit textbookfull.com
to discover even more!
Java Programming Joyce Farrell
https://textbookfull.com/product/java-programming-joyce-farrell/
Java Programming Joyce Farrell
https://textbookfull.com/product/java-programming-joyce-
farrell-2/
Computer Graphics Programming in OpenGL with Java
Gordon
https://textbookfull.com/product/computer-graphics-programming-
in-opengl-with-java-gordon/
Murach s Java Programming Joel Murach
https://textbookfull.com/product/murach-s-java-programming-joel-
murach/
Learning Java An Introduction to Real World Programming
with Java Marc Loy
https://textbookfull.com/product/learning-java-an-introduction-
to-real-world-programming-with-java-marc-loy/
Learning Java Beginning programming with java for
dummies First Edition John Bach
https://textbookfull.com/product/learning-java-beginning-
programming-with-java-for-dummies-first-edition-john-bach/
Java Network Programming Fourth Edition Harold Elliotte
https://textbookfull.com/product/java-network-programming-fourth-
edition-harold-elliotte/
Java Performance In Depth Advice for Tuning and
Programming Java 8 11 and Beyond 2nd Edition Scott Oaks
https://textbookfull.com/product/java-performance-in-depth-
advice-for-tuning-and-programming-java-8-11-and-beyond-2nd-
edition-scott-oaks/
Introduction to Programming in Java An
Interdisciplinary Approach 2nd Edition Robert Sedgewick
https://textbookfull.com/product/introduction-to-programming-in-
java-an-interdisciplinary-approach-2nd-edition-robert-sedgewick/
Programming in
Java
Second Edition
SACHIN MALHOTRA
Associate Professor
IMS, Ghaziabad
SAURABH CHOUDHARY
Formerly, Head
IT Department
IMS, Ghaziabad
1
3
Oxford University Press is a department of the University of Oxford.
It furthers the University’s objective of excellence in research, scholarship,
and education by publishing worldwide. Oxford is a registered trade mark of
Oxford University Press in the UK and in certain other countries.
Published in India by
Oxford University Press
YMCA Library Building, 1 Jai Singh Road, New Delhi 110001, India
© Oxford University Press 2010, 2014
The moral rights of the author/s have been asserted.
First Edition published in 2010
Second Edition published in 2014
All rights reserved. No part of this publication may be reproduced, stored in
a retrieval system, or transmitted, in any form or by any means, without the
prior permission in writing of Oxford University Press, or as expressly permitted
by law, by licence, or under terms agreed with the appropriate reprographics
rights organization. Enquiries concerning reproduction outside the scope of the
above should be sent to the Rights Department, Oxford University Press, at the
address above.
You must not circulate this work in any other form
and you must impose this same condition on any acquirer.
ISBN-13: 978-0-19-809485-2
ISBN-10: 0-19-809485-X
Typeset in Times New Roman
by Sukuvisa Enterprises
Printed in India by Yash Printographics, Noida 201301
Dedicated
to
Our Parents
About the Authors
Sachin Malhotra is currently Associate Professor in the IT department of IMS Ghaziabad. He has more
than a decade long experience in mentoring students on developing Java applications as well as training
practising professionals in the field of Java. He has also designed and conducted various corporate
trainings in Java and networking.
Saurabh Choudhary is currently a practising IT consultant and corporate trainer. He has more than 12
years of experience in industry, academia, and consultancy. He has worked on positions of eminence
at IMS Ghaziabad as Head of IT department and Dean Academics (University Campus). His areas of
expertise include Java, Database Management System, and Information Systems.
Testimonials
From pervasive computing to communications industry, medical science to aerospace, Java is
gaining a foothold in every domain. Programming in Java has been written to arouse the interest
even in a novice computer programmer to an expert, craving to sharpen his programming skills.
Pankaj Verma | Senior Software Engineer | OSI Inc.
It is definitely the best textbook on Java that I have run into. I highly recommend it.
Sachin Dhama | Team Lead | Accenture
Java is a very powerful language for developing enterprise applications. I am hopeful that this
book will provide a basic building platform for Java programmers to enhance their knowledge.
Awadhesh Kumar Katiyar | Technical Lead | HCL Technologies Ltd.
Java enables users to develop applications on the Internet for servers, desktops computers, and small
handheld devices. The future of computing is being influenced by the Internet, and Java promises to
play a big part in it. This book is perfect for those who are seeking a clear understanding of Java. It
should allow the readers to create codes that are a lot clearer and are far more effective than before.
Saurabh Moondhra | Sr. Technical Consultant | SGT Inc
This is the most interesting Java programming book for beginners; at the same time, it is equally
good for intermediate readers as well. This should be your first Java book if you are learning
from scratch.
Pankaj Jain | Senior Manager | Bank of America
When you go through this book, you will gain confidence after completing each chapter. The
authors have written it in such a simple way covering each and every aspect of Java that anyone
can learn how to develop effective codes.
Rajeev Varshney | Lead Consultant | HCL NZ Ltd.
Preface to the First Edition
Java was primarily designed as a platform-independent language for usage in small consumer
electronic devices. It was derived from C++ but with a lot of difference. Java’s platform
independence originally addressed the problem that applications for embedded devices must
run on a wide variety of hardware. But since the Internet was emerging at the same time, Java
soon got adopted as an Internet language because of its portable nature. Major Internet browsers
such as Netscape Navigator and Microsoft Internet Explorer became Java-compatible, as it
effectively addressed the concerns for security by providing a firewall between web applications
and the computer. Eventually it became a standard programming language and is now being
used for creating a variety of applications including standalone applications, web applications,
enterprise-wide applications, and mobile games.
It can therefore be inferred that since its inception, Java has emerged as the most important
programming language. As the domain of Java is quite vast and a bit more complex than other
programming languages such as C, C++, and Visual Basic, it is observed that students and novice
programmers strive hard to comprehend its core concepts. Hence, a need for a book in this area,
which is both concise and simple, is a necessity.
About the Book
The book encapsulates the concepts of the latest version of Java, i.e. Java 6, encompassing a
comprehensive coverage of curriculum and industry expectations. It is useful for the students of
undergraduate and postgraduate courses of computer science and engineering and information
technology disciplines as well as for the instructors at various levels.
The book provides a thorough understanding of the basic concepts of object-oriented
programming principles and gradually moves on to the advanced concepts in Java. It includes
numerous examples, line-by-line description of examples, figures, explanation of concepts, and
key notes. Review questions and programming exercises are included as chapter-end exercises
to assess the learning outcomes. Every topic in the book is supported by examples followed
by an output and explanation. It also offers an appendix on general interview questions which
provides students an insight into the current requirements of the industry and allows them to
prepare accordingly.
The main features of this book include the following:
an exhaustive coverage of Java features such as operators, classes, objects, inheritance,
packages, and exception handling
comprehensive discussion on the latest features of Java such as enumerations, generics,
logging API, console class, StringBuilder class, NetworkInterface class, and assertions
latest features combined with core concepts such as multithreading, applets, AWT, and
swings
an introduction to the advanced concepts in Java such as servlets, RMI, and JDBC
Preface to theLab
Appendix A: Lab Manual—Java First Edition XIxi
Exercises
ACKNOWLEDGEMENTS
Several people have been instrumental throughout this tiring yet wonderful journey. First of all,
we would like to express our sincere gratitude to our families without whose support, patience,
and cooperation, this would not have been possible and we would not have been what we are
today. We are very thankful to Dr R. K. Bharadwaj, Head of our institution, for his inspirational
thoughts which inculcated urgency for writing this book. We are also thankful to our colleagues
for their endless support and suggestions during the entire process of writing this book.
Sachin Malhotra
Saurabh Choudhary
Preface to the Second Edition
Java is an easy-to-learn, versatile, robust, portable, and secure language with rich user interfaces.
It has set up new benchmarks in the software development world ranging from desktop to web-
based enterprise applications to mobile and embedded applications. Since its inception in 1995,
it has come a long way by continuously evolving itself and in the process, changing the style of
programming the world over. Java is not only found in laptops or data centres, it is also widely
used in cell phones, SIM cards, smart cards, printers, routers and switches, set-top boxes, ATMs,
and navigation systems, to name a few. According to Oracle, a staggering 1.1 billion desktops
and 3 billion cell phones are based on Java.
This second edition of Programming in Java confirms to Java Standard Edition 7, the latest
release since Oracle took over Sun Microsystems. It is significant in the sense that the last update
was six years back and this major release comes bundled with plenty of enhancements which were
overdue. To list a few noticeable enhancements, Java 7 includes support for strings in switch and
try-with-resources statements, improved multi-catch, binary numeric literals, numeric literals
with underscores, new APIs in NIO such as path and files, automatic resource management, and
much more. All the new topics are appropriately explained with suitable examples.
New to the Second Edition
This revised edition has been updated thoroughly with greater topical coverage as well as more
programming examples in every chapter, in addition to the confirmation to Java 7. Practically
every chapter, with the exception of Chapter 11, has been revisited to refine the text as much as
possible. The most noticeable changes are as follows:
New practical programming examples to show how Java is used in practice.
Enhanced coverage of servlets and JDBC along with an introduction to JSP, Java beans,
Jar files and enterprise Java beans
Enhanced coverage of swing components like JTree, JTable, layered pane, JDesktopPane,
internal frames, JColorChooser, JFileChooser, and JEditorPane
New classes of java.nio package and project coin language enhancements
Enhanced coverage of utility classes
Appendix B contains more interview questions to help students prepare for their interviews.
The second edition is supplemented with a rich online resource centre that contains chapter-
wise PPTs for teachers and additional practical programming examples for students.
Key Features
The most prominent feature of this book has been the line-by-line explanation section under
each program. They facilitate in-depth understanding of the whole program. We have retained
this feature in the second edition as it has been well appreciated by the users. Other noticeable
features include the following:
Preface to the Second Edition vii
A recap of object-oriented programming concepts before introducing the concepts of Java
Plenty of user-friendly programs and key notes at appropriate places to highlight important
concepts
A variety of end-chapter exercises that includes subjective as well as objective questions
Extended Chapter Material
The second edition includes the following changes:
Chapter 1, Introduction to OOP: Enhanced coverage of UML and its application in pictorial
representation of OOP concepts.
Chapter 2, Getting Started with Java: New sections about the features of Java 7 and how
to install JDK 1.7.
Chapter 3, Java Programming Constructs: Numeric literals with underscores, binary
numeric literals, and how to use strings in switch statements.
Chapter 4, Classes and Objects: New topics such as inner classes, variable length arguments,
arrays as return values from methods, and objects as arguments to and return type from methods.
It contains a practical problem on complex numbers to demonstrate how OOP concepts can be
put to practise.
Chapter 5, Inheritance: New section that highlights the differences between shadowing and
overriding. At the end of the chapter, there is a practical programming example on circle and
cylinder class.
Chapter 6, Interfaces, Packages, and Enumeration: Practical problem on banking concepts
to demonstrate the usage of packages in creating applications.
Chapter 7, Exception, Assertions, and Logging: try-with-resources and catching multiple
exceptions features which are new enhancements of Java 7.
Chapter 8, Multithreading in Java: Concrete practical example to show the use of threads
in applications.
Chapter 9, Input/Output, Serialization, and Cloning: New classes included in java.nio
package and how to perform cloning of objects.
Chapter 10, Generics, java.util and other API: Utility classes like Random class, Runtime
class, Observer and Observable and reflection API.
Chapter 12, Applets: how to use threads and images in applets. The practical problem at the
end of the chapter explains how to display a digital clock.
Chapter 13, Event Handling in Java: Practical programming example that explains how to
create a cartoon on applet and performs its event handling. This is actually a series of examples
with gradual and step-by-step revision in all of them in order to enhance their functionality and
then eliminate their drawbacks.
Chapter 14, Abstract Window Toolkit: Mini project like programming example on CityMap
Applet. The applet shows the map of a city from top angle with five buttons, namely, Hospitals,
Shopping Malls, Police station, Post Office, and Stadium. If a user presses the Hospital button,
all the hospitals are shown on the map with a specific color and likewise for Malls, Police station,
Post office and Stadium.
Chapter 15, Swing: Explanation of new classes with examples and also includes a practical
programming example to create a mini text editor.
Chapter 16, Introduction to Advanced Java: Introductory sections on JSP, Java Beans, Jar
files and enterprise Java beans with lots of examples apart from enhanced coverage of servlets
and JDBC. This chapter also encompasses a login application built using servlets and database
to demonstrate how to create and use a web application.
viii Preface to the Second Edition
Content and Structure
This book comprises 16 chapters and two appendices. A brief outline of each chapter is as follows.
Chapter 1 focuses on the object-oriented concepts and principles. It provides real life mapping
of concepts and principles besides depicting them pictorially. In addition to this, the chapter also
provides an introduction to Unified Modeling Language (UML), which is a modeling language
to show classes, objects, and their relationship with other objects.
Chapter 2 introduces Java and its evolution from its inception to its current state. Besides
introducing the features of Java, it also tells you about the structure of JDK (Java Development
Kit) and the enhancements made to Java in its latest versions. It describes how to install and run
the JDK that is in turn required for executing a Java program.
Chapter 3 describes the basic programming constructs used in Java such as variables, data
types, identifiers, etc. Java reserved keywords are also depicted in this chapter. The operators
(arithmetic, relational, boolean, etc.) that act on variables are also explained in this chapter. For
each set of operators, we have provided sufficient examples along with their explanation and
output. Apart from variables and operators, this chapter focuses on statements like if and other
loops available in Java (for, while, do…while, and for...each).
Chapter 4 deals with classes and objects. A lot of practical problems and their solutions
have been discussed in this chapter. It begins with how to define classes, objects, and method
creation. Method overloading is also discussed. Later, it emphasizes on the differences between
instance variables/methods and class variables and methods. Finally, a discussion about arrays,
this keyword, and command-line arguments is also provided.
Chapter 5 focuses on inheritance and its uses. How it is realized in Java is discussed in this
chapter. Apart from this, polymorphism concepts are visualized through method overriding and
super keyword. How practical programming problems are solved through super keyword forms
a major part of this chapter. Towards the end of the chapter, some related concepts like abstract
classes are also discussed.
Chapter 6 covers interfaces, packages, and enumeration. It highlights the differences between
abstract classes and interfaces and their practical usages with examples. The role of packages in
Java and their creation and usage is also discussed. In-depth coverage of a predefined package
java.lang is included in this chapter along with some of the famous classes such as String,
StringBuffer, StringBuilder, and Wrapper classes.
Chapter 7 discusses exceptions in detail. Apart from explaining in detail the five keywords
(try, catch, throw, throws, and finally) used in handling exceptions, it also discusses how a user
can create his own exceptions and handle them. Concepts such as exception, encapsulation, and
enrichment are also explained in this chapter. Besides these, the new facilities provided by Java
like assertions and logging are also discussed.
Chapter 8 covers multithreading concepts, its states, priorities, etc. It also discusses in detail
the inter-thread communication and synchronization concepts. Methods like wait(), notify(), and
notifyAll() have also been discussed.
Chapter 9 emphasizes on the essentials of I/O concepts like how standard input can be taken
and how output is delivered to the standard output. A few main classes of the java.io package
are discussed with examples and their usages. Console class, used for taking user input, is also
discussed. What is the use of making objects persistent and how will it be done is discussed
towards the end of the chapter.
Chapter 10 discusses the java.util package in detail. The interfaces like Map, Set, and List
etc have been discussed in detail as well as their subclasses like LinkedList, ArrayList, Vector,
HashSet, HashMap, TreeMap, etc. Java 5 introduced a new feature named ‘Generics’ which
Preface to the Second Edition ix
forms the core of the java.util package. This concept along with its application has been covered
in detail.
Chapter 11 explains how network programming can be done in Java. In-depth coverage of
sockets is extended in this chapter. Client and server concept is illustrated by the programs
created. TCP and UDP clients and server and their interactions are demonstrated. The concept
of multithreading is merged with socket and illustrated to create server programs. Some main
classes such as URL, URL connection, and network interface (new feature) are also discussed.
Chapter 12 focuses on applets, its lifecycle, methods, etc. and how they are different from
applications. Besides providing an in-depth coverage of java.applet package, some of the
classes of java.awt package are also discussed as they are very useful in creating applets such
as Graphics class, Font class, Color class, and FontMetric class. All these classes are discussed
and supported by an example for each of them.
Chapter 13 talks about event handling in Java. Basically for creating effective GUI applications,
we need to handle events and this forms the basis of this chapter. The event handling model is
not only discussed but applied throughout the chapter. All the approaches to event handling have
been discussed such as Listener interfaces, Adapter classes, inner classes, and anonymous inner
classes.
Chapter 14 focuses on GUI creation through java.awt package. It has an in-depth coverage
of containers and components. Containers like Frame, Window, etc. and components like Label,
Button, TextField, Choice, Checkbox, List, etc. are discussed in detail. How the components can
be arranged in a container is also discussed, e.g. BorderLayout, GridBagLayout, and GridLayout.
Chapter 15 shows how to create more advanced and lightweight GUI applications in Java.
More advanced layouts like SpringLayout have been discussed. Lightweight components like
JButton, JLabel, JCheckBox, JToggleButton, JList, JScrollPane, JTabbedPane, etc. have been
discussed. How to create Dialogs is also discussed. The pluggable look and feel of Java is
explained in detail.
Chapter 16 focuses on advanced Java concepts such as servlets, JDBC, and RMI. An
introduction to the advanced technologies has been discussed. This chapter is equipped with
numerous figures showing how to install the necessary softwares required for executing an
advanced Java program. The chapter also provides a step-by-step and simplified approach on
how to learn advanced concepts.
Appendix A on practical lab problems will facilitate better understanding of the concepts
explained in the book. Appendix B includes a list of interview questions along with their answers
that provides an overview of the industry scenario and their requirements.
ACKNOWLEDGEMENTS
Several people have been instrumental throughout this tiring yet wonderful journey. First of all, we
would like to express our sincere gratitude to our families without whose support, patience, and
cooperation, this would not have been possible and we would not have been what we are today.
We are also thankful to our colleagues and friends for their endless support and suggestions
during the entire process of writing this book. Lastly, we would also like to thank all our readers
/students who have supported us, encouraged us, and provided feedback to us regularly which
has helped us in shaping this edition.
Sachin Malhotra
Saurabh Choudhary
Brief Contents
Preface to the Second Edition vi
Preface to the First Edition x
Detailed Contents xiii
1. Introduction to OOP 1
2. Getting Started With Java 12
3. Java Programming Constructs 42
4. Classes and Objects 74
5. Inheritance 132
6. Interfaces, Packages, and Enumeration 156
7. Exception, Assertions, and Logging 199
8. Multithreading in Java 224
9. Input/Output, Serialization and Cloning 256
10. Generics, java.util and other API 296
11. Network Programming 336
12. Applets 354
13. Event Handling in Java 394
14. Abstract Window Toolkit 429
15. Swing 495
16. Introduction to Advanced Java 553
Appendix A: Lab Manual 628
Appendix B: Interview Questions 650
Index 657
Detailed Contents
Preface to the Second Edition vi
Preface to the First Edition x
1. Introduction to OOP 1 2.6.6 Java is Multithreaded 20
2.6.7 Other Features 20
1.1 Introduction 1
2.7 Program Structure 21
1.2 Need of Object-Oriented
Programming 2 2.7.1 How to Execute a Java
Program 21
1.2.1 Procedural Languages 2
2.7.2 Why Save as Example.Java? 22
1.2.2 Object-Oriented Modeling 2
2.7.3 Explanation 22
1.3 Principles of Object-Oriented
2.8 Java Improvements 23
Languages 3
2.8.1 Java 5.0 Features 23
1.3.1 Classes 3
2.8.3 Java 6 Features 25
1.3.2 Objects 3
2.8.4 Java 7 Features 26
1.3.3 Abstraction 3
2.8.4 Brief Comparison of Different
1.3.4 Inheritance 4
Releases 27
1.3.5 Encapsulation 4
2.9 Differences between Java and C++ 28
1.3.6 Polymorphism 5
2.10 Installation of JDK 1.7 29
1.4 Procedural Language vs OOP 5
2.10.1 Getting Started With the JDK 29
1.5 OOAD Using UML 6
2.10.2 JDK Installation Notes 29
1.6 Applications of OOP 9
2.10.3 Exploring the JDK 37
2. Getting Started With Java 12 2.11 Integrated Development
Environment 39
2.1 Introduction 12
2.2 History of Java 13 3. Java Programming Constructs 42
2.3 Java’s Journey: From Embedded Systems
3.1 Variables 42
To Middle-Tier Applications 13
3.2 Primitive Data Types 42
2.4 Java Essentials 14
3.3 Identifier 44
2.5 Java Virtual Machine 15 3.3.1 Rules for Naming 44
2.6 Java Features 16 3.3.2 Naming Convention 44
2.6.1 Platform Independence 16 3.3.3 Keywords 45
2.6.2 Object Oriented 16 3.4 Literals 45
2.6.3 Both Compiled and Interpreted 17 3.5 Operators 48
2.6.4 Java is Robust 18 3.5.1 Binary Operators 48
2.6.5 Java Language Security 3.5.2 Unary Operators 54
Features 18 3.5.3 Ternary Operator 54
xiv Detailed Contents
3.6 Expressions 55 4.9 this Keyword 103
3.7 Precedence Rules and 4.10 Arrays 105
Associativity 55 4.10.1 One-Dimensional Arrays 105
3.8 Primitive Type Conversion 4.10.2 Two-Dimensional Arrays 110
and Casting 57 4.10.3 Using for-each With Arrays 115
3.9 Flow of Control 61 4.10.4 Passing Arrays to Methods 115
3.9.1 Conditional Statements 62 4.10.5 Returning Arrays from
3.9.2 Loops 65 Methods 116
3.9.3 Branching Mechanism 68 4.10.6 Variable Arguments 117
4.11 Command-line Arguments 118
4. Classes and Objects 74 4.12 Nested Classes 119
4.1 Classes 74 4.12.1 Inner Class 119
4.2 Objects 75 4.12.2 Static Nested Class 122
4.2.1 Difference between Objects 4.12.3 Why Do We Create Nested
and Classes 76 Classes? 124
4.2.2 Why Should We Use 4.13 Practical Problem: Complex
Objects and Classes? 76 Number Program 124
4.3 Class Declaration in Java 77
4.3.1 Class Body 78 5. Inheritance 132
4.4 Creating Objects 79 5.1 Inheritance vs Aggregation 132
4.4.1 Declaring an Object 79 5.1.1 Types of Inheritance 133
4.4.2 Instantiating an Object 79 5.1.2 Deriving Classes Using
4.4.3 Initializing an Object 80 Extends Keyword 135
4.5 Methods 82 5.2 Overriding Method 137
4.5.1 Why Use Methods? 82 5.3 super Keyword 141
4.5.2 Method Types 82 5.4 final Keyword 146
4.5.3 Method Declaration 83 5.5 Abstract Class 147
4.5.3 Instance Method Invocation 86 5.6 Shadowing vs Overriding 149
4.5.4 Method Overloading 87 5.7 Practical Problem: Circle
4.6 Constructors 90 and Cylinder Class 151
4.6.1 Parameterized Constructors 93
6. Interfaces, Packages, and
4.6.2 Constructor Overloading 94
Enumeration 156
4.7 Cleaning Up Unused Objects 96
4.7.1 The Garbage Collector 96 6.1 Interfaces 156
4.7.2 Finalization 97 6.1.1 Variables in Interface 158
4.7.3 Advantages and Disadvantages 97 6.1.2 Extending Interfaces 160
4.8 Class Variable and 6.1.3 Interface vs Abstract Classes 160
Methods—Static Keyword 97 6.2 Packages 161
4.8.1 Static Variables 98 6.2.1 Creating Packages 162
4.8.2 Static Methods 99 6.2.2 Using Packages 164
4.8.3 Static Initialization Block 101 6.2.3 Access Protection 168
Detailed Contents xv
6.3 java.lang Package 169 8.4 Main Thread 227
6.3.1 java.lang.Object Class 169 8.5 Creation of New Threads 228
6.3.2 Java Wrapper Classes 170 8.5.1 By Inheriting the Thread
6.3.3 String Class 174 Class 228
6.3.4 StringBuffer Class 179 8.5.2 Implementing the Runnable
6.3.5 StringBuilder Class 180 Interface 231
6.3.6 Splitting Strings 181 8.6 Thread.State in Java 234
6.4 Enum Type 183 8.6.1 Thread States 235
6.4.1 Using Conditional Statements with 8.7 Thread Priority 240
an Enumerated Variable 185 8.8 Multithreading—Using isAlive()
6.4.2 Using for Loop for Accessing and join() 243
Values 185 8.9 Synchronization 245
6.4.3 Attributes and Methods Within 8.9.1 Synchronized Methods 246
Enumeration 186 8.9.2 Synchronized Statements 246
6.5 Practical Problem: Banking 8.10 Suspending and Resuming Threads 246
Example 187 8.11 Communication between
Threads 248
7. Exception, Assertions, 8.12 Practical Problem: Time
and Logging 199 Clock Example 251
7.1 Introduction 199
7.1.1 Exception Types 201 9. Input/Output, Serialization
and Cloning 256
7.2 Exception Handling Techniques 202
7.2.1 try…catch 203 9.1 Introduction 256
7.2.2 throw Keyword 206 9.1.1 java.io.InputStream and
7.2.3 throws 207 java io.OutputStream 257
7.2.4 finally Block 209 9.2 java.io.File Class 258
7.2.5 try-with-resources 9.3 Reading and Writing Data 261
Statement 210 9.3.1 Reading/Writing Files Using Byte
7.2.6 Multi Catch 212 Stream 261
7.2.7 Improved Exception Handling 9.3.2 Reading/Writing Console
in Java 7 213 (User Input) 264
7.3 User-Defined Exception 215 9.3.3 Reading/Writing Files Using
7.4 Exception Encapsulation Character Stream 269
and Enrichment 216 9.3.4 Reading/Writing Using Buffered
7.5 Assertions 217 Byte Stream Classes 270
7.6 Logging 219 9.3.5 Reading/Writing Using Buffered
Character Stream Classes 272
8. Multithreading in Java 224
9.4 Randomly Accessing a File 273
8.1 Introduction 224 9.5 Reading and Writing Files
8.2 Multithreading in Java 225 Using New I/O Package 276
8.3 java.lang.Thread 225 9.6 Java 7 Nio Enhancements 278
xvi Detailed Contents
9.7 Serialization 283 12. Applets 354
9.8 Cloning 285 12.1 Introduction 354
12.2 Applet Class 355
10. Generics, java.util and other API 296
12.3 Applet Structure 356
10.1 Introduction 296 12.4 Example Applet Program 357
10.2 Generics 301 12.4.1 How to Run an Applet? 358
10.2.1 Using Generics in Arguments and 12.5 Applet Life Cycle 359
Return Types 304 12.6 Common Methods Used in
10.2.2 Wildcards 304 Displaying the Output 361
10.2.3 Bounded Wildcards 306 12.7 paint(), update(), and repaint() 364
10.2.4 Defining Your Own 12.7.1 paint() Method 364
Generic Classes 307 12.7.2 update() Method 365
10.3 Linked List 309 12.7.3 repaint() Method 366
10.4 Set 311 12.8 More About Applet Tag 366
10.4.1 Hashset Class 312 12.9 getDocumentbase() and
10.4.2 Treeset Class 314 getCodebase() Methods 369
10.5 Maps 315 12.10 Appletcontext Interface 370
10.5.1 Hashmap Class 315 12.10.1 Communication between Two
Applets 371
10.5.2 Treemap Class 317
12.11 How To Use An Audio Clip? 372
10.6 Collections Class 318
12.12 Images in Applet 373
10.7 Legacy Classes and Interfaces 319
12.12.1 Mediatracker Class 375
10.7.1 Difference between Vector
12.13 Graphics Class 377
and Arraylist 319
12.13.1 An Example Applet Using
10.7.2 Difference between Enumerations
Graphics 379
and Iterator 320
12.14 Color 380
10.8 Utility Classes: Random Class 320
12.15 Font 382
10.8.1 Observer and Observable 322
12.16 Fontmetrics 386
10.9 Runtime Class 326
12.17 Practical Problem: Digital Clock 390
10.10 Reflection API 328
13. Event Handling in Java 394
11. Network Programming 336
13.1 Introduction 394
11.1 Introduction 336 13.2 Event Delegation Model 395
11.1.1 TCP/IP Protocol Suite 336 13.3 java.awt.Event Description 395
11.2 Sockets 337 13.3.1 Event Classes 395
11.2.1 TCP Client and Server 338 13.4 Sources of Events 404
11.2.2 UDP Client and Server 342 13.5 Event Listeners 404
11.3 URL Class 344 13.6 How Does The Model Work? 406
11.4 Multithreaded Sockets 346 13.7 Adapter Classes 410
11.5 Network Interface 349 13.7.1 How To Use Adapter Classes 410
Detailed Contents xvii
13.7.2 Adapter Classes in Java 412 15. Swing 495
13.8 Inner Classes in Event Handling 413
15.1 Introduction 495
13.9 Practical Problem: Cartoon
15.1.1 Features of Swing 496
Applet 416
15.1.2 Differences between
13.9.1 Smiling Cartoon With Blinking Swing and AWT 496
Eyes (Part 1) 416
15.2 JFrame 497
13.9.2 Smiling Cartoon With Blinking
15.3 JApplet 500
Eyes (Part 2) 420
15.4 JPanel 501
13.9.3 Smiling Cartoon (Part 3) 423
15.5 Components in Swings 502
14. Abstract Window Toolkit 429 15.6 Layout Managers 506
15.6.1 Springlayout 506
14.1 Introduction 429 15.6.2 Boxlayout 509
14.1.1 Why Awt? 429 15.7 JList and JScrollPane 510
14.1.2 java.awt Package 430 15.8 Split Pane 513
14.2 Components and Containers 432 15.9 JTabbedPane 514
14.2.1 Component 432 15.10 JTree 516
14.2.2 Components as Event 15.11 JTable 521
Generator 433 15.12 Dialog Box 525
14.3 Button 434 15.13 JFileChooser 529
14.4 Label 437 15.14 JColorChooser 530
14.5 Checkbox 438 15.15 Pluggable Look and Feel 531
14.6 Radio Buttons 441 15.16 Inner Frames 539
14.7 List Boxes 444 15.17 Practical Problem: Mini Editor 545
14.8 Choice Boxes 448
16. Introduction to Advanced Java 553
14.9 Textfield and Textarea 451
14.10 Container Class 455 16.1 Introduction to J2ee 553
14.10.1 Panels 455 16.2 Database Handling Using JDBC 553
14.10.2 Window 456 16.2.1 Load the Driver 554
16.2.2 Establish Connection 556
14.10.3 Frame 456
16.2.3 Create Statement 556
14.11 Layouts 458
16.2.4 Execute Query 557
14.11.1 FlowLayout 459
16.2.5 Iterate Resultset 557
14.11.2 BorderLayout 462
16.2.6 Scrollable Resultset 559
14.11.3 CardLayout 465
16.2.7 Transactions 560
14.11.4 GridLayout 469 16.3 Servlets 562
14.11.5 GridbagLayout 471 16.3.1 Lifecycle of Servlets 562
14.12 Menu 478 16.3.2 First Servlet 563
14.13 Scrollbar 483 16.3.3 Reading Client Data 567
14.14 Practical Problem: City 16.3.4 Http Redirects 571
Map Applet 487 16.3.5 Cookies 572
Exploring the Variety of Random
Documents with Different Content
420 THE BOOK OF JUDGES [17 4- 5restored the silver to
his mother. Then his mother took two hundred shekels of silver, and
gave them to the silversmith, and he made thereof a graven image
R^ and a molten image : E and it was in the house of Micay^hu. 5.
J And the man Micah had a sanctuary; and he made an Ephod and
Teraphim, and 4. two hundred shekels. We are not told what
became of the remaining nine hundred shekels. Kimchi supposes
that the two hundred shekels were merely the payment made to the
silversmith for making the idol out of the rest of the silver ; while
Ros., Stu., Ben, etc., assume that the nine hundred shekels were
devoted to the building and furnishing of the sanctuary. Mo. thinks
that the woman was under no obligation to devote the whole of the
silver to Yahweh — ' The intention of the dedication {v. ^) was not
to devote the whole of the treasure to the making of an image, but
to compel the thief to restore it by putting the whole under a taboo
until she herself had made, from this silver, an image of Yahweh.'
This view is accepted by Bu., La. There is, however, much to be said
for the view first put forward by Auberlen {Studien und Kritiken,
i860, p. 548), and adopted by Kue., that, after the woman had got
back the silver through the expedient of consecrating it to Yahweh,
her avarice caused her to seek to fulfil the vow by devoting merely
an insignificant portion of it, and keeping back the major part. Cf.
the parallel offered by the action of Ananias and Sapphira, Acts 5.
Both mother and son are thus represented in an odious light ; and it
is wholly in the manner of the E narrator to make his point allusively
(cf. Gen. 31 3^ '^), and not to labour it in a heavy-handed manner.
5. a sanctuary. Heb. D'TIPX n^3 'a house of God {or gods).'
Whether this is to be pictured as a small shrine within, or attached
to, Micah's own house (cf. the parallel narrative in 2/.""'^), or as a
separate building, is not clear. an Ephod. Cf. the full discussion in
note on ch. 8 ^7. Reference to the present passage occurs on pp.
240, 242. Teraphim. The nature of the object, or objects, denoted by
this term is highly obscure. That some kind of idol is intended
appears from Gen. 31 30.32 £^ where Laban accuses Jacob of
having stolen his ' gods ' i^elohim) ; and that this was an image in
human form seems to be clear from i Sam. 19'^", where Michal is
related to have placed the Teraphim in David's bed in order to
simulate him, and thus to facilitate his escape from Saul's
emissaries. If the Teraphim of tliis passage was a complete human
figure, we must infer that it was life-size ; but the life-sized image of
a human head or bust might have served Michal's purpose almost
equally well. Laban's Teraphim, which Rachel hid by placing them
under a camel's saddle and sitting upon them (Gen. 31 ^'E), must, if
they were complete human figures, have been much smaller. Like
the plural ^elohiin., the plural Tera
17. 5-] THE BOOK OF JUDGES 421 installed one of his sons,
and he became his priest. 6. R'' In phim may denote one image (i
Sam. loc. cit.) or more than one (Gen. loc. cit. ; cf. the plural suffixes
U'n^'hv . . . Dat^'n1 in ^z.^*). It is clear that Teraphim were
employed as oracle-givers. In Hos. 3 ^ as in our narrative, they are
mentioned together with the oracular Ephod; and in i Sam. 1522,
Zech. lo^ Ezek. 21 2122^ |^ 26.27 with the form of divination called
kesem^ i.e.., as we know from the passage in Ezek. and the use of
the root in An, a method of casting lots by shaking headless arrows
out of a quiver. It is possible that the association of Teraphim with
familiar spirits and wizards in 2 Kgs. 23 2^ may connect them with
the practice of necromancy. The view that they were a form of
household-god is based upon their occurrence as the property of
private individuals (Laban, Micah, David) ; and many scholars
suppose that their cult was connected with ancestor-worship : cf.
Schwally, Das Leben nach dem Tode, p. 36 ; Stade, GVI.'- i. p. 467 ;
Nowack, Hebr. Archdologie, ii. p. 23. Very possibly they were
identical with the ^clphhn mentioned in the Book of the Covenant,
Ex. 21 ^, 22^^'', on which cf. Footnote., p. 330.* The derivation of
the word teraphim is obscm-e. A plausible suggestion connects it
with r^pJufim 'ghosts' or 'shades' of the dead. If this is so, the root
of both is probably to be seen in Bab. rabii or rapfi., which is used of
the sitiking of the heavenly bodies into the Underworld: cf. the use
of Heb. HQI in this sense in ch. 19^. Teraphim, then, like f^phcfim,
will denote, not the lucak or flaccid ones (as the latter term is
commonly explained), but those zvho have sunk down to or
disappeared in the Underworld : cf. the use of the Ipht^'al of rabu in
iv.2 R. 30, No. 2, Obv. 24, 25, [ilii) Santas irtabi SU ana irsitim
viitiUi., 'The Sun-god sinketh, the Sun-god sinketh, into the Land of
the Dead.'l So Ball, Proc. Brit. Acad., vii. p. 16. installed. The Heb.
phrase inillc yadh, lit. 'filled the hand of,' is the technical expression
for installation in the priestly office : cf. (besides v.^^) Ex. 28", 299-
29.33.35^ Lgv. 8^^ (^U P), Lev. 16^2^ 211" * The curious
explanation of Teraphim which is found in the Jerusalem
422 THE BOOK OF JUDGES [17. 6. 7. those days there was
no king in Israel : every man was used to do that which was right in
his own eyes. 7. E Now there was a youth J from Bethlehem of
Judah, E of the clan of Judah, and he was a Levite, and he
sojourned there. 8. J And the man departed from the city, R-'^ from
Bethlehem of Judah, J to sojourn where he might chance: and he
came to the hill-country of Ephraim, as far as the house of Micah, in
(both H), Num. 3^ P, i Kgs. 133^, i Chr. 29^, 2 Chr. 13^, 29^', and
metaphorically of the consecration of an altar, Ezek. 43 -* f. The
expression is usually supposed to refer to the ceremony of filling the
hands of the person to be consecrated with the choice portions of
the sacrifice for a waive-offering : cf. Ex. 29 2--^, Lev. 8 ^^ -* (both
P). These portions are called inilliVim in Ex. 29^^, Lev. 8"^ In Bab.
and Assyr. inscriptions, however, the same phrase lanalli kata is used
more generally in the sense of entrusting authority to any one,
usually with some one of the gods as subject. Thus, e.g. it is said of
Adadnirari IV. sa (ilu) Asur jnalkut Id sandn uinallu kdtussu ' whose
hand (the god) Asur filled with an unrivalled kingdom ' {KB. i. pp.
188, 190) : cf Muss-Arnolt, Diet. i. p. 542, where other examples are
cited. 6. In those days, etc. On this statement as the work of the
latest redactor, R'', cf. p. 410. The statement is no doubt called forth
here to explain the (from the late priestly standpoint) grave
irregularity of the appointment of a non-Levitical person to exercise
priestly functions. 7. Bethlehem oj Judah. The modern Bet-Lahm,
five miles soudi of Jerusalem. The definition 'of Judah' is perhaps
intended to distinguish the city from the northern Bethlehem of
Zebulun, on which cf. ch. 12^ note. of the clan of Judah. The
difficulty raised by this statement that the Levite was a Judaean by
birth is discussed in Addit. nott\ p. 436. and he sojourned there.
Heb. DtJ'"*lJ X-ini. The statement implies that he was enjoying the
rights of protection extended to an alien ger or sojourner by the clan
with which he dwelt. Cf. the parallel narrative in v.^ NVC "Ij^'NIl
y\ih. Considering, however, that in the present passage the words
DwJ' "13 contain the identical letters of the name Dbh5 Gershom (cf.
the explanation which is offered of the meaning of the name in Ex.
2^^ J), and also that the mention of the Levite's name at the end of
the narrative (ch. 18''") and not at the beginning is very strange, it is
possible that DC "IJ NIPII may be a relic of an original Db'TTja
fnjin^ 'iDK'-l 'and his name was Jonathan, the son of Gershom.' Cf.
Addenda, p. xx.
17. 8.] THE BOOK OF JUDGES 423 order to accomplish his
errand. 9. And Micah said to him, 'Whence comest thou?' And he
said unto him, 'I am a Levite from Bethlehem of Judah ; and I am
going to sojourn where I may chance.' 10. And Micah said to him, '
Abide with me, and be to me a father and a priest, and / will give
thee ten 8. in order to accomplish his errand. Heb. is*)! mbvp, lit. 'to
make {or do) his way.' Cf. Isa. 58 '^ 'T'Dn'n nibyp 'not doing thy
ways' {i.e. 'thy wonted pursuits^ — less specific, but yet parallel).
Heb. dcrekh, which is frequently used in the sense oi journey (cf.
cases cited by BDB. s.v. "^"n 2), here seems to be used of the
object of the journey, just as it is in ch. 18 °-^ (noted by Mo.) and,
more generally, in Deut. 28^3, Josh, i ^, i Sam. 18'*, al. The point
of the statement is, of course, not that the Levite came to Micah's
house with the specific expectation of finding work there and
nowhere else, but that up to arriving at that point he had not as yet
accomplished the object of his journey, and so had it in view. The
rendering here adopted is favoured by Mo. {Coi/im.\ Ehr. R.V.
renders 'as he journeyed,' and so Mo. {SBOT.) 'in the course of his
journey,' and this explanation is generally adopted : but it is opposed
(if not precluded) by the facts that such a use of an Infin. with ?
appears to be unparalleled,* and that the phrase ' make a journey,'
though natural enough in English, is not found elsewhere in Heb. 10.
a father. For the title as a term of respect, cf BDB. s.v. 3N, 8. The 1^
addition at the end of the verse, M^n '^ij*') is clearly a corrupt
duplication of ^i^n fj^VI at the commencement of z/." (so most
moderns) ; being marked as such by the repeated ''1?n, and * No.
objects (against Mo., Comm.) to the explanation which we ha%e
adopted, and renders (in accordance with R.V., etc.) ' auf seine
Reise,' asserting that niK'J?? is a gerundial usage of the Infin. with ?
> and should fall among the cases cited in G-K. §ii4<7. In the very
miscellaneous list of cases embodied in this section, the uses of the
Infin. with 7 may be classified as follows : — Purpose ("in order to').
Lev. 8^5, i Sam. 20^6, Ps. 63^, loi », 104 1'**'', Prov. 2^;
Reference or closer definition ('as regards' or ' through'). Gen. 3-2,
18 1^, 34 ''•i^. Num. 1486, I Sam, 12", 1433, igS, 2 Sam. 3 10, 1
Kgs. a^f-, 148, Jer. 447f-, Ps. 78 18, 10320, iii«, Prov. 8 34, Neh. 13
'8; Consequence (' so as to'), Ex. 232, Lev. 5'«.'2.26, Prov. 18 *. If,
however, 13"n niCyp really means 'in making his journey,' such a
usuage of ? is circumstantial, and cannot be brought under any of
the preceding categories. Such a rendering makes TW^'V? the
equivalent of niCya or rWVl (or, more properly, of IHIt^yD or
initJ'yn)
424 THE BOOK OF JUDGES [17. n. 13.-I8. t. shekels of
silver a year, and a suit of apparel, and thy living.' [] II. And the
Levite consented to dwell with the man; E and the youth became to
him. like one of his sons. 12. And Micah installed the Levite, and the
youth became his priest, J and was in the house of Micah. 13. Then
said Micah, 'Now I know that Yahweh will do me good, seeing that
the Levite hath become my priest.' 18. I. i^' In those days there was
no king in Israel ; J and in those days the tribe of the Danites were
seeking them an inheritance to dwell in ; R"" for there had not fallen
unto them unto that day ible in the thirteenth century, and from it
into the printed Hebrew Bible.' This conclusion is adopted by No.,
La., Cooke. It may be observed, however, that, while the full form of
the comment concludes a narrative-section in 17^ and 21 ^^, the
shorter form (as in this passage) opens the narrative of ch. 19. It is
not clear why the statement should not be intended to explain the
independent and lawless action of the Danites as related in ch. 18.
for there had not fallen, etc. The subject of the verb is missing in
3t?. We must supply |>-ix 'a land' with Stu. : for the constr. n^nan
)^"1X n?D3 cf. Num. 342, josh. I3''\ (Sort ovK iviirea-fv avTrj . . .
K\r]f}oi/onia possibly presupposes a text in which n?n3 stood as
subject in place of |t] ri?nj3.
18. 2. 3- 5-] THE BOOK OF JUDGES 425 men e from their
whole number, men of valour, J from Sor ah, and from Eshta'ol, E to
spy out the land and to explore it ; J and they said unto them, ' Go,
explore the land ' : and they came to the hill-country of Ephraim, as
far as the house of Miv-ah, and spent the night there. 3. E When
they were by the house of Micah, they recognized the voice of the
youth, the Levite : and they turned aside thither, and said to him, '
Who brought thee hither? and what doest thou in this place? J and
what is thy business here?' 4. And he said unto them, 'Thus and thus
hath Micah done for me, and he hath hired me, and I am Decome
his priest.' 5. And they said to him, ' Prithee enquire 2. from their
whole number. I.e. representatives of the whole jlan (its several
branches). Heb. k''soihavi means lit. 'their ex'retnities^ — a
'condensed term for what is included within extremities = the whole'
(BDB. s.v. HVp). The idiom is well elucidated by Num. 22'", 'and he
saw from thence the uttermost part oj the people' (oyn "^y-^^),
^'•^- by implied inclusion, the whole of them. Cf. NHTK. on i Kgs.
\2^^. from Sor' ah and from Eshta^ol. Cf. notes on 13 ^-^^ to spy
out. Heb. riggel is a denominative from reghel ' foot,' like Lat.
vestigare from vestigfujn. On the usage of the verb as characteristic
of E cf. p. 416. 3. When they were by . . . they recognized. Heb. n"*!
DV non n^Sn ncini n3"'D, lit. ' They were by the house of Micah, and
they recognized.' The great emphasis upon the Personal Pronoun in
each clause throws the two clauses into vivid antithesis, the object
being to emphasize the circumstances in which the fact narrated in
the second clause took place. This usage is very idiomatic : cf.
Driver, Tenses^ §§ 168, 169. by the house. Heb. JT'n Cy, lit. ''with
the house,' i.e. close to it. For this idiomatic use of the preposition,
cf. ch. 19" (^ near Jehus'), Gen. 35*, Josh. 7^, 2 Sam. 20'', i Kgs. i
^, aJ. they recognized the voice. The view put forward by Stu. that
Heb. kSl, ' voice,' here means dialect, by which the Danites
recognized the Levite as a Judaean and not an Ephrainiite, is most
improbable. The obvious meaning is that they happened to have
known him personally before, when he was living in Judah. Cf. for
the closeness of local association between the tribes of Dan and
Judah, ch. 15 '^ ". and what is thy business here f Heb. HS "[? riDI,
lit. 'and what to thee here ? ' 5. Enquire of God. Cf. note on ch. i '.
We note the fact that while the Danites' request is ' Enquire of
^elohim^' the response {v.^)
426 THE BOOK OF JUDGES [18. 6. of God, that we may
know whether our journey on which we are going shall l)e
prosperous.' 6. And the priest said to them, ' Go in peace : before
Yahweh is your journey whereon ye go.' is ' Before Yahweh is your
journey, etc' Here, though the ordinarily unquestioned conclusion is
that ^clohim denotes ' God^ and is synonymous with ' Yahweh,' the
possibility presents itself that the two terms, as they stand, may
embody a distinction with a difference. The reference of ^elohim
may be to the Teraphiin^ regarded as the medium rather than the
source of the divine response : cf the use of hd-elohim in Ex. 21", 22
s-^ (noted on p. 330), and Micah's reference to 'my gods,' v."^^ (cf
Gen. 3130.32 j?^^ ^s well as BHh-Sldhim, ch. 17% if this means
properly 'house of gods.^ If this be so, the force of the prep. 3 may
very possibly be ' <5y ' or ' th)-ough ' : cf Num. 27 -1 P, ' He
(Joshua') shall stand before Ele'azar the priest, who shall enquire for
him by the judgment of the Urim before Yahweh' (mn'' '•jai) Onixn
OSt^'Dn 1^5 i'N:i'1); Ezek. 2121 C^--% 'He (the king of Babylon)
enquired through the Teraphim' (□''SiriQ PKC' ; here it is of course
possible to render 'he enquired /" the Teraphim'); I Sam. 28 ^,
where Saul says to the witch of 'Endor, ' Prithee divine for me
through the familiar spirit' (31X3 v N3 ^CilDp), and, with reference
to the same incident, i Chr. lo''', 'and also, for that he (Saul) enquired
through the familiar spirit' (31i<3 PINC'? 031).* Upon this
explanation, the Danites say, 'Enquire through 'elohifit^ (or,
vocalizing D^^'^N^ 'through the ^elohim'), and the Teraphim,
when thus interrogated, returns the answer, 'Before Yahweh is your
journey whereon ye go.' Even with retention of the ordinary sense oi
sd' al b"; 'enquire of^' the primary meaning may be, 'Enquire of the
oracle ' — a sense which likewise implies that 'elohim is not identical
with Yahweh, but simply voices His attitude towards the project of
the Danites. A distinction in phraseology, identical with that of our
passage, is drawn in ch. 20 1^, ' They enquired of {or through)
'clohtm . . . and Yahiveh said' ; cf also i Sam. \\^\ 2 Sam. 16". our
journey. I.e. the object of it, ''our crratid' : cf ?tote on ch. 17'^. 6.
before Yahweh. Heb. nokhah, rendered 'before,' means lit. 'in front
of or 'opposite.' So Mo., 'under the eye of Yahweh.' * Here, wliatever
bv tlie precise meaning of 'obh, rendered 'familiai spirit' (on which cf.
NHTK. p. 354; Driver, Deuteronomy, ICC, p. 226; T. W. Davies in EB.
1120 f.), it is clear that the enquiry is made through and not^the
'ohk. The response comes from the spirit of Samuel, and tlic 'dbh
acts merely as intermediary.
IS. 7-] THE BOOK OF JUDGES 427 7. So the five men went,
and came to Laibh, and saw the people that were therein, E dwelling
in security, after the manner of the Sidonians, J quiet and secure,
and there was no ^want of any"*7. Lai'sh. Heb. t^ip means 'lion.' In
Josh. 19^^ J the name is given as d^? Leshem — a variant form
which ought probably (as suggested by Wellh., De gcntihus et
fainllns Judaeis^ p. 37) to be vocalized ZiW7_ i-^-, ^'^''h Lcshdm^
the same name as '(^'^^ with formative termination: cf. Dt3''y
'Efdm from t3''y 'ayit 'bird of prey' (so Gray, Heb. Proper Na^nes^ p.
93). Eusebius and Jerome locate Laish or Dan four Roman miles
from Paneas (the modern Banyas) on the way to Tyre {OS. II4^^
249^-), and state that it is here that the Jordan breaks forth {OS.
136", 275 ^3). The site intended is no doubt the modern Tell el-Kidy,
an oblong mound, from the western side of which there issues a
copious stream which forms one of the sources of the Jordan.* Jos.
{BJ. IV. i. i) knows this site as Daphne, and states that its springs,
beneath the temple of the golden bull, supply water to the little
Jordan, which flows into the great Jordan. This identification is
accepted by Rob. {BR^ iii. pp. 390 fif.) and most modern writers.
The Ar. name Kidy, which like Heb. Dan means 'judge,' may possibly
offer a point of connexion. Smith {hC pp. 473, 480) prefers to find
the site of Laish-Dan at Banyas,J on the ground that the meadows
and springs of the upper Jordan could not be held against an enemy
without also holding Banyas and its castle ; but, as Cheyne not
unjustly remarks {EB. 997), 'From Judg. 18 we do not gather that
Laish was a place of exceptional natural strength ; its inhabitants
were a peaceful folk, who trusted not in their fortress but in their
remoteness from troublesome people like the Danites.' dwelling. On
the fem. form na^'V as implying a fem. antecedent l^yn 'the city,' in
the source from which the extract is derived, cf, p. 412. in security.
I.e. without apprehension of danger from outside. Heb. npa^. and
there was no want . . . earth. Reading "13T73 ^iDno |*N1 pN3 nti'N
as in t/.'", with Ben, Bu., Mo. {SBOT.\ No., La., Kit., * This stream
has not been indicated in Map I. X Tlieodoret (on Jar. 415) and
Jerome (on Ezek. 48 1^, and Am. 8'^) speak of Paneas as
occupying the site of Dan. Why Smith (p. 473) should say that
Banyas is ' scarcely an hour to the north' of Tell el-Kady is not clear.
His own maps, like the S WP. Great Map, locate it neatly due east.
428 THE BOOK OF JUDGES [18. 8. thing in the earth, []
and they were far from the Sidonians, and had no deaUngs with
rAram"". 8. E And they came unto their brethren J to Sor'ah and
Eshta'ol : E and their brethren said to them, ' What news Thave ye^
? ' 9. J And they Cooke, Gress., in place of ^ pN3 121 D''^Dp"pN1.
Here the curious "131 Dv3D, which can only be understood as 'one
insulting (or humiliating) in a matter,' very early caused difficulty,
and was glossed by "i^'y KHT' ' one usurping coercive power ' *
(omitted by dsc^) which has crept into the text of f^. This
explanation of the latter phrase as a gloss is simpler and more
natural than the view of Bu. (based on ffi'' K\j]pov6fios Btja-avpov,
TS 'magnarumque opum') that it is an integral part of the text,
meaning ' possessing riches,^ i.e. either "iv'iX or iK^y of which two
readings |^ "iVy represents an amalgamation. far from the Sidonians
. . . Aram. Lying at the southern mouth of the valley which runs
between the Lebanon and Hermon ranges, Laish was isolated from
Sidon by the Lebanon range to the northwest, and from Aram-
Damascus % by the Hermon range to the north-east. The reading
mx ' Aram,' which is offered by ffi'^% S*", IL'', 2., is adopted by Bu.,
La., Kit., Gress., and is undoubtedly superior to |& mx — 'had no
dealings with mankind.^ The reference to Sidon requires a more
definite antithesis. 8. What news have ye? Reading DDPIN no lit.
'what is with you?' with Wellh. {Comp.^ p. 365), No., Kit., in place of
pj DriN HD which offers an incomplete sentence, ' What ye ?' For the
use of HX '■ivith^ cf 2 Kgs. 3 •^, Jer 27 '*, where the word of
Yahweh is said to be with a prophet, i.e. revealed to him ; and the
employment of the preposition in the sense '■known to' in Job 12',
14 ^ €ir'\ making the words part of the speech of the spies, renders
Ka\ (iTTOV Tols dSfXcfjols avruv Tiv/xe'is Kadrja-de ; i.e. QriX HO
On^nN? -npS*! D»2t>>\ Such an inquiry, however, is redundant by
the side of D''Li'np Dnxi 'and will ye be still?' in v.^, apart from the
fact that we should expect nof) rather than no. ffi^'', though
agreeing with • The subs. I^y is a dira^ Xtydfievov, but the sense
implied appears to be sufficiently guaranteed by the usage of the
verb IVy, X It seems probable that the narrator is thinking of the
kingdom of Damascus ratlier than of the small Aramaean states in
the immediate neighbuiirhood (Beth rehob and Ma'achah) to which
Mo. alludes.
18. 9-] THE BOOK OF JUDGES 429 said, ' Arise ! and let us
go up ^to Laish^ : for ^- we have seen the land, and, behold, it is
very good: and will ye be still? be not slothful to go to enter in to
possess the land. 10. J When ye come, ye will come unto a people
secure, and the land is broad : E for God hath given it into your
hand ; J a place where there is no want of anything that is in the
earth.' II. Then there set forth from thence of the clan of the
Danites, from Sor ah and from Eshta'ol, six hundred men girt with
weapons of war. 12. And they went up, and encamped in f^ in
making the words an address to the spies, yet, like ffi'^, has the
reading Kadrja-de ; and Mo. deduces from this the possibility that
D'^K'"' maybe the corruption of an original D^3"'LJ'D — 'What
(news) are ye bringing back}' Bu.'s suggestions Dnx["l] np 'What
have ye seen?' or DriNrvp]"no 'What have ye found.?' are
improbable. 9. Arise ! The sing, noip is used as a stereotyped
interjection in place of the plur. (which appears in several Codd.,
probably as a correction). Cf. r\1T\ ' Come ! ' — originally ' Give ! ' or
' Permit ! ' — addressed to a plurality of persons, Gen. 11^*''; na!'
'Come!' addressed to a woman. Gen. 19^^; PINT 'Behold!'
addressed to Israel in the plural, Deut. i^. let us go up. On the use
of the verb 'aid ' go up,' in the general sense of making a military
expedition, cf. ch. i * note. to Laish. Reading rw"^^ with No., in
place of |^ DH^^y 'against them,' the suffix of which has no
antecedent, ffir^ew' avTrjv, i.e. n^fiy may represent the first stage
in the corruption. It is worthy of notice, however, that there exists a
doublet in (jj^AL ai.^ ^h (marked by obelus) which may possibly
contain the original text. This runs in ffir'' as follows : ei(rr]X6afifi>
koI ejjLTrepifnaTfja-afxfv ttjv yr]v etoy els Aaicra, Kai ftSo^ev rbv
Xaov rov KUTOiKovvTa iv avTJj eV eXTTi'St Kara to crvyKpifxa twv
^ibasvicov Kal fiaKpav airixovras ck '2l8S}vos, icai Xoyos ovk tjv
avrois fiera 'Svpias ' dXKa dvdcTTTjTe Ka\ dva^ap.tv eV avrovs, on
ktX. This is accepted as original by La. in the following form :
l^>>^-'\]} ]'"1X3 ■=l^nri3'l •'1JX3 D"'ipin"i'i D-'bi^ ^W^P non^
dk^V Pi2ip2 -ij^n cyn-riiNi hnisi •iD-ip Dnx-Dy Dn)"pi< "i^ni cbn^-
yp non, in place of n? nioip. This provides us with the necessary
antecedent to Drfpy • but the passage is somewhat unnecessarily
tautological after z/J, and may have been constructed in imitation of
that verse.
430 THE BOOK OF JUDGES [18. 12. Kiriath-je arim, in
Judah : wherefore that place was called 12, Kiriath-je aritn. The
name means 'woodland-town.' Eusebius places the city nine {OS.
271 ^") or ten {OS. 234 3*) Roman miles from Jerusalem on the
road to Diospolis (Lydda). The site intended has been identified,
since Rob. {BR.^\\. pp. 11 f.), with Kuryet el-'Enab (' town of grapes
'), or el-Kuryeh,* and the position suits the connexion in which
Kiriath-je'arim is mentioned in Josh. 9^'^ among the Gibe'onite
cities Gibe'on, Kephirah, and Be'eroth ; and also the description of
the northern boundary-line of Judah as described in Josh. 15®"- P,
where, after running just south of Jerusalem to the hill to the west
of the valley of Hinnom and north of the vale of Repha'im, it
continues in a north-westerly direction to the spring of the waters of
Nephtoah (probably Lifta t). Mount 'Ephron (unidentified), and
Kiriath-je'arim (Kuryet el-'Enab), where ir takes a turn (3DJ1 v}'^)
south-westward to Mount Se'ir, and passing along the northern
shoulder of Mount Je'arim§ where Chesalon (Kesla) is situated, it
descends to Beth-shemesh ('Ain-sems) and passes on to Timnah
(Tibneh). Cf. also the description of the southern boundary of
Benjamin in Josh. i8""- P. * The village is often called Abfi G6s after
a celebrated family of bandits which resided there during the earlier
half of the nineteenth century. % The interchange between n and /,
as seen in Nephtoah, Lifta, may be illustrated by Heb. niskd and
liskd ' chamber,' Heb. nahas (root of ndhds ' serpent') and lafias 'to
hiss,' Bab. nesu and Heb. ldyis'\\on,' New Heb. tidkat and Bib. Heb.
Idkat, Aram, n^kat and l^kat, ' to pick up,' Heb. nd/han and Aram,
n'than and 7i«thal ' to give," Heb. 'ahndnd and Aram ' arm^ld '
widow,' etc. The interchange is not confined to Semitic : thus the
English Lincoln appears in Northern French as Nicole; level is from
Old French livel, which has become niveau in modern French ; lilac
comes ultimately from the Persian lilak, a variation of nilak ' blue ' ;
etc. If, as seems likely, the n in Nephtoah is formative, and the root
\%pdthah 'to open,' in the sense of an opening in the rock for the
exit of water (cf. the use of the verb in Isa. 41^8^ Ps. i05-*i), the
disappearance of the final guttural h in Lifta may be illustrated by
the fact that both pdthah and pdlhd occur in Heb. in the sense of
opening. Lifta possesses ' a large spring and the stones of some very
ancit-nt buildings at the E. entrance to the village' (Baedeker,
Palestine,^ p. 18). § T'yEJ* nn 'the hairy, i.e. scrttbby, mountain '
(cf. Ar. sa'dr, 'tangled, or, abundant and dense, trees') and D''"!!?^
TH ' the woodland-mountain' appear respectively to denote the hill
on which Saris stands to the north of the wady el-Hamar, and the hill
on which Kesla stands, south of the same wady. Both hills are still
covered by scrub and the remains of old woods : cf. ^5 WP. Great
Map, xvii. , and Buhl, Geogr. p. 91. Baedeker, Palestine,'^ p. 16, in
describing the road from Jaffa to Jerusalem in the neighbourhood of
Saris, says : 'The hills are overgrown with underwood ; bt-sides the
wild olives the carob-tree is frequently observed.' Similarly,
Macmillan's Guide to Palestine,^ p. 15: 'On either side of the road
are rocky heights, with olive-trees occupying every point of vantage,
and amongst them may he seen many carob-trees, consjiicuous by
their handsome dark green foliage. There are also several fine oak
and terebinth trees.'
IS. 14. 15-18.] THE BOOK OF JUDGES 431 Mahaneh-Dan,
unto t..is day : R*" behold, it is to the west of Kiriath-je'arim. 13. J
And they passed on thence to the hillcountry of Ephraim ; and they
came as far as the house of Micah. 14. E Then answered the five
men that went to spy out the land R^"^ Laish, E and said unto their
brethren, ' Do ye know The rival identification (proposed by
Henderson and Conder, SWP. Mem. iii. pp. 43 ff.) is the ruined site
'Erma, on the southern side of the wady Sarar about four miles east
of 'Ain-Sems. This suits the proximity to Beth-Shemesh, which is
suggested by I Sam. 6^"-^* but is irreconcilable with the
description of the boundary of Judah as noticed above, J and (as
Cheyne points out, EB. 2680) is too near Sor'ah and Eshta'ol to suit
the present narrative. Mahatieh-Dan. Cf note on ch. 13^°. to the
west of. Lit. '■behind.' Cf the phrase 'behind {i.e. to the west of) the
wilderness' in Ex. 3 ' E, and contrast the phrase 'in front /" Hebron,'
ch. 16^ note. 14. the land Laish. On Laish (the city) as a gloss
inserted by the redactor of the two narratives, cf p. 413. Now
therefore consider, etc. Verbitm sap. For the phrase, cf. I Sam. 25 1^
15-18. The two accounts, which are here interwoven, seem to have
been further confused by later glossing (cf p. 414), but the general
situation is surely not so obscure as Mo. (who is closely followed by
Cooke) makes out. Some difficulty is caused by the repeated
reference {vv.^^-'^"') to 'the entrance of the gate.' The term saar '
gate ' is never applied to the door of a house ; yet it is clear from
•z/'z/.'*-^' that Micah's house was one among a few others forming
a small village, certainly not surrounded by a massive wall with a
gate. Mo., while rightly remarking, upon z'.", that ' Micah evidently
lived in an open village,' yet explains v.^'° as meaning that 'the main
body [of Danites] halted without the village,' and speaks later on of
'the armed men at the entrance of the village' — an expression *
The statement of Jos. [Ant. vi. i. 4) that Kiriath-je'arim was in the
neighbourhood of Beth-shemesh is probably based merely upon this
narrative. X Leaving out of account the plausible identification of
Nephtoah with Lifta, the mere fact that Kiriath-je'arim occupies a
position on the boundary-line between the valley of Hinnom (Josh.
158) and Chesalon (f.i") seems absolutely to exclude the site 'Erma.
How could the line run from Hinnom to "Erma (presumably along the
upper course of the Wady Sarar), strike north-east to Chesalon
(Kesla) at an acute angle, and then return south-west at a still more
acute angle, over the shoulder of the hill on which Chesalon is
situated, so as to reach Beth-shemesh? As a matter of fact, we are
told in v. i" that, after reaching Kiriath-je'arim, the boundary (so far
from striking north-eastward) turned westward (HD* ' towards the
sea') to Mount Se'ir and Chesalon.
432 THE BOOK OF JUDGES [18. i6. 17. that there is in
these houses R-*^ an Ephod, and Teraphim, Eand a graven image
R"" and a molten image? E Now therefore consider what ye will do.'
15. And they turned aside thither, and came unto the house of the
youth the Levite, ^^^ the house of Micah, E and asked him of his
welfare. 16. E?+G1. And ''the'' six hundred men, girt with their
weapons of war, that were of the children of Dan, were standing at
the entrance of the gate : 17. and the five men that went to spy out
the land went up; they went in thither, they took the graven image,
R^"^ and the adopted verbatim by Cooke. Neither of these scholars
explains what kind of ' entrance ' he pictures an unwalled village as
possessing ; yet it is clear that the phrase ' the entrance of the gate '
must postulate a 7-eal gate * ; and the natural inference seems to
be that Micah, as a man of some position, had a house surrounded
by a courtyard, J and that it was at the gate of this courtyard, and
not outside the village, that the men at arms were standing whilst
their companions slipped inside (cf. La.). If this was so, the difficulty
does not seem very great. The Danites might endeavour to distract
the priest's attention by parleying at the gate, yet it would still be
possible for him to observe the movements of the five spies, and to
intervene with his feeble protest as recorded in v}^. 16. the six
hundred men^ etc. We must read ti'^Nn as in 2/.", in place of f§
tjJiK indefinite. 17. went up. The precise significance with which the
verb is used is obscure. Ros. and Stu. assume from it that Micah's
sanctuary was an 'dliyyd or upper chamber on the roof of his house,
to which the ascent would have been by an external staircase ; but
such an inference is precarious. It is not impossible that 'did may be
used simply of an aggressive entry, in much the same way as it is
frequently employed of making a hostile expedition (cf. ch. i ' note\
without implication of an actual ascefit. they went in thither., they
took, etc. The asyndeton is very harsh in the Heb., and can hardly
be the work of the original narrator. Wellh.§ (in Bleek, Einleitti7tg\ p.
198) and Bu. suggest that the two Perfects should be vocalized as
Imperatives ("inpp njSt^ ■"'^^)j ^^'^ * Whether the statement of
Ex. 32^6 J that Moses 'stood in the gate of the camp' imphes that
the camp of Israel was surrounded with a zariba or barricade with an
actual f;ate is not clear ; but in any case ' gate ' by itself has not the
same definiteness as lytiTI riDD, lit. ' opening of the gate,' in our
narrative. X Cf. Warren in DB. ii. p. 432a : ' In the villages there is
usually a court attached to the house, in which the cattle, sheep,
and goats are penned.' § Wellh. retracts this suggestion in Comp.^
p. 366.
18. 19. 21. 22. 23-] THE BOOK OF JUDGES 433 Ephod, and
the Teraphim, R'' and the molten image. J+Gl. And while the priest
was standing at the entrance of the gate, with the six hundred men
that were girt with the weapons of war, 18. J these others went into
the house of Micah, and took ^^^ the graven image, J the Ephod,
and the Teraphim, R'' and the molten image. J And the priest said
unto them, ' What do ye? ' 19. And they said to him, 'Hold thy
peace, lay thy hand upon thy mouth, and go with us ; and be to us a
father and a priest : is it better for thee to be priest to the house of
one man, or to be priest to a tribe and to a clan in Israel?' 20. And
the priest's heart was glad, and he took the Ephod, and the
Teraphim, R-"^ and the graven image, J and went in the midst of
the people. 21. So they turned and departed, and put the little ones
and the cattle and the goods before them. 22. When they were a
good way from the house of Micah, the men that were in the houses
which were near to Micah's house were called to arms, and followed
hard after the children of Dan. 23. And they cried unto the children
of Dan. And they turned their faces, and said to Micah, ' What aileth
thee, that thou art up in arms?' 24. And he said, ' My gods that I
made ye have that the words originally formed the continuation of
the spies' advice in ■z/.i*^' Now, therefore, consider what ye will do
: go in thither, take the idol, etc' This destroys the terse
suggestiveness of v.^'^ as it stands in fSL. We might parallel the
asyndeton in narrative by ck. 20 31 Opnjn), 20 « (inamn . . . nniJj ;
but here again the originality of the text may be questioned. And
while the priest^ etc. Lit. 'And the priest was standing . . . and these
went in, etc' For the construction, cf. Driver, Tenses^ § 169. with the
six hundred., etc. Lit. "" and the six hundred.' The construction may
be justified as an instance of ''waw of association' (cf. BDB. p. 253a)
; yet it is not very natural, and tends to accent our suspicions as to
the state of the text. 19. lay thy hand, etc. For the expression, cf.
Mic. 7*^, Job 21*, 299, 40^, Prov. 30^1 21. the goods. Heb. iT^ns
only here; but cf. the usage of the masc. nn3 in Gen. 31', Isa. lo^ al.
22. when they were, etc. Lit. ' They were a good way from . . . and
the men that were, etc' — a circumstantial construction similar to
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!
textbookfull.com