Movatterモバイル変換


[0]ホーム

URL:


Packt
Search iconClose icon
Search icon CANCEL
Subscription
0
Cart icon
Your Cart(0 item)
Close icon
You have no products in your basket yet
Save more on your purchases!discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Profile icon
Account
Close icon

Change country

Modal Close icon
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timerSALE ENDS IN
0Days
:
00Hours
:
00Minutes
:
00Seconds
Home> Programming> Programming Language> Learn Java with Projects
Learn Java with Projects
Learn Java with Projects

Learn Java with Projects: A concise practical guide to learning everything a Java professional really needs to know

Arrow left icon
Profile Icon Dr. Seán KennedyProfile Icon Maaike van Putten
Arrow right icon
$29.99
Full star iconFull star iconFull star iconFull star iconHalf star icon4.9(51 Ratings)
eBookNov 2023598 pages1st Edition
eBook
$29.99
Paperback
$37.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Dr. Seán KennedyProfile Icon Maaike van Putten
Arrow right icon
$29.99
Full star iconFull star iconFull star iconFull star iconHalf star icon4.9(51 Ratings)
eBookNov 2023598 pages1st Edition
eBook
$29.99
Paperback
$37.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
$29.99
Paperback
$37.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature iconInstant access to your Digital eBook purchase
Product feature icon Download this book inEPUB andPDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature iconDRM FREE - Read whenever, wherever and however you want
Product feature iconAI Assistant (beta) to help accelerate your learning
OR

Contact Details

Modal Close icon
Payment Processing...
tickCompleted

Billing Address

Table of content iconView table of contentsPreview book icon Preview Book

Learn Java with Projects

Getting Started with Java

Welcome to the exciting world of Java! Java is a very popular programming language. It is a multipurpose, powerful, and popular programming language that has been used by millions of developers worldwide to create a wide variety of applications. And yes, it really is multipurpose since it can be used to create all sorts of applications, from web and mobile apps to game developmentand beyond.

So, you’ve done a great job choosing a (new) language. We’re going to take you on a (hopefully) fascinating journey that will provide you with valuable skills and open new opportunities in the ever-evolving fieldof technology.

What are we waiting for? In this chapter, we’re going to cover the followingmain topics:

  • Java features
  • Installing Java
  • Compiling and runningJava programs
  • Working with anintegrated developmentenvironment (IDE)
  • Creating and running a program withan IDE

Technical requirements

Before diving into the magical world of Java programming, let’s ensure you have the right hardware. If your hardware doesn’t meet these requirements, don’t worry; online alternatives are discussed later in this chapter. If you are using your work laptop, make sure that you have download rights. Here’s a brief overview ofthe requirements:

  • Operating system: Java can run on various operating systems, including Windows, macOS, and Linux. Ensure that you have a recent version of one of these operating systems installed onyour computer.
  • Java Development Kit (JDK): To compile and run Java programs, you’ll need the JDK installed on your system. The JDK includes theJava Runtime Environment (JRE), which contains the necessary libraries and components for running Java applications. We’ll see how to installthis later.
  • System resources: More is always better, but Java isn’t too demanding. It doesn’t require high-end hardware, but it’s still a good idea to have a system with sufficient resources for a smooth development experience. The following are the minimum and recommendedsystem requirements:
    • Minimum requirements:
      • CPU: 1 GHz orfaster processor
      • RAM:2 GB
      • Disk space: 1 GB (for JDK installation andadditional files)
    • Recommended requirements:
      • CPU: 2 GHz or fastermulti-core processor
      • RAM: 4 GBor more
      • Disk space: 2 GB or more (for JDK installation, additional files,and projects)

Keep in mind that these requirements may change with future updates to the JDK and related tools. We have placed the files in a GitHub repository. You can clone the projects with the use of Git and import them to your computer this way. It’s beyond the scope of explaining how to use Git here but it’s recommended to look into it independently. You can access the files and examples used in this bookhere:https://github.com/PacktPublishing/Learn-Java-with-Projects.

Exploring Java features

Java was developed by James Gosling at Sun Microsystems in the mid-1990s. When Java was created, it was originally designed as a language for consumer electronics. It attempted to support complex host architectures, focused on portability, and supported secure networking. However, Java outgrew its own ambitions. It quickly gained momentum as a versatile language for creating enterprise, web, and mobile applications. Today, Java no longer belongs to Sun Microsystems. Oracle Corporation acquired Sun Microsystems in 2010. And with that acquirement, Java became an integral part of Oracle’ssoftware ecosystem.

Java was very unique at the time it was created. The huge success of Java can be attributed to some of its core features. These features were very innovative at the time but are now found in many other (competing) languages. One of the core features is object-oriented programming. OOP allows us to structure our code in a neat way that helps with reusability and maintainability. We’re going to start discussing the core features by having a look atobject-orientedprogramming (OOP).

OOP in Java

Arguably the most important feature of Java is its support for OOP. If you ask any Java developer what Java is, the answer is often that it’s anOOP language.

It’s safe to say that OOP is a key feature.What is this OOP thing? you may wonder. OOP is a programming paradigm. It structures applications to model real-world objects and their interactions and behaviors. Let’s go over the main conceptsof OOP:

  • Objects: This may be stating the obvious but, in OOP,objects are the main building blocks of your program. An object is a representation of a real-world entity, such as a user, an email, or a bank account. Each object has its ownattributes (data fields) andbehaviors (methods).
  • Classes: Objects are created using theirclass. A class is a blueprint for creating objects. It defines the attributes and methods that objects of the class should have. For example, aCar class might define attributes such as color, make, and model, and methods such as start, accelerate,and brake.
  • Inheritance: Another key feature isinheritance. Inheritance allows one class to inherit the attributes and methods of another class. For example,Car could inherit from aVehicle class. We’re not going to cover the details here, but inheritance helps to better structure the code. The code is more reusable, and the hierarchy of related classes opens doors in terms of what we can do withour types.
  • Encapsulation: Encapsulation is giving a class control over its own data. This is done by bundling data (attributes) andmethods that operate on that data. The attributes can only be accessed via these special methods from outside. Encapsulation helps to protect the internal state of an object and allows you to control how the object’s data can be accessed or modified. Don’t worry if this sounds tricky still, we’ll deal with this in moredetail later.
  • PolymorphismandAbstraction: Theseare two key conceptsof OOP that will be explained later when you’re readyfor them.

Working with OOP

I can imagine this all sounds very abstract at this point, but before you know it, you’ll be creating classes and instantiating objects yourself. OOP helps to make code more maintainable, better structured, and reusable. These things really help to be able to make changes to your application, solve problems, and scale upwhen needed.

OOP is just one key feature of Java. Another key feature is that it’s a compiled language. Let’s make sure you understand what is meant bythat now.

Compiled language

Java is acompiled programming language, which means that the source code you write must be transformed into a machine-readable format before it can be interpreted. This machine-readable format is called bytecode. This process is different from that of interpreted languages, where the source code is read, interpreted, and executed on the fly. During runtime, the computer interprets an interpreted language line by line. When a compiled language is running, the computer interprets the bytecode during runtime. We’ll dive deeper into the compilation process in just a bit when we are going to compile our own code. For now, let’s see what the benefits of compiledlanguages are.

Benefits of Java being a compiled language

Compiling code first requires an extra step, and it takes time in the beginning, but it brings advantages. First of all, the performance of compiled languages is typically better than interpreted languages. This is because the bytecode gets optimized for efficient execution on thetarget platform.

Another advantage of compilation is the early detection of syntax errors and certain other types of errors before the code is executed. This enables developers to identify and fix issues before deploying the application, reducing the likelihood ofruntime errors.

Java code is turned into bytecode – a form of binary code - by the compiler. This bytecode is platform-independent. This means that it allows Java applications to run on different operating systems without modification. Platform independence is actually the key feature that we’re going to bediscussing next.

Write once, run anywhere

Java’sWrite Once, Run Anywhere (WORA) principle is another key feature. This used to set Java apart from many other programming languages, but now, this is rather common, and many competing languages also implemented this feature. This principle ensures that Java code can run on different platforms without requiring different versions of the Java code for each platform. This means that a Java program is not tied to any specific operating system orhardware architecture.

When you have different versions of the code for each platform, this means that you have to maintain all these versions of the code as well. Let’s say you have a code base for Linux, macOS, and Windows. When a new feature or a change is required, you need to add this to three places! You can imagine that WORA was a game-changer at the time Java came out. And it leads to an increased reach of your application – any device that can run Java applications canrun yours.

Understanding the WORA elements

The WORA principle is made possible by bytecode and theJava Virtual Machine (JVM). Bytecode is the compiled Java program. The compiler turns the Java code into this bytecode, and this bytecode is platform-independent. It can run on any device that can run thebytecode executer.

This bytecode executer is called the JVM. Each platform (Windows, macOS, Linux, and so on) has its own JVM implementation, which is specifically designed to translate bytecode into native machine code for that platform. Since the bytecode remains the same across platforms, the JVM handles the differences between operating systems and hardware architectures. The WORA principle is explained inFigure 1.1.

Figure 1.1 – The WORA principle in a diagram

Figure 1.1 – The WORA principle in a diagram

You can seethat the compiler creates bytecode and that this bytecode can be picked up by the JVM. The JVM is platform-specific and does the translation to the platform it’s on. There’s more that the JVM does for us, and that is automatic memory management. Let’s explorethis next.

Automatic memory management

Another key feature that made Java great is itsautomatic memory management, which simplifies development and prevents common memory-related errors. Java handles memory allocation and garbage collection for you. The developer doesn’t need to take care of manually managingthe memory.

Nowadays, this is the rule and not the exception. Most other modern languages have automatic memory management as well. However, it is important to know what automatic memory management means. The memory allocation and deallocation are done automatically. This actually leads to simplifying the code. There is no boilerplate code that just focuses on the allocation and deallocation of the memory. This also leads to fewermemory-related errors.

Let’s make sure you understand what is meant by memory allocationand deallocation.

Memory allocation

In code, you create variables. Sometimes, these variables are not simple values but complex objects with many data fields. When you createan object, this object needs to be stored somewhere in the memory of the device that it’s running on. This is calledmemory allocation. In Java, when you create an object, device memory is automatically allocated to store the object’s attributes and associated data. This is different from languages such as C and C++, where developers must manually allocate and deallocate memory. Java’s automatic memory allocation streamlines the development process and reduces the chances of memory leaks or dangling pointers, which can cause unexpected behavior or crashes. It also makes the code cleaner to read, since you don’t need to deal with any allocation ordeallocation code.

Garbage collection

When a memory block is no longer used by the application, it needs to be deallocated. The process Java uses for this is calledgarbage collection. Garbage collection is the process of identifying and reclaiming memory that is no longer in use by a program. In Java, when an object is no longer accessible or needed, the garbage collector automatically frees up the memory occupied by the object. This process ensures that the memory is efficiently utilized and prevents memory leaks and the problems that comewith it.

The JVM periodically runs the garbage collector to identify and clean up unreachable objects. Java’s garbage collection mechanism uses many different sophisticated algorithms to determine when an object is nolonger needed.

Now that we’ve covered the basics, let’s move on toinstalling Java.

Installing Java

Before you can start writing and running Java programs, you’ll need to set up the JDK on your computer. The JDK contains essential tools and libraries required for Java development, such as the Java compiler, the JRE, and other useful utilities thathelp development.

We will guide you through the process of installing Java on Windows, macOS, and Linux, and we’ll give you some suggestions for when you don’t have access to either one of those. But before proceeding with the installation of Java, it’s a good idea to check whether it’s already installed onyour system.

Checking whether Java is installed on your system

Java may have been pre-installed, or you may have installed it previously without realizing it. To check whether Java is installed, follow these simple steps. The first one depends on youroperating system.

Step 1 – Open a terminal

For Windows, press theWindows key, typecmd, and pressEnter to open theCommand Prompt.

For macOS, pressCommand +Space to open theSpotlight search, typeTerminal, and pressEnter toopenTerminal.

For Linux, open a Terminal window. The method for opening the Terminal window varies depending on your Linux distribution (for example, in Ubuntu, pressCtrl +Alt +T).

Step 2 – Check for the Java version

In the Command Prompt or Terminal window, type the following command andpressEnter:

java -version

Step 3 – Interpret the response

If Java is installed, you will see the version information displayed. If not, the Command Prompt will display an error message, indicating that Java is not recognizedor found.

If you find that Java is already installed on your system, make sure it’s version 21 or later to ensure compatibility with modern Java features. If it’s an older version or not installed, proceed with the installation process for your specific platform, as described in the following sections. If an older version is installed, you may want to uninstall this first to avoid having an unnecessarily complicated setup. You can install this the common way of uninstalling programs for youroperating system.

InFigure 1.2 andFigure 1.6, you’ll see examples of the output you can expect when Javais installed.

Figure 1.2 – The macOS terminal output where Java 19 is installed

Figure 1.2 – The macOS terminal output where Java 19 is installed

Now, let’s see how to install Java on eachoperating system.

Installing Java on Windows

To install Java on a Windows operating system, followthese steps:

  1. Visit theOracle Java SE Downloads page athttps://www.oracle.com/java/technologies/downloads/. This software can be used for educational purposes for free, but requires a license in production. You can considerswitching toOpenJDK to run programs in production without alicense:https://openjdk.org/install/.
  2. Select the appropriate installer for your Windows operating system (for example,Windowsx64 Installer).
  3. Download the installer by clicking on thefile link.
  4. Run the downloaded installer (the.exe file) and follow the on-screen instructions to completethe installation.
  5. To add Java to the system’sPATH environment variable, search forEnvironment Variables in theStart menu and selectEdit the system environment variables. You should see a screen similar toFigure 1.3.
Figure 1.3 – The System Properties window

Figure 1.3 – The System Properties window

  1. In theSystem Properties window, click on theEnvironment Variables… button. A screen like the one inFigure 1.4 willpop up.
  2. UnderSystem variables, find thePath variable, select it, and clickEdit. You can see an example of which one to select in the followingFigure 1.4:
Figure 1.4 – The Environment Variables window

Figure 1.4 – The Environment Variables window

  1. ClickNew… and add the path to thebin folder of your Java installation (for example,C:\Program Files\Java\jdk-21\bin). InFigure 1.5, this has beendone already.
Figure 1.5 – Adding the path to Java to the Path variable

Figure 1.5 – Adding the path to Java to the Path variable

  1. ClickOK to save the changes and close theEnvironmentVariables windows.
  2. Verify Java is installed by opening the Command Prompt (reopen it if you have it open already) and then typingthe following:
    java -version
  3. The output should look as shown inFigure 1.6. However, your version should be 21 or higher to keep up with all the snippets inthis book.

=

Figure 1.6 – Command Prompt after Java version check after installing Java

Installing Java on macOS

To install Java on a macOS operating system, followthese steps:

  1. Visit theOracle Java SE Downloads pageathttps://www.oracle.com/java/technologies/javase-jdk16-downloads.html.
  2. Select the macOS installer (for example,macOSx64 Installer).
  3. Download the installer by clicking on thefile link.
  4. Run the downloaded installer (the.dmg file) and follow the on-screen instructions to completethe installation.
  5. Java should be automatically added to your system’sPATH environment variable. To verify the installation, open the Terminal and run thefollowing command:
    java -version
  6. You should see the version of Java you just installed, similar toFigure 1.2.

Installing Java on Linux

Installing on Linux can be a little bit tricky to explain in a few steps. Different Linux distributions require different installation steps. Here, we will see how to install Java on a LinuxUbuntu system:

  1. Open theTerminaland update your package repository by running thefollowing command:
    sudo apt-get update
  2. Install the default JDK package by running thefollowing command:
    sudo apt install default-jdk
  3. To verify the installation, run thejava -version command. You should see the version of Java youjust installed.
  4. If you need to set theJAVA_HOME environment variable (which you won’t need for working your way through this book but will need for doing more complex Java projects), you first need to determine the installation path by running thefollowing command:
    sudo update-alternatives --config java
  5. Take note of the path displayed (forexample,/usr/lib/jvm/java-19-openjdk-amd64/bin/java).
  6. Open the/etc/environment file in a text editor withroot privileges:
    sudo nano /etc/environment
  7. Add the following line at the end of the file, replacing the path with the path you noted inStep 4 (excluding the/bin/java part):
    JAVA_HOME="/usr/lib/jvm/java-19-openjdk-amd64"
  8. Save and close the file. Then, run the following command to applythe changes:
    source /etc/environment

Now, Java should be installed and configured on your Linuxoperating system.

Running Java online

If you don’t have access to a computer with macOS, Linux, or Windows, there are online solutions out there. The free options are not perfect but, for example, thew3schools solution for trying Java in the browser is not bad at all. There are quite a few of theseout there.

In order to work with multiple files there might be free tools out there, but most of them are paid. A currentlyfree one that we would recommend is onreplit.com. You can find ithere:https://replit.com/languages/java.

You need to sign up, but you can work for free with multiple files and save them on your account. This is a good alternative if you would for example only have a tablet to follow along withthis book.

Another option would be to useGitHub Codespaces:https://github.com/codespaces. They have the opportunity to enter a repository (for example the one we use for this book) and directly try the examples that are available in the repo and adjust them to trynew things.

Having navigated through the installation of Java, it’s time to talk about compiling andrunning programs.

Writing our first program

Before diving into the process of compiling and running Java programs, let’s create a simple Java program using a basic text editor. This will help you understand the structure of a Java program and how to write and save a Java source code file. For this example, we will create a “Hello world!” program that will be used to demonstrate the process of compilationand execution.

Hello world

You may have heard of“Hello world!” programs. They are a common way to start learning a new programming language. It’s a simple program that prints the message"Hello world!" to the console. Writing this program will provide you with a very basic understanding of Java syntax, and it will help you to become familiar with the process of writing, compiling, and runningJava code.

Steps to create the program

Alright, let’s startcoding. Here arethe steps:

  1. First, open a basic text editor on your computer.Notepad on Windows,TextEdit on macOS, orGedit on Linux aresuitable options.
  2. Write the following Java code in yourtext editor:
    public class HelloWorld {    public static void main(String[] args) {        System.out.println("Hello world!");    }}
  3. Save the file asHelloWorld.java in a directory of your choice. Don’t forget the.java extension when saving the file. This indicates that the file contains Java source code. The code should not have.txt after.java. This happens sometimes in Windows, so makesure to not select the text file in thefiletype dropdown.

TextEdit – file extension issues

The later versions of macOS have some issues withTextEdit. You can’t save it as a Java file by default. In order to enable this, you need to go toFormat |Make Plain Text andselectUTF-8.

After this, you can save it as a.java file. You may still run into encoding errors; the problem is with the encoding, and fixing it might be a lot of effort missing the goal of this exercise. It might be better to downloadNotepad++,TextPad, orSublime for this part. Or go ahead and download theHelloWorld.java file from ourGitHub repository.

Understanding the program

Let’s have a look at the code we just used. First of all, be aware that this iscase-sensitive. That means that when you look at the code, most things will not work as you expect if you mix up lowercaseand uppercase.

First, we created a class namedHelloWorld with amain method. We’ll cover classes and methods in a lot more detail, of course. But a class is the fundamental building block of Java applications, and it can contain methods. Methods can be executed to do things –things beingexecuting statements.

Themain method is a special method. It is the entry point of our Java program and contains the code that will be executed when the program is run. The line withSystem.out.println("Hello world!"); writes theHello world! message to the console. Please note, thatprintln stands for print line, so it uses a lowercaseL and not anuppercasei.

With theHelloWorld.java file saved, we are now ready to move on to the next section, where we will learn how to compile and run the Java program using the command line andan IDE.

Compiling and running Java programs

Now that we have our first program written, let’s discuss how we can compile and run it. We will cover the basics of the compilation process, the role of the JVM, and how to compile and run Java code using the command line andan IDE.

Understanding the compilation process

The source code is written in a human-readable format using the Java programming language. Or at least, we hope that this is your opinion after this book. Before the code can be executed, it must be transformed into a format that the computer can understand. You already know that Java is a compiled language and that this process iscalled compilation.

During compilation, theJava compiler (javac) converts the source code (.java files) into bytecode (.class files). Once the bytecode is generated, it can be executed by the JVM. We have already learned that the JVM is the bytecode executer and that every platform has its own custom JVM enabling the WORA featureof Java.

Compiling the code with javac on the command line

To compile a Java program using the command line, followthese steps:

  1. Open a terminal (Command Prompt on Windows, Terminal on macOSor Linux).
  2. Navigate to the directory containing your Java source code file (for example, the directory of your previously createdHelloWorld.java file). In case you don’t know how to do that, this can be done with thecd command, which stands forchange directory. For example, if I’m in a directory calleddocuments and I want to step into the subfolder calledjava programs, I’d run thecd "java programs" command. The quotes are only needed when there are spaces in the directory name. It’s beyond the scope of this book to explain how to change directories for any platform. There are many excellent explanations for every platform on how to navigate the folder structure using the command line onthe internet.
  3. Once you’re in the folder containing the Java file, enter the following command to compile the Javasource code:
    javac HelloWorld.java

    If the compilation is successful, a new file with the same name but a.class extension (for example,HelloWorld.class) will be created in the same directory. This file contains the bytecode that can be executed bythe JVM.

Let’s see how we can run thiscompiled code.

Running the compiled code with Java on the command line

To run the compiled Java program, followthese steps:

  1. In the terminal, make sure you are still in the directory containing the.class file.
  2. Enter the following command to executethe bytecode:
    java HelloWorld

The JVM will load and run the bytecode, and you should see the output of your program. In this case, the output will beas follows:

Hello world!

It’s pretty cool that we can write Java in Notepad and run it on the command line, but the life of a modern-day Java developer is a lot nicer. Let’s add IDEs to the mix and see thisfor ourselves.

Working with an IDE

Creating files in text editors is a little old-fashioned. Of course, you can still do it this way – it’s actually an excellent way of becoming an amazing programmer, but it’s also a very frustrating way. There are tools available to do quite a bit of the heavy work for us and to assist us while writing our code. These tools arecalled IDEs.

What is an IDE?

An IDE is a softwareapplication that comes with everything you need to write, compile, run, and test your code. Using an IDE can make it easier to develop all sorts of programs. Not only that but also debugging and managing your code is easier. Comparatively, you can think of an IDE somewhat like Microsoft Office Word for me as I write this book. While I could have written it using Notepad, using Word provides significant advantages. It assists in checking for spelling errors and allows me to easily add and visualize layouts, among other helpful features. This analogy paints a picture of how an IDE doesn’t just provide a platform to write code but also offers a suite of tools to streamline and enhance yourcoding experience.

Choosing an IDE

When it comes to Java development, there are several IDEs available, each with its own set of features and capabilities. In this section, we will discuss the factors to consider when choosing an IDE and help you set up somepopular Java IDEs. Throughout this book, we’ll be working withIntelliJ. Alternatives that are also great would beVS CodeandEclipse.

Factors to consider when choosing an IDE

Most modern IDEs have features such as code completion, debugging, version control integration, and support for third-party tools and frameworks. Some of them have better versions of these than others. Compare and contrast what you prefer when choosing orswitching IDEs.

Some IDEs require a heavier system to run on than others. For example, VS Code is rather lightweight and IntelliJ is rather heavy. Also, VS Code can be used for many languages, including Java. It is uncommon to do a lot of other things with IntelliJ rather than Java. Choose an IDE that provides a balance between features and performance, especially if you have limitedsystem resources.

And of course, it’s possible that the IDE you’d prefer is not available for the platform you’re using. Make sure that it’s available and stable foryour system.

Lastly, and very importantly, think about the costs. Some IDEs are free and others require a paid license. Luckily, many of the ones that require a paid license have a free edition for non-commercial use. So, make sure to also consider your budget and the licensing you need when choosingan IDE.

In the following subsections, we’ll walk you through the steps of setting up the three (currently) most common IDEs forJava development:

  • IntelliJ
  • Eclipse
  • VisualStudio Code

Note

We’ll be working with IntelliJ for the rest ofthis book.

Setting up IntelliJ

So, let’s start with that one. IntelliJ IDEA is a popular Java IDE that was developed byJetBrains. It offers both a freeCommunity Edition and a paidUltimate Edition. It provides a wide range of features, including intelligent code completion, debugging tools, version control integration, and support for variousJava frameworks.

Here are the steps forinstalling IntelliJ:

  1. Visit the IntelliJ IDEA download pageathttps://www.jetbrains.com/idea/download/.
  2. Choose the edition you prefer: the freeCommunity Edition or the paidUltimate Edition. For beginners, the Community Edition is trulygreat already.
  3. Download the installer for your operating system (Windows, macOS,or Linux).
  4. Run the installer and follow the instructions to completethe installation.
  5. LaunchIntelliJ IDEA. If you’re using the Ultimate Edition, you may need to enter your JetBrains account credentials or alicense key.
  6. On theWelcome screen, you can create a newproject, import an existingproject, or explore the available tutorialsand documentation.

Setting up Eclipse

Eclipse is a free, open source Java IDE that is widely used in the Java community. It has been around for a really long time already and quite a lot of companies work with it still. It offers a variety of features, just like IntelliJ. Eclipse can be customized to suit your needs, but its interface may be less intuitive thanother IDEs.

To set up Eclipse, followthese steps:

  1. Visit the Eclipse download pageathttps://www.eclipse.org/downloads/.
  2. Download the Eclipse installer for your operating system (Windows, macOS,or Linux).
  3. Run the installer and selectEclipse IDE for Java Developers from the list ofavailable packages.
  4. Choose an installation folder and follow the instructions to completethe installation.
  5. LaunchEclipse and select a workspace directory. This is where your projects and settings willbe stored.
  6. On theWelcome screen, you can create a new Javaproject, import an existingproject, or explore the available tutorialsand documentation.

Setting up Visual Studio Code

Visual Studio Code, often referred to as VS Code, is a lightweight, free, and open source code editor developed by Microsoft. It’s incredibly popular for all sorts of tasks because it supports a wide range of programming languages. It is a popular choice for developers who prefer a more minimalist and fast-performing environment. All sorts of additions can be added with the useof extensions.

Here are the steps for installing VS Code and preparing it forJava development:

  1. Visit the Visual Studio Code download pageathttps://code.visualstudio.com/download.
  2. Download the installer for your operating system (Windows, macOS,or Linux).
  3. Run the installer and follow the on-screen instructions to completethe installation.
  4. Launch VisualStudio Code.
  5. Open theExtensions view by clicking on theExtensions icon (four squares) on the left side ofthe window.
  6. Search forJava Extension Pack in theExtensions Marketplace and click theInstall button. This extension pack includes various extensions for Java development, such asLanguage Support for Java (TM) by Red Hat,Debugger for Java, andMavenfor Java.
  7. With theJava Extension Pack installed, you can now create or import Java projects. If it doesn’t loaddirectly, you may need to reopenVS Code.

Now that you’ve set up an IDE, let’s create and run a programwith it.

Creating and running a program with an IDE

Working with an IDE such as IntelliJ as compared to working with a plain text editor is a breeze. We’re now going to guide you through creating, running, and debugging a program with the use of IntelliJ. We’ll create the same program as we did when we were using thetext editor.

Creating a program in an IDE

When you use an IDE to type code, you’ll see that it helps you to complete your code constantly. This is considered very helpful by most people, and we hope you’ll enjoy thisfeature too.

In order to get started with IntelliJ, we first need to create a project. Here are the steps for creating ourHello Worldprogram again:

  1. Launch IntelliJ IDEA and click onNew Project from theWelcome screen or go toFile |New |Project.
Figure 1.7 – Initial screen of IntelliJ

Figure 1.7 – Initial screen of IntelliJ

  1. Name theprojectHelloWorld.
  2. SelectJava for the language and make sure that the correct project SDK is selected.ClickNext.
  3. Don’t tick theCreate Git repository box and don’t tick theAdd samplecode box.
  4. ClickCreate to createthe project.
Figure 1.8 – Wizard to create a new project

Figure 1.8 – Wizard to create a new project

  1. Once theproject is created, expand thesrc folder in theProject view on the left. If there is no other folder underneath it, right-click on thesrc folder and selectNew |Java Class. If there is another folder underneath it, there is probably a main folder with a Java folder in there. Right-click on the Java folder and selectNew |Java Class. If it’s called something differently, just right-click on theblue folder.
Figure 1.9 – Create a new Java Class

Figure 1.9 – Create a new Java Class

  1. Name the new classHelloWorld and clickOK. IntelliJ will create a new.java file with theclass definition.
Figure 1.10 – Call the class ”HelloWorld”

Figure 1.10 – Call the class ”HelloWorld”

  1. In theHelloWorld class, write ourmain method:
    public class HelloWorld {    public static void main(String[] args) {        System.out.println("Hello world!");    }}
Figure 1.11 – Code in HelloWorld.java

Figure 1.11 – Code in HelloWorld.java

Now that we’ve written our first program, make sure that it is saved. By default, IntelliJ automatically saves our files. Let’s see whether we can run the programas well.

Running your program

Admittedly, we had to take a few extrasteps to create our program. We had to create a project first. The good news is, running the program is easier! Here’s how todo it:

  1. If you haven’t done so, make sure your changes are saved by pressingCtrl +S (Windows/Linux) orCmd +S (macOS). By default, auto-saveis enabled.
  2. To runthe program, right-click anywhere in theHelloWorld class and selectRun 'HelloWorld.main()'. Alternatively, you can click the green triangle icon next to the main method and selectRun 'HelloWorld.main()'. IntelliJ will compile and runthe program.
Figure 1.12 – Running the program

Figure 1.12 – Running the program

  1. Verify that the output of the program,"Hello world!", is displayed in theRun tool window at the bottom ofthe screen.
Figure 1.13 – Output of the program

Figure 1.13 – Output of the program

Saved and unsaved files

In most IDEs, you can tell whether a file is saved or not by looking at the tab of the open file. It has a dot or an asterisk next to it if it isn’t saved. The dot is missing if it hasbeen saved.

Debugging a program

Our program is quite easy right now, but we may want to step through our program line by line. We can do that by debugging the program. Let’s give our file a little extra content for debugging. This way we can see how to inspect variables, understand the execution flow, and, this way, find the flaws inour code:

  1. Update theHelloWorld.java file with thefollowing code:
    public class HelloWorld {    public static void main(String[] args) {        String greeting = "Hello, World!";        System.out.println(greeting);        int number = 5;        int doubled = doubleNumber(number);        System.out.println("The doubled number is: " +          doubled);    }    public static int doubleNumber(int input) {        return input * 2;    }}
  2. In this updated version of the program, we added a new method calleddoubleNumber, which takes an integer as input and returns its double. In themain method, we call this method and print the result. Don’t worry if you don’t fully get this – we just want to show you how you can step throughyour code.
  3. Save your changes by pressingCtrl +S (Windows/Linux) orCmd +S (macOS).

    Now, let’s debug theupdated program.

  4. Set a breakpoint on the line you want to pause the execution at by clicking in the gutter area next to the line number in the editor. A red dot will appear, indicating a breakpoint. For example, set a breakpoint at the lineint doubled = doubleNumber(number);. An example is shown inFigure 1.7.
Figure 1.14 – Adding a breakpoint on line 7

Figure 1.14 – Adding a breakpoint on line 7

  1. Start thedebugger by right-clicking in theHelloWorld class and selectingDebug 'HelloWorld.main()' or you can click the green play icon next to themain method and select thedebug option. IntelliJ will compile and start the program indebug mode.
  2. When the line with the breakpoint is going to be executed, the program will pause. During the pause, you can use theDebug tool window, which will appear at the bottom of the screen. Here, you can view the state of the program, including the values of local variables and fields. An example is shown inFigure 1.8.
Figure 1.15 – Debug tool window in IntelliJ. The intent of this screenshot is to show the layout and text readability is not required.

Figure 1.15 – Debug tool window in IntelliJ. The intent of this screenshot is to show the layout and text readability is not required.

  1. Use the step controls in theDebug tool window to step through the code (blue arrow with the angle inFigure 1.8), step into the method that is being called (blue arrow down), or continue the execution (green arrow on the left inFigure 1.8).

By following these steps, you can debug Java programs using IntelliJ IDEA and step through the code to see what is happening. This is something that will come in handy to understand what is going on in your code. This process will be similar in other Java IDEs, although the specific steps and interface elementsmay vary.

Exercises

And that’s all theory for this chapter! So, roll up those sleeves, and let’s dive into your first day at Mesozoic Eden. Welcome aboard! Mesozoic Eden is a famous zoo where dinosaurs live that have been brought to live with high end genetic manipulation techniques. Here are some exercises for you to test your knowledgeso far:

  1. Your first task involves welcoming our guests. Modify the following code snippet so that it outputs"Welcome toMesozoic Eden":
    public class Main {    public static void main(String[] args) {        System.out.println("Hello world");    }}
  2. Complete the following programs by filling out the blanks so that it prints out your name and the position you want to have in Mesozoic Eden 5 yearsfrom now:
    public class Main {    public static void main(String[] args) {        __________________________;        String position = "Park Manager";        System.out.println("My name is " + name + "          and I want to be a " ______ " in Mesozoic            Eden.");    }}
  3. We’ve received some questions about opening hours. Complete the following program so that it prints the park’s opening andclosing hours:
    public class Main {    public static void main(String[] args) {        String openingHours = "08:00";        String closingHours = "20:00";    }}
  4. Create a Java project with a package nameddinosaur. You can create a package by right-clicking on thesrc/main/java folder, selecting “new” andchoosing “package”.
  5. Modify the code from exercise 1 so that it prints out"Welcome, [YourName] to Mesozoic Eden!", where[YourName] is replaced by, surprise surprise, your name. Bonus: try to create a separate String variable as shown in the second andthird exercises.
  6. Some guests reported feeling unsafe near the T-Rex. Let’s solve this by adding anotherSystem.out.println to the program of exercise 5. It should print the phrase"Mesozoic Eden is safe and secure." after thewelcome message.

Project

Create a program that simulates a sign at the entrance of Mesozoic Eden. The sign is simulated by printing output to the console. The sign should display a welcome message, the opening and closing hours, and a shortsafety message.

Summary

You’ve made it through the first chapter! And we’ve done a lot already. We kicked off by exploring Java’s key features, such as its OOP approach, the (once unique) WORA principle, its compiled nature, and the super-helpful automatic memory management. These features make Java an incredibly versatile and powerful language – a great choice for different programming tasks, such as web development, desktop apps, mobile apps, and somuch more!

Next, we walked you through the process of installing Java on various platforms: Windows, macOS, and Linux. We also discussed how to check whether Java is already installed on your system. After this part, you can be sure that you have all the essential tools to kick off your Javaprogramming adventure.

After you had Java all setup, we demystified the compilation process and introduced you to the JVM, a vital component of the Java ecosystem that enables the portability of Java code. We then demonstrated how to compile and run Java code using thejavac andjava command-line tools. These tools lay the groundwork for working with Java programs attheir core.

Of course, using the command line for this is great. But nowadays, we more often work with an IDE, and we can just press a button to do all this. So, we mentioned several advantages and nice features of working with an IDE, such as code completion, debugging, and project management. We discussed the factors to weigh up when choosing an IDE and provided guidance on setting up popular IDEs such as IntelliJ IDEA, Eclipse, and VS Code. In this book, we’ll be using IntelliJ throughout forthe examples.

After covering the essentials of IDEs, we delved into creating and running a Java program using an IDE. We explained the structure of a typical Java program and guided you, step by step, through the process of creating, running, and debugging your very firstJava program.

After this, you were ready for the first hands-on project. And now you’re here! All set and ready to take the next step on your Java journey. This next step will be working with variables and primitive data types.Good luck!

Left arrow icon

Page1 of 11

Right arrow icon
Download code iconDownload Code

Key benefits

  • Gain a deep understanding of essential topics that will help you progress with Java
  • Learn by working on mini-projects to help reinforce the concepts you’ve learned
  • Gain comprehensive knowledge of the core concepts of Java
  • Purchase of the print or Kindle book includes a free PDF eBook

Description

Learn Java with Projects bridges the gap between introductory Java guides and verbose, theoretical references. This book is crafted to build a strong foundation in Java programming, starting from the Java environment itself. It goes far beyond a superficial review of the topics; it demonstrates, with practical examples, why these fundamentals are crucial for developing a deep understanding of the language. You'll not only learn about classes and objects but also see how these concepts are used in practical scenarios, enhancing your ability to write clean, efficient code. The engaging projects throughout the book provide real-world applications of complex topics, ensuring you can connect theoretical knowledge with practical skills. What makes this book stand out is the expertise of its authors. Seán, a seasoned university lecturer with over 20 years of experience, brings academic rigor and real-world insights, thanks to his work with a prestigious software company. Maaike, a passionate software developer and award-winning trainer, brings hands-on experience and a love for teaching. By the end of this book, you'll not only understand Java's core concepts and the critical advanced ones, but also gain practical experience through projects that mimic real-life challenges.

Who is this book for?

This book is for anyone looking to learn the core concepts of Java. If you’re learning programming (and Java) for the first time or want to upskill to Java (with experience in a different language), then this book is for you. Prior knowledge of programming is helpful but not necessary.

What you will learn

  • Get to grips with Java fundamentals to build a strong programming foundation
  • Gain a deep understanding of the critical object-oriented principles: encapsulation, inheritance and polymorphism
  • Apply real-world scenarios using classes, objects, and interfaces
  • Master exception handling for robust error management
  • Explore generics and collections to manage complex data structures
  • Utilize lambda expressions and streams for efficient data processing
  • Complete practical projects to reinforce theoretical knowledge

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date :Nov 30, 2023
Length:598 pages
Edition :1st
Language :English
ISBN-13 :9781837638550
Category :

What do you get with eBook?

Product feature iconInstant access to your Digital eBook purchase
Product feature icon Download this book inEPUB andPDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature iconDRM FREE - Read whenever, wherever and however you want
Product feature iconAI Assistant (beta) to help accelerate your learning
OR

Contact Details

Modal Close icon
Payment Processing...
tickCompleted

Billing Address

Product Details

Publication date :Nov 30, 2023
Length:598 pages
Edition :1st
Language :English
ISBN-13 :9781837638550
Category :
Concepts :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99billed monthly
Feature tick iconUnlimited access to Packt's library of 7,000+ practical books and videos
Feature tick iconConstantly refreshed with 50+ new titles a month
Feature tick iconExclusive Early access to books as they're written
Feature tick iconSolve problems while you work with advanced search and reference features
Feature tick iconOffline reading on the mobile app
Feature tick iconSimple pricing, no contract
€189.99billed annually
Feature tick iconUnlimited access to Packt's library of 7,000+ practical books and videos
Feature tick iconConstantly refreshed with 50+ new titles a month
Feature tick iconExclusive Early access to books as they're written
Feature tick iconSolve problems while you work with advanced search and reference features
Feature tick iconOffline reading on the mobile app
Feature tick iconChoose a DRM-free eBook or Video every month to keep
Feature tick iconPLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick iconExclusive print discounts
€264.99billed in 18 months
Feature tick iconUnlimited access to Packt's library of 7,000+ practical books and videos
Feature tick iconConstantly refreshed with 50+ new titles a month
Feature tick iconExclusive Early access to books as they're written
Feature tick iconSolve problems while you work with advanced search and reference features
Feature tick iconOffline reading on the mobile app
Feature tick iconChoose a DRM-free eBook or Video every month to keep
Feature tick iconPLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick iconExclusive print discounts

Frequently bought together


50 Algorithms Every Programmer Should Know
50 Algorithms Every Programmer Should Know
Read more
Sep 2023538 pages
Full star icon4.5 (68)
eBook
eBook
$29.99
$37.99
$37.99
C# 12 and .NET 8 – Modern Cross-Platform Development Fundamentals
C# 12 and .NET 8 – Modern Cross-Platform Development Fundamentals
Read more
Nov 2023828 pages
Full star icon4.4 (74)
eBook
eBook
$35.99
$44.99
Learn Java with Projects
Learn Java with Projects
Read more
Nov 2023598 pages
Full star icon4.9 (51)
eBook
eBook
$29.99
$37.99
Stars icon
Total$120.97
50 Algorithms Every Programmer Should Know
$37.99
C# 12 and .NET 8 – Modern Cross-Platform Development Fundamentals
$44.99
Learn Java with Projects
$37.99
Total$120.97Stars icon

Table of Contents

21 Chapters
Part 1: Java FundamentalsChevron down iconChevron up icon
Part 1: Java Fundamentals
Chapter 1: Getting Started with JavaChevron down iconChevron up icon
Chapter 1: Getting Started with Java
Technical requirements
Exploring Java features
Installing Java
Writing our first program
Compiling and running Java programs
Working with an IDE
Creating and running a program with an IDE
Exercises
Project
Summary
Chapter 2: Variables and Primitive Data TypesChevron down iconChevron up icon
Chapter 2: Variables and Primitive Data Types
Technical requirements
Understanding and declaring variables
Understanding Java’s primitive data types
Screen output
Exercises
Project – dinosaur profile generator
Summary
Chapter 3: Operators and CastingChevron down iconChevron up icon
Chapter 3: Operators and Casting
Technical requirements
Learning how Java’s operators cooperate
Understanding Java’s operators
Explaining Java casting
Exercises
Project – Dino meal planner
Summary
Chapter 4: Conditional StatementsChevron down iconChevron up icon
Chapter 4: Conditional Statements
Technical requirements
Understanding scope
Exploring if statements
Mastering switch statements and expressions
Exercises
Project – Task allocation system
Summary
Chapter 5: Understanding IterationChevron down iconChevron up icon
Chapter 5: Understanding Iteration
Technical requirements
while loops
do-while loops
for loops
break and continue statements
Exercises
Project – Dino meal planner
Summary
Chapter 6: Working with ArraysChevron down iconChevron up icon
Chapter 6: Working with Arrays
Technical requirements
Arrays – what, when, and why?
Declaring and initializing arrays
Short syntax for array initialization
Accessing elements in an array
Working with length and bounds
Iterating over arrays
Handling multidimensional arrays
Using Java’s built-in methods for arrays
Exercises
Project – Dino tracker
Summary
Chapter 7: MethodsChevron down iconChevron up icon
Chapter 7: Methods
Technical requirements
Explaining why methods are important
Understanding the difference between method definition and method execution
Exploring method overloading
Explaining varargs
Mastering call by value
Exercises
Project – Mesozoic Eden assistant
Summary
Part 2: Object-Oriented ProgrammingChevron down iconChevron up icon
Part 2: Object-Oriented Programming
Chapter 8: Classes, Objects, and EnumsChevron down iconChevron up icon
Chapter 8: Classes, Objects, and Enums
Technical requirements
Understanding the differences between classes and objects
Contrasting instance with class members
Exploring the “this” reference
Applying access modifiers
Encapsulation
Mastering advanced encapsulation
Delving into the object life cycle
Explaining the instanceof keyword
Understanding enums
Appreciating records
Exercises
Project – Mesozoic Eden park manager
Summary
Chapter 9: Inheritance and PolymorphismChevron down iconChevron up icon
Chapter 9: Inheritance and Polymorphism
Technical requirements
Understanding inheritance
Applying inheritance
Exploring polymorphism
Contrasting method overriding and method overloading
Exploring the super keyword
Revisiting the protected access modifier
Explaining the abstract and final keywords
Applying sealed classes
Understanding instance and static blocks
Mastering upcasting and downcasting
Exercises
Project
Summary
Chapter 10: Interfaces and Abstract ClassesChevron down iconChevron up icon
Chapter 10: Interfaces and Abstract Classes
Technical requirements
Understanding abstract classes
Mastering interfaces
Examining default and static interface methods
Explaining ‘private’ interface methods
Exploring sealed interfaces
Exercises
Project – unified park management system
Summary
Chapter 11: Dealing with ExceptionsChevron down iconChevron up icon
Chapter 11: Dealing with Exceptions
Technical requirements
Understanding exceptions
Understanding the exception hierarchy
Working with basic I/O operations
Throwing exceptions
The catch or declare principle
Working with inheritance and exceptions
Exercises
Project – dinosaur care system
Summary
Chapter 12: Java Core APIChevron down iconChevron up icon
Chapter 12: Java Core API
Technical requirements
Understanding the Scanner class
Comparing String with StringBuilder
Designing a custom immutable type
Examining List and ArrayList
Exploring the Date API
Exercises
Project – dinosaur care system
Summary
Part 3: Advanced TopicsChevron down iconChevron up icon
Part 3: Advanced Topics
Chapter 13: Generics and CollectionsChevron down iconChevron up icon
Chapter 13: Generics and Collections
Technical requirements
Getting to know collections
List
Set
Map
Basic operations on maps
Queue
Sorting collections
Working with generics
Hashing and overriding hashCode()
Exercises
Project – advanced dinosaur care system
Summary
Chapter 14: Lambda ExpressionsChevron down iconChevron up icon
Chapter 14: Lambda Expressions
Technical requirements
Understanding lambda expressions
Exploring functional interfaces from the API
Mastering method references
Exercises
Project – agile dinosaur care system
Summary
Chapter 15: Streams – FundamentalsChevron down iconChevron up icon
Chapter 15: Streams – Fundamentals
Technical requirements
Understanding stream pipelines
Exploring stream laziness
Creating streams
Mastering terminal operations
Exercises
Project – dynamic dinosaur care system
Summary
Chapter 16: Streams: Advanced ConceptsChevron down iconChevron up icon
Chapter 16: Streams: Advanced Concepts
Technical requirements
Examining intermediate operations
Delving into primitive streams
Mapping streams
Explaining Optionals
Understanding parallel streams
Exercises
Project – dynamic dinosaur care system
Summary
Chapter 17: ConcurrencyChevron down iconChevron up icon
Chapter 17: Concurrency
Technical requirements
Understanding concurrency
Working with threads
Thread management – sleep() and join()
Atomic classes
The synchronized keyword
The Lock interface
Concurrent collections
ExecutorService and thread pools
Data races
Threading problems
Exercises
Project – Park Operations System – the calm before the storm
Summary
IndexChevron down iconChevron up icon
Index
Share Your Thoughts

Recommendations for you

Left arrow icon
LLVM Code Generation
LLVM Code Generation
Read more
May 2025608 pages
eBook
eBook
$29.99
$37.99
Learn Python Programming
Learn Python Programming
Read more
Nov 2024616 pages
Full star icon5 (1)
eBook
eBook
$23.99
$29.99
Domain-Driven Refactoring
Domain-Driven Refactoring
Read more
May 2025324 pages
Full star icon5 (1)
eBook
eBook
$23.99
$29.99
C++ Memory Management
C++ Memory Management
Read more
Mar 2025442 pages
Full star icon5 (2)
eBook
eBook
$25.99
$31.99
Clean Architecture with Python
Clean Architecture with Python
Read more
Jun 2025362 pages
eBook
eBook
$26.99
$33.99
Bare-Metal Embedded C Programming
Bare-Metal Embedded C Programming
Read more
Sep 2024448 pages
eBook
eBook
$25.99
$31.99
Microservices with Go
Microservices with Go
Read more
Jun 2025428 pages
eBook
eBook
$26.99
$33.99
Software Architecture with Spring
Software Architecture with Spring
Read more
Jun 2025464 pages
eBook
eBook
$26.99
$33.99
50 Algorithms Every Programmer Should Know
50 Algorithms Every Programmer Should Know
Read more
Sep 2023538 pages
Full star icon4.5 (68)
eBook
eBook
$29.99
$37.99
$37.99
Right arrow icon

Customer reviews

Top Reviews
Rating distribution
Full star iconFull star iconFull star iconFull star iconHalf star icon4.9
(51 Ratings)
5 star98%
4 star0%
3 star0%
2 star0%
1 star2%
Filter icon Filter
Top Reviews

Filter reviews by




Sandra Patricia Bermudez KasperczakFeb 22, 2024
Full star iconFull star iconFull star iconFull star iconFull star icon5
Feefo Verified reviewFeefo
N/AFeb 21, 2024
Full star iconFull star iconFull star iconFull star iconFull star icon5
Feefo Verified reviewFeefo
Armando HerreraFeb 08, 2024
Full star iconFull star iconFull star iconFull star iconFull star icon5
Feefo Verified reviewFeefo
Karol PiatekJul 10, 2024
Full star iconFull star iconFull star iconFull star iconFull star icon5
In the software engineering world dominated by Python and Golang,there is a big universe where T-Rex 21, Java, is still a first-class citizen.This book is for you if you start your journey with software developmentor Java is your bread and butter.I highly recommend all exercises, especially in my favourite chaptersabout lambda functions and primitive streams.I highly recommend the book, and I can not wait for the next editionon Java Vector API and more advanced topics.As for Sean and Maaike,they prove, that learning new skills can be a lot of fun.
Amazon Verified reviewAmazon
MS MARY GIBLINJan 26, 2024
Full star iconFull star iconFull star iconFull star iconFull star icon5
As someone deeply invested in the programming world, I was eager to delve into "Learn Java with Projects" by Maaike van Putten and Dr. Sean Kennedy (Let’s Get Certified). Learn Java with Projects is a comprehensive journey into the world of Java programming. The philosophy that mastery in programming comes from hands-on practice. Is brought to life in this book. The integration of theory with practical application underpins the material, highlighting van Putten and Kennedy's extensive experience in teaching and training. The choice of examples and projects around dinosaurs is a breath of fresh air in technical education and makes for a fun learning approach. The book uses diagrams effectively to explain concepts e.g. In-memory representation of immutable types. The book delves into the nuances of java Programming which is a necessity for anyone planning to take certification exams. The full chapter on Lambda expressions greatly clarified the topic for me. Two full chapters on Streams is noteworthy for anyone developing Microservices with Java. One possible enhancement for the book could be to list or index Java 21 features separately. While these features are embedded within the chapters, having them distinctly listed or indexed would make it easier for readers to quickly reference these latest language updates. "Learn Java with Projects" is a great resource. I would recommend this book for anyone whether you are a beginner, gearing up for certification or an experience programmer that wants to brush up on your skills.
Amazon Verified reviewAmazon
  • Arrow left icon Previous
  • 1
  • 2
  • 3
  • 4
  • 5
  • ...
  • Arrow right icon Next

People who bought this also bought

Left arrow icon
50 Algorithms Every Programmer Should Know
50 Algorithms Every Programmer Should Know
Read more
Sep 2023538 pages
Full star icon4.5 (68)
eBook
eBook
$29.99
$37.99
$37.99
Event-Driven Architecture in Golang
Event-Driven Architecture in Golang
Read more
Nov 2022384 pages
Full star icon4.9 (11)
eBook
eBook
$29.99
$37.99
The Python Workshop Second Edition
The Python Workshop Second Edition
Read more
Nov 2022600 pages
Full star icon4.6 (22)
eBook
eBook
$31.99
$38.99
Template Metaprogramming with C++
Template Metaprogramming with C++
Read more
Aug 2022480 pages
Full star icon4.6 (14)
eBook
eBook
$28.99
$35.99
Domain-Driven Design with Golang
Domain-Driven Design with Golang
Read more
Dec 2022204 pages
Full star icon4.4 (19)
eBook
eBook
$26.99
$33.99
Right arrow icon

About the authors

Left arrow icon
Profile icon Dr. Seán Kennedy
Dr. Seán Kennedy
LinkedIn icon
Seán Kennedy is a university lecturer with over 20 years of experience in teaching. He has a PhD in IT and is Oracle-certified in Java at the Professional level (OCP). In his daily work, he teaches Java on a bespoke master's program for a highly regarded software company. He has a YouTube channel called Let's Get Certified that teaches Java at all levels and prepares candidates for Java certification. He also has similar courses on Udemy. Outside of work, he enjoys tennis, walking, nature, reading, and TV.
Read more
See other products by Dr. Seán Kennedy
Profile icon Maaike van Putten
Maaike van Putten
LinkedIn iconGithub icon
Maaike is a software consultant and trainer with a passion for sharing her expertise to empower others in their careers. Her love for software development shows in the numerous software development projects she participated in and the many certifications she obtained. She has designed and delivered a broad spectrum of training courses catering to beginners and seasoned developers in Java, Python, C# and many other languages and frameworks. Next to that, she has authored multiple books and online courses through multiple platforms reaching over 500,000 learners across the globe.
Read more
See other products by Maaike van Putten
Right arrow icon
Getfree access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook?Chevron down iconChevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website?Chevron down iconChevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook?Chevron down iconChevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support?Chevron down iconChevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks?Chevron down iconChevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook?Chevron down iconChevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.


[8]ページ先頭

©2009-2025 Movatter.jp