Java in Depth Learn the most favoured language for edge device and Internet of Things development 1st Edition Sarika Agarwal 2024 scribd download
Java in Depth Learn the most favoured language for edge device and Internet of Things development 1st Edition Sarika Agarwal 2024 scribd download
com
https://ebookmeta.com/product/java-in-depth-learn-the-most-
favoured-language-for-edge-device-and-internet-of-things-
development-1st-edition-sarika-agarwal/
OR CLICK BUTTON
DOWNLOAD NOW
https://ebookmeta.com/product/more-java-17-an-in-depth-exploration-of-
the-java-language-and-its-features-3rd-edition-kishori-sharan/
ebookmeta.com
https://ebookmeta.com/product/more-java-17-an-in-depth-exploration-of-
the-java-language-and-its-features-3rd-edition-kishori-sharan-2/
ebookmeta.com
https://ebookmeta.com/product/learn-java-for-android-development-
second-edition-jeff-friesen/
ebookmeta.com
Budget Keto Kitchen Easy Recipes That Are Big on Taste Low
in Carbs and Light on the Wallet 1st Edition Monya Kilian
Palmer
https://ebookmeta.com/product/budget-keto-kitchen-easy-recipes-that-
are-big-on-taste-low-in-carbs-and-light-on-the-wallet-1st-edition-
monya-kilian-palmer/
ebookmeta.com
Population Genetics and Microevolutionary Theory 2nd
Edition Alan R. Templeton
https://ebookmeta.com/product/population-genetics-and-
microevolutionary-theory-2nd-edition-alan-r-templeton/
ebookmeta.com
https://ebookmeta.com/product/business-statistics-in-practice-using-
data-modeling-and-analytics-9th-edition-bruce-l-bowerman/
ebookmeta.com
https://ebookmeta.com/product/hydrocarbon-fluid-inclusions-in-
petroliferous-basins-1st-edition-nandakumar/
ebookmeta.com
https://ebookmeta.com/product/the-chronomancer-3-a-men-s-fantasy-
harem-adventure-1st-edition-neil-bimbeau-gideon-hayes/
ebookmeta.com
The Third Revolution Xi Jinping and the New Chinese State
1st Edition Elizabeth C Economy
https://ebookmeta.com/product/the-third-revolution-xi-jinping-and-the-
new-chinese-state-1st-edition-elizabeth-c-economy/
ebookmeta.com
Java in Depth
SARIKA AGARWAL
HIMANI BANSAL
FIRST EDITION 2018
Copyright © BPB Publication, INDIA
ISBN: 978-93-8655-157-3
All Rights Reserved. No part of this publication can be stored in a retrieval system or reproduced
in any form or by any means without the prior written permission of the publishers
All trademarks referred to in the book are acknowledged as properties of their respective owners.
Distributors:
BPB PUBLICATIONS BPB BOOK CENTRE
20, Ansari Road, Darya Ganj 376 Old Lajpat Rai Market,
New Delhi-110002 Delhi-110006
Ph: 23254990/23254991 Ph: 23861747
MICRO MEDIA
Shop No. 5, Mahendra Chambers,
150 DN Rd. Next to Capital Cinema,
V.T. (C.S.T.) Station, MUMBAI-400 001
Ph: 22078296/22078297
Published by Manish Jain for BPB Publications, 20, Ansari Road, Darya Ganj, New Delhi- 110002
and Printed by Repro India Pvt Ltd, Mumbai
PREFACE
The authors are confident that the present work will come as a relief to the students
wishing to go through a comprehensive material for understanding Java concepts in
layman’s language, offering a variety of analogical understanding and code snippets.
This book covers all the topics/content/syllabus prescribed at various levels in
universities.
This book promises to be a very good starting point for beginners and an asset to
advance users too.
This book is written as per the syllabus of majorly all the universities and covers
topics both at under-graduate and graduate level. Difficult concepts of Core Java are
given in an easy way, so that the students are able to understand them in an efficient
manner.
It is said “To err is human, to forgive is divine”. In this light, we wish that the
shortcomings of the book will be forgiven. At the same, the authors are open to any
kind of constructive criticisms and suggestions for further improvement. All intelligent
suggestions are welcome and the authors will try to do their best to incorporate such
invaluable suggestions in the subsequent editions of this book.
Sarika Agarwal
Himani Bansal
Contents
Review Questions......................................................................................................................54
CHAPTER-4
CLASSES AND METHODS
4.1 Classes.......................................................................................................................57
4.1.1 Class Fundamentals.....................................................................................57
4.2 Naming Classes.......................................................................................................59
4.2.1 Rules for Naming Classes............................................................................59
4.2.2 Conventions for Naming Classes...............................................................59
4.3 Creating An Object..................................................................................................60
4.3.1 Dynamic allocation of memory through new operator..........................60
4.4 Comment Entries.....................................................................................................61
4.5 Data Members..........................................................................................................62
4.6 Naming Variables....................................................................................................62
4.7 Methods....................................................................................................................63
4.7.1 Naming Methods..........................................................................................64
4.8 Invoking A Method.................................................................................................65
4.8.1 Invoking A Method of the same Class.......................................................65
4.8.2 Invoking A Method of a different Class....................................................65
4.9 Passing Arguments to a Method...........................................................................66
4.9.1 Call By Value.................................................................................................67
4.9.2 Call By Reference..........................................................................................67
4.10 Scope of Variables....................................................................................................68
Summary...................................................................................................................................68
Answer the following Questions...............................................................................................69
Multiple Choice Questions........................................................................................................69
Review Questions......................................................................................................................70
CHAPTER-5
CONSTRUCTORS, ACCESS SPECIFIERS AND MODIFIERS
5.1 Constructors.............................................................................................................71
5.2 Types of Constructors.............................................................................................72
5.2.1 Default Constructor......................................................................................72
5.2.2 Parameterized Constructor.........................................................................73
5.3 Instance Initializer Block or Anonymous Block..................................................73
5.4 Static Block...............................................................................................................75
5.5 Access Specifiers......................................................................................................75
5.5.1 The Public Access Specifier.........................................................................76
5.5.2 The Private Access Specifier........................................................................76
5.5.3 The Protected Access Specifier....................................................................76
5.5.4 Default Access...............................................................................................76
viii | Contents
CHAPTER-10
EXCEPTION HANDLING
10.1 Need for Exception Handling..............................................................................131
10.2 Type of Exceptions................................................................................................131
x | Contents
CHAPTER-16
EVENT HANDLING
16.1 Events......................................................................................................................239
16.2 Event–Driven Programming................................................................................239
16.3 Components of An Event.....................................................................................239
16.4 The JDK Event Model ..........................................................................................240
16.5 The JDK Event Model (Delegation)....................................................................240
16.6 Handling Window Events....................................................................................246
16.7 Adapter Classes ....................................................................................................247
16.8 Inner Classes..........................................................................................................250
16.9 Anonymous Classes..............................................................................................251
Summary.................................................................................................................................252
Answer the following Questions.............................................................................................252
True/False.................................................................................................................................252
Review Questions....................................................................................................................252
Interview Questions................................................................................................................253
CHAPTER-17
DATABASE CONNECTIVITY
17.1 Database Management on Web...........................................................................255
17.1.1 Database Management...............................................................................255
17.2 Database Connectivity..........................................................................................255
17.3 Categories of JDBC drivers..................................................................................257
17.4 Querying a Database.............................................................................................258
17.4.1 Connecting to a Database..........................................................................258
17.4.2 The Connection Object...............................................................................259
17.4.3 Processing a Query in Database...............................................................259
Summary.................................................................................................................................267
Answer the Following Questions............................................................................................268
Multiple Choice Questions......................................................................................................268
Fill ups ..................................................................................................................................268
True/False.................................................................................................................................269
Review Questions....................................................................................................................269
Interview Questions................................................................................................................269
CHAPTER-18
COLLECTION
18.1 Collection Framework..........................................................................................271
18.2 Collection Interface...............................................................................................271
18.3 Hierarchy of Collection.........................................................................................272
18.4 Methods of Collection...........................................................................................273
Contents | xiii
INTRODUCTION TO JAVA
Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.