The Java Workshop
A Practical, No-Nonsense Introduction to Java Development
David Cuartielles, Andreas Göransson, Eric Foster-Johnson
- 604 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
The Java Workshop
A Practical, No-Nonsense Introduction to Java Development
David Cuartielles, Andreas Göransson, Eric Foster-Johnson
About This Book
Get to grips with the fundamentals of Java programming and learn to build useful applications with the help of real-world examples and engaging practical activities
Key Features
- Build a solid foundation in Java and focus on developing real-world applications
- Implement the fundamental concepts of object-oriented programming in your code
- Work with external data storage systems and learn how to efficiently handle data
Book Description
Java is a versatile, popular programming language used across a wide range of industries. Learning how to write effective Java code can take your career to the next level, and The Java Workshop will help you do just that. This book is designed to take the pain out of Java coding and teach you everything you need to know to be productive in building real-world software.
The Workshop starts by showing you how to use classes, methods, and the built-in Collections API to manipulate data structures effortlessly. You'll dive right into learning about object-oriented programming by creating classes and interfaces and making use of inheritance and polymorphism. After learning how to handle exceptions, you'll study the modules, packages, and libraries that help you organize your code. As you progress, you'll discover how to connect to external databases and web servers, work with regular expressions, and write unit tests to validate your code. You'll also be introduced to functional programming and see how to implement it using lambda functions.
By the end of this Workshop, you'll be well-versed with key Java concepts and have the knowledge and confidence to tackle your own ambitious projects with Java.
What you will learn
- Write clean, well-commented Java code that's easy to maintain
- Debug logical errors and handle exceptions in your Java programs
- Implement object-oriented and functional programming paradigms
- Use regular expressions to search for information in text data
- Work with information stored in databases using JDBC
- Make HTTP requests from Java applications and parse the response data
- Secure your data with cryptography and encryption
- Write unit tests to validate your code with JUnit
Who this book is for
This Java coding book is designed for anyone who is new to Java. Whether you're an aspiring software developer, or are just curious about learning to code, then this book will get you on the right track. No prior programming experience is required.
Frequently asked questions
Information
1. Getting Started
Introduction
Writing, Compiling, and Executing Your Hello World Program
- static signifies that there is nothing in the system instantiating the main method. Because of the way the Java Virtual Machine works, the main method needs to be static, or it will not be possible to execute it.
- void indicates that the main method will not be returning anything to any code calling it. Methods could, in fact, send an answer to a piece of code executing it, as we will see later in the book.
- main is the name of the method. You cannot assign this a different name, since it is the method that makes the program executable and needs to be named this way.
- String[] args are the parameters of the main method. Parameters are passed as a list of strings. In other words, the program could take arguments from other parts within your computer and use them as data. In the particular case of the main method, these are strings that could be entered on the command-line interface (CLI) when calling the program.
Exercise 1: Creating Your Hello World Program in Java
- Open IntelliJ and you will see a window giving you several options. Click on Create New Project. It should be the first option in the list:
- A new interface should appear. The default options here are meant for creating a Java program, so you just need to click Next:
- Check the box to create the project from a template. Click on Java Hello World and then click Next:
- Name the project chapter01. Then, click Finish:
- As we haven't chosen a folder to store the projects (intentionally), IntelliJ will offer you the possibility to create a default project folder inside your user space. Click OK:
- You will see a popup with tips on how to use the software. If you have never used a development environment of this type before, then this is a good way to get information about how it functions every time IntelliJ boots up. Choose your preferences and then click Close:
- IntelliJ reminds you regarding the possibility of using a special tab dedicated to learning more about the environment in relation to programming. Click Got It.
- The editor presents a menu bar, a code navigation bar, a project navigation area, and the actual editor where you can see the code we explained earlier. Now it is time to test it. Click on the Run button (this is the triangle on the right-hand side of the code navigation bar).
- When the program runs, a terminal window unfolds at the bottom of IntelliJ. Here, you can see how the software called your JVM, the program's outcome, and a line from the ...