Mastering Java A Beginners Guide (Sufyan bin Uzayr) (Z-Library)

Author: Sufyan bin Uzayr

Java

Mastering Java: A Beginner's Guideintroduces developers of all ages to the beautiful and valuable world of Java. Java is frequently used as the default platform for scientific applications, including natural language processing. The primary reason for this is that it is secure, portable, and extensible. It also has excellent high-level concurrency tools. In terms of software development, the introduction of Java undoubtedly was a watershed moment. You've surely heard of Java if you're a software developer. For a multitude of reasons, its relevance and functionality in the world of coding deserve high acclaim. Computers have become highly adaptable devices that can handle multi-level undo and multi-threaded apps, mostly thanks to Java. As its syntax is comparable to English, Java is relatively simple to learn and understand in a short period of time. Despite being a slightly older piece of technology, Java still performs well. It is regularly ranked among the most popular languages of programming. It is critical for enterprise-level web apps and microservices, which are expected to grow in popularity over the coming year. Java will continue to dominate the banking industry and the Fintech business for years to come.Mastering Javaaddresses various aspects pertaining to Java development. Mastering Java will prove to be of enormous assistance to Java developers of all levels. This book focuses on a variety of topics; it provides a concise explanation of Java's introduction, benefits, characteristics, and examines why Java is so essential.Mastering Javaalso includes installation advice and information on the many components that make Java work, such as Object-Oriented Programming, Strings, Collections, Packages, and Databases. Mastering Java will always be a helpful resource for both intermediate learners and skilled personnel.

📄 File Format: PDF
💾 File Size: 5.4 MB
34
Views
0
Downloads
0.00
Total Donations

📄 Text Preview (First 20 pages)

ℹ️

Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

📄 Page 1
(This page has no text content)
📄 Page 2
Mastering Java
📄 Page 3
Mastering Computer Science Series Editor: Sufyan bin Uzayr Mastering Java: A Beginner’s Guide Divya Sachdeva and Natalya Ustukpayeva Mastering Unreal Engine: A Beginner’s Guide Divya Sachdeva and Aruqqa Khateib Mastering UI Mockups and Frameworks: A Beginner’s Guide Mohamed Musthafa MC and Kapil Kishnani Mastering Ruby on Rails: A Beginner’s Guide Mathew Rooney and Madina Karybzhanova Mastering Sketch: A Beginner’s Guide Mathew Rooney and Md Javed Khan Mastering C#: A Beginner’s Guide Mohamed Musthafa MC, Divya Sachdeva, and Reza Nafim For more information about this series, please visit: https:// www.routledge.com/Mastering-Computer-Science/ book-series/MCS The “Mastering Computer Science” series of books are authored by the Zeba Academy team members, led by Sufyan bin Uzayr. Zeba Academy is an EdTech venture that develops courses and content for learners primarily in STEM fields, and offers education consulting to Universities and Institutions worldwide. For more info, please visit https:// zeba.academy
📄 Page 4
Mastering Java A Beginner’s Guide Edited by Sufyan bin Uzayr
📄 Page 5
First edition published 2022 by CRC Press 6000 Broken Sound Parkway NW, Suite 300, Boca Raton, FL 33487-2742 and by CRC Press 2 Park Square, Milton Park, Abingdon, Oxon, OX14 4RN CRC Press is an imprint of Taylor & Francis Group, LLC © 2022 Sufyan bin Uzayr Reasonable efforts have been made to publish reliable data and information, but the author and publisher cannot assume responsibility for the validity of all materials or the consequences of their use. The authors and publishers have attempted to trace the copyright holders of all material reproduced in this publication and apologize to copyright holders if permission to publish in this form has not been obtained. If any copyright material has not been acknowledged please write and let us know so we may rectify in any future reprint. Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or utilized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopying, microfilming, and recording, or in any information storage or retrieval system, without written permission from the publishers. For permission to photocopy or use material electronically from this work, access www. copyright.com or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. For works that are not available on CCC please contact mpkbookspermissions@tandf.co.uk Trademark Notice: Product or corporate names may be trademarks or registered trademarks and are used only for identification and explanation without intent to infringe. ISBN: 9781032134109 (hbk) ISBN: 9781032134086 (pbk) ISBN: 9781003229063 (ebk) DOI: 10.1201/9781003229063 Typeset in Minion by KnowledgeWorks Global Ltd.
📄 Page 6
v Contents About the Editor, xxv Chapter 1 ◾ Introduction to Java 1 WHAT IS JAVA? 2 How Does Java Work? 2 Why Is Java Important? 3 Java’s Technical Advantages Include 4 Java’s Advantages in the Workplace 5 THE JAVA PROGRAMMING LANGUAGE HAS THE FOLLOWING FEATURES 6 Simple and Well-Known 7 Compiled and Interpreted the Data 8 Independent of the Platform 9 Portable 10 Neutral in Architecture 10 Object-Oriented 10 Robust 11 Safe 11 Distributed 12
📄 Page 7
vi ◾ Contents Interactive and Multi-Threaded 12 Outstanding Performance 13 Extensible and Dynamic 13 BASIC SYNTAX 14 What Is the Syntax of Java? 14 First Java Program 15 Syntax for Beginners 16 Identifiers in Java 17 Keywords in Java 18 Modifiers in Java 23 Variables in Java 23 Enums in Java 23 Literals in Java 24 Comments in Java 25 Blank Lines 27 Inheritance 27 Interfaces 27 Chapter 2 ◾ Getting Started with Java 29 HOW TO SETUP JAVA ON A WINDOWS COMPUTER 30 In Java, Here’s How to Establish Environment Variables: Classpath and Path 31 INSTALLING A JAVA INTEGRATED DEVELOPMENT ENVIRONMENT (IDE) 32 Internal Java Program Details 34 What Occurs throughout the Compilation Process? 34 What Occurs When the Program Is Running? 34
📄 Page 8
Contents ◾ vii TYPES OF PRIMITIVE DATA 35 Simple Programs to Write 35 Identifiers 37 Variables 38 Variable Declaration 38 Assignments Expressions and Assignment Statements 39 In a Single Step, Declare and Initialize Variables 40 Constants 40 Numerical Data Types and Operations 42 Numerical Operators 42 Numeric Literals 43 Integer Literals 43 Floating-Point Literals 44 Notations in Scientist 44 Arithmetic Expressions 44 Shortcut Operators 45 Numeric Type Conversions 46 Character Data Type and Operations 48 Unicode and ASCII Code 48 Special Character Escape Sequences 50 Casting between Char and Numeric Types 50 String Type 51 String Concatenation 51
📄 Page 9
viii ◾ Contents Converting a String to a Number 52 String to Integers Conversion 52 Strings to Doubles Conversion 52 Using the Console for Input 53 Using a Scanner to Getting Information 53 Documentation and Programming Style 54 Appropriate Comments and Style of Comments 54 Conventions for Naming 55 Spacing Lines and Proper Indentation 55 Block Styles 56 Errors in Programming 56 Syntax Problems “Compilation Errors” 56 Runtime Errors 57 Logic Errors 58 Debugging 58 CONTROL STRUCTURES 59 If 60 if Statement 60 if-else Statement 61 if-else-if Ladder 62 Nested if Statement 64 Switch Statement 66 Loop Statements 68 Jump Statements 73
📄 Page 10
Contents ◾ ix A GUIDE TO JAVA PACKAGES 76 Package Kinds in Java 77 Subpackages in Java 81 Chapter 3 ◾ Object-Oriented Programming 83 JAVA OBJECT-ORIENTED PROGRAMMINGS (OOPs) CONCEPTS 84 OOPs 84 Object 85 Class 85 Inheritance 86 Polymorphism 86 Abstraction 86 Encapsulation 86 Coupling 86 Cohesion 87 Association 87 Aggregation 87 Composition 88 In Java, What Is the Difference between an Object and a Class? 88 Advantages of OOPs over Procedure-Oriented Programming Languages 88 Java Naming Conventions 89 Benefits of Java Naming Conventions 89 Class 90
📄 Page 11
x ◾ Contents Interface 90 Method 90 Variable 91 Package 92 Constant 92 Java Objects and Classes 92 In Java, What Is an Object? 93 In Java, What Is a Class? 93 In Java: Instance Variable 94 In Java: Method 94 In Java: New Keyword 95 What Are the Many Methods of Creating an Object in Java? 100 Anonymous Object 101 CONSTRUCTORS 103 Default Constructor 104 What Is a Default Constructor’s Purpose? 105 Parameterized Constructor 106 Why Utilize the Parameterized Constructor? 106 Constructor Overloading 108 In Java, What Is the Difference between a Constructor and a Method? 109 Copy Constructor in Java 110 Copying Values without Constructor 111
📄 Page 12
Contents ◾ xi STATIC KEYWORD 112 Counter Program with No Static Variables 115 Counter Program with Static Variables 116 IN JAVA, “THIS” KEYWORD 120 JAVA ENUM’S 131 Inheritance and Enumeration 135 Methods values(), ordinal(), and function valueOf() 136 Constructor and Enum 137 Enumeration and Methods 138 Chapter 4 ◾ Creating and Using Java Strims 141 A BEGINNER’S GUIDE TO STRINGS 142 Interface for CharSequence 142 In Java, What Is a String? 143 What Is the Best Way to Make a String Object? 143 Methods of the String Class in Java 145 IMMUTABLE STRING IN JAVA 147 Why Are String Objects in Java Immutable? 149 Why Is the String Class in Java Final? 150 STRING COMPARISON 150 STRING CONCATENATION 153
📄 Page 13
xii ◾ Contents IN JAVA SUBSTRING 159 METHODS OF JAVA STRING CLASS 161 Methods toUpperCase() and toLowerCase() in Java String 161 Method to Java String trim(): 162 The Methods startsWith() and endsWith() in Java String 163 Method to Java String charAt() 163 Method to Java String length() 164 Method to Java String intern() 165 Method to Java String valueOf() 165 Method to Java String replace () 166 STRINGBUFFER CLASS IN JAVA 167 StringBuffer Class’s Important Constructors 167 Mutable String 168 STRINGBUILDER CLASS IN JAVA 173 Examples of StringBuilders 175 DIFFERENCE BETWEEN STRINGBUFFER AND STRING 180 String and StringBuffer Performance Tests 180 HashCode Test for Strings and StringBuffers 182 Difference between StringBuilder and StringBuffer? 183 Example of StringBuffer 184 Example of StringBuilder 184
📄 Page 14
Contents ◾ xiii HOW CAN WE MAKE AN IMMUTABLE CLASS? 185 The Function toString() Method in Java 186 Benefit 186 Java StringTokenizer 189 StringTokenizer Constructors 189 StringTokenizer Class Methods 190 Chapter 5 ◾ Collections, Lists, and Java’s Built-in APIs 193 WHAT ARE JAVA ARRAYS? 194 Advantages 194 Disadvantages 195 Array Types in Java 195 Java Single Dimensional Array 195 Java Array Declaration, Instantiation, and Initialization 196 Java Array for Each Loop 197 Passing an Array to a Method 198 Method Returning an Array 200 ArrayIndexOutOfBoundsException 201 Java Multidimensional Array 201 Java’s Jagged Array 203 What Is the Name of the Java Array Class? 204 Creating a Java Array Copy 205
📄 Page 15
xiv ◾ Contents In Java, Clone an Array 206 In Java, Add Two Matrices 208 In Java, Multiply Two Matrices 208 JAVA SETS 210 The Set Interface’s Operations 211 Methods of Set 214 LIST IN JAVA 230 ArrayList vs. Java List 232 How to Make a List 232 Converting an Array to a List 233 How to Convert a List to an Array 234 Get and Set an Element in a List 235 Sorting a List 237 Interface for Java ListIterator 238 MAP INTERFACE IN JAVA 241 Hierarchy of Java Map 241 The interface of Map.Entry 244 IN JAVA, ITERATING COLLECTIONS 248 The Four Java Collection Iteration Methods 248 Method of Java Collection iterator() 251 Chapter 6 ◾ Libraries, Packages, and Modules 255 WHAT IS THE LIBRARY IN JAVA? 256 Locating a Library 256 .jar Files Downloading 257
📄 Page 16
Contents ◾ xv Documentation in the Library 257 Classpath 258 What Exactly Is a Java Class Library? 259 Library Classes in Java 260 Making Use of Java Libraries 262 User vs. Builder 263 What Is Included in the Java SDK? 263 WHAT ARE THE PACKAGES IN JAVA? 264 To Compile a Java Package, Follow These Steps 265 To Launch a Java Package Application, Follow These Steps 265 How Do I Go to a Package from Another Package? 266 JAVA SUBPACKAGE 269 How Do I Transfer the Class File to a Different Directory or Drive? 270 Another Approach to Execute this Program Is to Use the Java -Classpath Switch 270 Methods for Loading Class Files or Jar Files Include 271 How Do You Combine Two Public Classes into a Single Package? 271 JAVA ACCESS MODIFIERS 272 Private Constructor’s Role 274 Access Modifiers with Method Overriding in Java 278
📄 Page 17
xvi ◾ Contents ENCAPSULATION 279 The Benefits of Encapsulation in Java 279 Class Read-Only 281 Class Write-Only 281 CLONING OBJECTS IN JAVA 282 Why Should You Use the Clone() Method? 283 The Benefit of Object Cloning 283 Object Copying Has the Following Disadvantages 283 MODULES IN JAVA 285 Benefits of Java Modules 286 Modular Java Platform for Smaller Application Distribution 286 Internal Package Encapsulation 287 Start Detection of Absent Modules 287 Module Basics in Java 288 Naming a Java Module 288 Module’s Root Directory 288 Module System 289 Modularized Java 9 JDK 290 Module for Java 9 290 Module Name 290 How to Make a Java Module 290 Construct a Directory Structure 290 Source Code for Java 291 Compile Java Module 291 Module Execution 292
📄 Page 18
Contents ◾ xvii WHAT EXACTLY IS MAVEN? 292 What Does Maven Do? 292 Maven’s Core Ideas 293 Maven Installation Procedure 294 pom.xml Maven File 295 Elements Utilized in Creating the pom.xml File 296 Other Pom.xml File Elements 297 The Benefits and Drawbacks of Using Maven 297 Benefits 297 Drawbacks 298 When Should Maven be Used? 298 Maven in Practical Application 298 Maven Repository 298 WHAT EXACTLY IS GRADLE? 299 High Performance 299 The JVM Foundation 299 Conventions 300 Flexibility 300 Gradle: Five Things You Should Know 300 What Is the Difference between Gradle and Maven? 301 Chapter 7 ◾ Java Database Connectivity 303 WHAT IS JDBC IN JAVA? 304 What Are the Benefits of Using JDBC? 305 What Exactly Is API? 306
📄 Page 19
xviii ◾ Contents DRIVER FOR JDBC 306 5 Steps to Connecting a Java Database 309 ORACLE DATABASE CONNECTIVITY IN JAVA 312 Creating a Table 312 Example 313 How to Configure the Temporary Classpath 314 How to Configure the Permanent Classpath 314 MySQL Database Connectivity in Java 315 CONNECTIVITY WITH ACCESS WITHOUT DATA SOURCE NAME (DSN) 316 Example of Connecting a Java Application without a DSN 317 Example of Connecting a Java Application to a DSN 318 DRIVERMANAGER CLASS 319 Interface of Connection 319 Statement Interface 320 DATABASE MANAGEMENT SYSTEM 322 What Exactly Is a Database? 322 Database Management System 322 DBMS Features Include the Usage of a Digital Repository Built on a Server to Store and Manage Information 323 Benefits of DBMS 324 DBMS Disadvantages 325
📄 Page 20
Contents ◾ xix DATABASE 325 What Exactly Is Data? 325 What Exactly Is a Database? 325 DATABASE EVOLUTION 326 File-Based 326 Hierarchical Data Model 327 Network Data Model 328 Relational Database 328 Cloud Database 329 Benefits of a Cloud Database 329 NoSQL DATABASE 330 The Benefit of NoSQL Is Its Scalability 330 The Disadvantage of NoSQL Is That It Is Open Source 330 OBJECT-ORIENTED DATABASES 331 WHAT EXACTLY IS RELATIONAL DATABASE MANAGEMENT? 332 How Does It Work? 332 RDBMS History 333 What Actually Is a Table? 333 What Exactly Is a Field? 333 What Is Row or Record? 333 What Basically Is a Column? 334 What Is the Distinction between DBMS and RDBMS? 334 File System vs. DBMS 336
The above is a preview of the first 20 pages. Register to read the complete e-book.

💝 Support Author

0.00
Total Amount (¥)
0
Donation Count

Login to support the author

Login Now
Back to List