Quick Java

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

"We’ll be doing this next project in Java." Unfortunately, you’re a C++ programmer, or maybe a Python programmer. How are you going to get up to speed in a hurry? There are lots of Java books for beginners, telling you all about what a computer is and how it represents everything in bits. You don’t need that. At the other extreme, there are thousand-page tomes that you aren’t going to get through in a few days, if ever. You need something in-between. This book is intended to fill that gap. It’s written for the programmer who doesn’t need to be taught how to program, just how to do it in Java―and who needs to get started in a hurry. Java is covered from the inside out. First, all the things that go inside a class, most of which are practically identical to C++. After that, all the various and complicated kinds of classes and interfaces and how they relate to each other in large-scale programs. Testing is essential, so (unlike most Java books) JUnit is covered in detail. Then, in case you need to go in that direction, some functional programming, a little about parallel programming, and more than enough to get you started in building GUIs (graphical user interfaces) and doing animation. If you are an experienced programmer, this book is your guide to getting up to speed in Java in a hurry. Not just the language, but also the basics of unit testing, graphical user interfaces, threads, animation, and functional programming. If you are coming from one of the C languages, you will find most of the statement types familiar. These are clearly designated, so you can just skim over that material. If you are coming from C++, you will find the object-oriented concepts are very similar, but the terminology is different. If you are coming from another language, such as Python, there is very little you can skip. Sorry. There’s a lot in this little book and, despite my best efforts, you won’t learn Java in a weekend. But it should be a good start. Features: Circular approach allows very fast entry into Java Full description of JUnit testing Summary of functional programming in Java Introduction to synchronization and parallel processing Extensive description of building GUIs

Author(s): David Matuszek
Publisher: CRC Press
Year: 2023

Language: English
Pages: 235

Cover
Half Title
Title Page
Copyright Page
Dedication
Contents
Author
Preface
Versions
Chapter 1. A Lightning Tour of Java
1.1 Projects
1.2 First Glimpse: The Circle Class
1.3 Data
1.4 Operators
1.5 Program Structure
1.6 Statements
1.7 Program Execution
1.8 Hello World
Chapter 2. Preliminaries
2.1 IDEs
2.2 Comments and Tags
Chapter 3. The "Inner Language" of Java
3.1 Variables and Naming Conventions
3.2 Basic Data Types
3.2.1 Primitive Types
3.2.2 Arrays
3.2.3 Strings
3.2.4 Exceptions
3.2.5 Operators and Precedence
3.2.6 Declarations and Casting
3.2.7 Constants
3.2.8 Methods
3.2.9 Methods Calling Methods
3.2.10 Overloading
3.2.11 Scope
3.2.11.1 Variables Declared in Classes
3.2.11.2 Variables Declared in Methods
3.2.11.3 Variables Declared in Blocks
3.3 Statement Types
3.3.1 Statements Also in C++
3.3.1.1 Blocks
3.3.1.2 Assignment Statements
3.3.1.3 Method Calls and Varargs
3.3.1.4 If Statements
3.3.1.5 While Loops
3.3.1.6 Do-while Loops
3.3.1.7 Traditional For Loops
3.3.1.8 For-each Loop
3.3.1.9 Classic switch Statements
3.3.1.10 Labeled Statements
3.3.1.11 Break Statements
3.3.1.12 Continue Statements
3.3.1.13 Return Statements
3.3.1.14 Empty Statements
3.3.2 Statements Not in C++
3.3.2.1 Assert Statements
3.3.2.2 Print "Statements"
3.3.2.3 Switch Statements and Expressions
3.3.2.4 Pattern Matching in switch Statements
3.3.2.5 Try-catch-finally
3.3.2.6 Throw Statements
3.3.3 Reading from a File
3.3.4 Try With Resources
3.3.5 Writing to a File
3.4 Classes and Objects
3.4.1 Some Useful Objects
3.4.1.1 String Objects
3.4.1.2 StringBuilder Objects
3.4.1.3 Using Scanner
3.4.1.4 Console
3.4.1.5 Objects, Generics, and Stacks
3.4.1.6 Maps
3.4.1.7 The Java API
3.5 Objects and Classes
Chapter 4. The "Outer Language" of Java
4.1 Class Structure
4.1.1 A Simple Class
4.1.2 The Class Header
4.1.3 Interfaces I
4.1.4 Fields
4.1.5 Constructors I
4.1.6 Defining Methods
4.1.7 Example: Bank Account
4.1.8 References
4.1.9 Constructors II
4.1.10 Static
4.1.11 Escaping Static
4.1.12 The Main Method
4.1.13 A More Complete Example
4.2 Inheritance
4.3 Casting Objects
4.4 Overriding
4.4.1 Overriding toString
4.4.2 Overriding Equals
4.4.3 Overriding HashCode
Chapter 5. Advanced Java
5.1 Information Hiding
5.1.1 Reasons for Privacy
5.1.2 Getters and Setters
5.1.3 Private Constructors
5.2 The Inner Language
5.2.1 General
5.2.1.1 Ordering
5.2.1.2 Javadoc
5.2.1.3 Var Declarations
5.2.1.4 Namespaces
5.2.2 Data
5.2.2.1 Wrapper Classes
5.2.2.2 Integers
5.2.2.3 Doubles
5.2.2.4 Characters and Unicode
5.2.2.5 Booleans
5.2.2.6 Other Primitives
5.2.2.7 Arrays
5.2.2.8 Strings
5.2.2.9 Multiline Strings
5.2.2.10 Formatter
5.2.2.11 Regular Expressions
5.2.3 Collections
5.2.3.1 Iterators
5.2.4 Additional Operators
5.2.4.1 instanceof
5.2.4.2 The Ternary Operator
5.2.4.3 Bit and Shift Operators
5.2.4.4 Increment and Decrement Operators
5.3 The Outer Language
5.3.1 Generic Classes
5.3.2 Interfaces II
5.3.3 Abstract Classes
5.3.4 Final and Sealed Classes
5.3.5 Inner Classes
5.3.5.1 Member Classes
5.3.5.2 Static Member Classes
5.3.5.3 Local Inner Classes
5.3.5.4 Anonymous Inner Classes
5.3.6 Enums
5.3.7 Records
5.3.8 Serialization
5.3.9 Modules
5.3.10 Build Tools
Chapter 6. Functional Programming
6.1 Function Literals
6.2 Functional Interfaces
6.3 Implicit Functional Interfaces
6.4 Persistent Data Structures
Chapter 7. Unit Testing
7.1 Philosophy
7.2 What to Test
7.3 JUnit
7.4 JUnit 5 Assertions
7.5 Testing Exceptions
7.6 Assumptions
7.7 Simple Test Example
Chapter 8. GUIs and Dialogs
8.1 A Brief History
8.2 Dialogs
8.2.1 Message Dialog
8.2.2 Confirm Dialog
8.2.3 Input Dialog
8.2.4 Option Dialog
8.2.5 Color Chooser Dialog
8.2.6 Load File Dialog
8.2.7 Save File Dialog
8.2.8 Custom Dialog
Chapter 9. How to Build a GUI Program
9.1 Event-Driven Programs
9.2 The Event Dispatch Thread
9.3 Import the Necessary Packages
9.4 Make a Container
9.5 Add a Layout Manager
9.6 Create Components
9.7 Add Listeners
9.8 Sample Code
9.8.1 JFrame and JPanel
9.8.2 JEditorPane
9.8.3 JScrollPane
9.8.4 JTabbedPane
9.8.5 JButton
9.8.6 JTextField
9.8.7 JTextArea
9.8.8 JCheckBox
9.8.9 JRadioButton
9.8.10 JLabel
9.8.11 JComboBox
9.8.12 JSlider
9.8.13 JSpinner
9.8.14 JProgressBar
9.8.15 Menus
9.8.16 Keyboard Input
9.8.17 Mouse Input
9.9 DiceRoller
Chapter 10. Threads and Animation
10.1 Threads
10.2 Synchronization
10.3 Timers
10.4 Property Changes
10.5 SwingWorker
10.6 The Bouncing Ball
10.6.1 MVC
10.6.2 Controller
10.6.3 Model
10.6.4 View
Appendix A. Code for BouncingBall
Bouncing Ball: Controller
Bouncing Ball: Model
Bouncing Ball: View
Index