Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Learn Java 12 Programming
Learn Java 12 Programming

Learn Java 12 Programming: A step-by-step guide to learning essential concepts in Java SE 10, 11, and 12

eBook
₹799.99 ₹2323.99
Paperback
₹2904.99
Subscription
Free Trial
Renews at ₹800p/m

What do you get with a Packt Subscription?

Free for first 7 days. ₹800 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Learn Java 12 Programming

Getting Started with Java 12

This chapter is about how to start learning Java 12 and Java in general. We will begin with the basics, first explaining what Java is and its main terms, followed by how to install the necessary tools to write and run (execute) a program. In this respect, Java 12 is not much different to the previous Java versions, so this chapter's content is applies to the older versions too.

We will describe and demonstrate all the necessary steps for building and configuring a Java programming environment. This is the bare minimum that you have to have on the computer in order to start programming. We also describe the basic Java language constructs and illustrate them with examples that can be executed immediately.

The best way to learn a programming language, or any language for that matter, is to use it, and this chapter guides the reader on how they can...

How to install and run Java

When somebody says "Java," they may mean quite different things:

  • Java programming language: A high-level programming language that allows an intent (a program) to be expressed in a human-readable format that can be translated in the binary code executable by a computer
  • Java compiler: A program that can read a text written in the Java programming language and translate it into a bytecode that can be interpreted by Java Virtual Machine (JVM) in the binary code executable by a computer
  • Java Virtual Machine (JVM): A program that reads a compiled Java program and interprets it into the binary code that is executable by a computer
  • Java Development Kit (JDK): The collection of programs (tools and utilities), including Java compiler, JVM, and supporting libraries, which allow the compilation and execution of a program written in the Java language...

How to install and run an IDE

What used to be just a specialized editor that allowed checking the syntax of the written program the same way a Word editor checks the syntax of an English sentence gradually evolved into an Integrated Development Environment (IDE). This bears its main function in the name. It integrates all the tools necessary for writing, compiling, and then executing a program under one Graphical User Interface (GUI). Using the power of Java Compiler, the IDE identifies syntax errors immediately and then helps to improve code quality by providing context-dependent help and suggestions.

Selecting an IDE

There are several IDEs available for a Java programmer, such as NetBeans, Eclipse, IntelliJ IDEA, BlueJ...

Java primitive types and operators

With all the main programming tools in place, we can start talking about Java as a language. The language syntax is defined by Java Language Specification, which you can find on https://docs.oracle.com/javase/specs. Don't hesitate to refer to it every time you need some clarification. It is not as daunting as many people assume.

All the values in Java are divided into two categories: reference types and primitive types. We start with primitive types and operators as the natural entry point to any programming language. In this chapter, we will also discuss one reference type called String (see the String type and literals section).

All primitive types can be divided into two groups: the boolean type and the numeric types.

Boolean type

...

String types and literals

We have just described the primitive value types of the Java language. All the other value types in Java belong to a category of reference types. Each reference type is a more complex construct than just a value. It is described by a class, which serves as a template for creating an object, a memory area that contains the values and methods (the processing code) defined in the class. An object is created by the new operator. We will talk about classes and objects in more detail in Chapter 2, Java Object-Oriented Programming (OOP).

In this chapter, we will talk about one of the reference types called String. It is represented by the java.lang.String class, which belongs, as you can see, to the most foundational package of JDK, java.lang. The reason we introduce the String class that early is that it behaves in some respects very similar to primitive types...

Identifiers and variables

From our school days, we have an intuitive understanding of what a variable is. We think of it as a name that represents a value. We solve problems using such variables as x gallons of water or n miles of a distance, and similar. In Java, the name of a variable is called an identifier and can be constructed by certain rules. Using an identifier, a variable can be declared (defined) and initialized.

Identifier

According to Java Language Specification (https://docs.oracle.com/javase/specs), an identifier (a variable name) can be a sequence of Unicode characters that represent letters, digits 0-9, a dollar sign ($), or an underscore (_).

Other limitations are as follows:

  • The first symbol of an identifier...

Java statements

A Java statement is a minimal construct that can be executed. It describes an action and ends with a semicolon (;). We have seen many statements already. For example, here are three statements:

float f = 23.42f;
String sf = String.valueOf(f);
System.out.println(sf);

The first line is a declaration statement combined with an assignment statement. The second line is also a declaration statement combined with an assignment statement and method invocation statement. The third line is just a method invocation statement.

Here is the list of Java statement types:

  • An empty statement that consists of only one symbol, ; (semicolon)
  • A class or interface declaration statement (we will talk about this in Chapter 2, Java Object-Oriented Programming (OOP))
  • A local variable declaration statement: int x;
  • A synchronized statement: this is beyond the scope of this book
  • An expression...

Summary

This chapter introduced you to the exciting world of Java programming. We started with explaining the main terms, and then explained how to install the necessary tools, JDK and IDE, and how to configure and use them.

With a development environment in place, we provided the reader with the basics of Java as a programming language. We have described Java primitive types, the String type, and their literals. We have also defined what an identifier is, and what a variable is, and finished with a description of the main types of Java statements. All the points of the discussion were illustrated by the specific code examples.

In the next chapter, we are going to talk about the object-oriented aspects of Java. We will introduce the main concepts, explain what a class is, what an interface is, and the relationship between them. The terms overloading, overriding, and hiding will...

Quiz

  1. What does JDK stand for?
    1. Java Document Kronos
    2. June Development Karate
    3. Java Development Kit
    4. Java Developer Kit
  1. What does JCL stand for?
    1. Java Classical Library
    2. Java Class Library
    3. Junior Classical Liberty
    4. Java Class Libras
  1. What does Java SE stand for?
    1. Java Senior Edition
    2. Java Star Edition
    3. Java Structural Elections
    4. Java Standard Edition
  1. What does IDE stand for?
    1. Initial Development Edition
    2. Integrated Development Environment
    3. International Development Edition
    4. Integrated Development Edition
  1. What are Maven's functions?
    1. Project building
    2. Project configuration
    3. Project documentation
    4. Project cancellation
  1. What are Java primitive types?
    1. boolean
    2. numeric
    3. integer
    4. string
  1. What are Java primitive types?
    1. long
    2. bit
    3. short
    4. byte
  1. What is a literal?
    1. A letter-based string
    2. A number-based string
    3. A variable representation
    4. A value representation...
Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Strengthen your knowledge of important programming concepts and the latest features in Java
  • Explore core programming topics including GUI programming, concurrency, and error handling
  • Learn the idioms and best practices for writing high-quality Java code

Description

Java is one of the preferred languages among developers, used in everything right from smartphones, and game consoles to even supercomputers, and its new features simply add to the richness of the language. This book on Java programming begins by helping you learn how to install the Java Development Kit. You will then focus on understanding object-oriented programming (OOP), with exclusive insights into concepts like abstraction, encapsulation, inheritance, and polymorphism, which will help you when programming for real-world apps. Next, you’ll cover fundamental programming structures of Java such as data structures and algorithms that will serve as the building blocks for your apps. You will also delve into core programming topics that will assist you with error handling, debugging, and testing your apps. As you progress, you’ll move on to advanced topics such as Java libraries, database management, and network programming, which will hone your skills in building professional-grade apps. Further on, you’ll understand how to create a graphic user interface using JavaFX and learn to build scalable apps by taking advantage of reactive and functional programming. By the end of this book, you’ll not only be well versed with Java 10, 11, and 12, but also gain a perspective into the future of this language and software development in general.

Who is this book for?

Students, software developers, or anyone looking to learn new skills or even a language will find this book useful. Although this book is for beginners, professional programmers can benefit from it too. Previous knowledge of Java or any programming language is not required.

What you will learn

  • Learn and apply object-oriented principles
  • Gain insights into data structures and understand how they are used in Java
  • Explore multithreaded, asynchronous, functional, and reactive programming
  • Add a user-friendly graphic interface to your application
  • Find out what streams are and how they can help in data processing
  • Discover the importance of microservices and use them to make your apps robust and scalable
  • Explore Java design patterns and best practices to solve everyday problems
  • Learn techniques and idioms for writing high-quality Java code

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Apr 30, 2019
Length: 690 pages
Edition : 1st
Language : English
ISBN-13 : 9781789957051
Category :
Languages :

What do you get with a Packt Subscription?

Free for first 7 days. ₹800 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Apr 30, 2019
Length: 690 pages
Edition : 1st
Language : English
ISBN-13 : 9781789957051
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
₹800 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
₹4500 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just ₹400 each
Feature tick icon Exclusive print discounts
₹5000 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just ₹400 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 10,278.97
Java Coding Problems
₹4096.99
Learn Java 12 Programming
₹2904.99
Hands-On Design Patterns with Java
₹3276.99
Total 10,278.97 Stars icon

Table of Contents

24 Chapters
Section 1: Overview of Java Programming Chevron down icon Chevron up icon
Getting Started with Java 12 Chevron down icon Chevron up icon
Java Object-Oriented Programming (OOP) Chevron down icon Chevron up icon
Java Fundamentals Chevron down icon Chevron up icon
Section 2: Building Blocks of Java Chevron down icon Chevron up icon
Exception Handling Chevron down icon Chevron up icon
Strings, Input/Output, and Files Chevron down icon Chevron up icon
Data Structures, Generics, and Popular Utilities Chevron down icon Chevron up icon
Java Standard and External Libraries Chevron down icon Chevron up icon
Multithreading and Concurrent Processing Chevron down icon Chevron up icon
JVM Structure and Garbage Collection Chevron down icon Chevron up icon
Managing Data in a Database Chevron down icon Chevron up icon
Network Programming Chevron down icon Chevron up icon
Java GUI Programming Chevron down icon Chevron up icon
Section 3: Advanced Java Chevron down icon Chevron up icon
Functional Programming Chevron down icon Chevron up icon
Java Standard Streams Chevron down icon Chevron up icon
Reactive Programming Chevron down icon Chevron up icon
Microservices Chevron down icon Chevron up icon
Java Microbenchmark Harness Chevron down icon Chevron up icon
Best Practices for Writing High-Quality Code Chevron down icon Chevron up icon
Java - Getting New Features Chevron down icon Chevron up icon
Assessments Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.7
(6 Ratings)
5 star 33.3%
4 star 33.3%
3 star 0%
2 star 33.3%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Sergio Peris Mar 19, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Este libro es la perfecta guia para aquellas personas que estan aprendiendo Java.Ademas el libro habla muy detalladamente de todas las posibilidades de Java y explica el codigo.Recomiendo este libro para todos los que deseen aprender Java.Ah! Una cosa, el libro esta escrito en ingles.
Amazon Verified review Amazon
Miran Miletic Feb 28, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great book love it
Amazon Verified review Amazon
Simone Nov 06, 2020
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Sicuramente è un ottimo libro, copre tutto quanto c'è da sapere sulla programmazione java di base. Do base ma non troppo in quanto credo che molte delle cose scritte su questo libro non le sappiano neanche i più senior. Ottimo per dare una bella rinfrescata a quanto studiato ed acquisito con l'esperienza.
Amazon Verified review Amazon
Ramona Dec 23, 2020
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Acquistato per mio marito, che è autodidatta. Finora è contento della qualità del prodotto a livello complessità e accessibilità.
Amazon Verified review Amazon
Pedro Mar 14, 2021
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
This book is not to grab it and start coding JAVA... This book is an absolute reference guide and nothing else. If you want to get your hands dirty with code, this book is not for you. If you want to review JAVA concepts and see SNIPPETS, yes, SNIPPETS with minimal effort of separating them and preparing the reader to see code, then... go for it. I give it a 2 because I have to admit it has good points on theory, but in code, na-ah. My suggestion, get another book to learn to code...
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.