Skip to main content
main-content

Über dieses Buch

Learn the basics of Java 9, including basic programming concepts and the object-oriented fundamentals necessary at all levels of Java development. Author Kishori Sharan walks you through writing your first Java program step-by-step. Armed with that practical experience, you'll be ready to learn the core of the Java language. Beginning Java 9 Fundamentals provides over 90 diagrams and 240 complete programs to help you learn the topics faster.
The book continues with a series of foundation topics, including using data types, working with operators, and writing statements in Java. These basics lead onto the heart of the Java language: object-oriented programming. By learning topics such as classes, objects, interfaces, and inheritance you'll have a good understanding ofJava's object-oriented model.
The final collection of topics takes what you've learned and turns you into a real Java programmer. You'll see how to take the power of object-oriented programming and write programs that can handle errors and exceptions, process strings and dates, format data, and work with arrays to manipulate data.
This book is a companion to two other books also by Sharan focusing on APIs and advanced Java topics.
What You’ll LearnWrite your first Java programs with an emphasis on learning object-oriented programming in Java
Work with data types, operators, statements, classes and objects
Handle exceptions, assertions, strings and dates, and object formatting
Use regular expressions
Work with arrays, interfaces, enums, and inheritance
Deploy Java applications on memory-constrained devices using compact profiles
Take advantage of the new JShell REPL tool
Who This Book Is For
Those who are new to Java programming, who may have some or even no prior programming experience.

Inhaltsverzeichnis

Frontmatter

Chapter 1. Programming Concepts

Abstract
The general concept of programming
Kishori Sharan

Chapter 2. Setting Up the Environment

Abstract
What software you need to write, compile, and run Java programs
Kishori Sharan

Chapter 3. Writing Java Programs

Abstract
You might think—how hard would it be to print a message in Java? In fact, it is not hard to print a message in Java.
Kishori Sharan

Chapter 4. Data Types

Abstract
I use a lot of snippets of code in this chapter. The quickest way to evaluate those snippets and see the results is to use the JShell tool.
Kishori Sharan

Chapter 5. Operators

Abstract
The different types of operators available in Java
Kishori Sharan

Chapter 6. Statements

Abstract
Expressions in Java consist of literals, variables, operators, and method invocation and they are the building blocks of a Java program. An expression is evaluated and the evaluation may produce a variable, a value, or nothing.
Kishori Sharan

Chapter 7. Classes

Abstract
Let’s start with a simple example of a class in the real world to build the technical concept of a class in Java.
Kishori Sharan

Chapter 8. Methods

Abstract
What methods are and how to declare methods in a class
Kishori Sharan

Chapter 9. Constructors

Abstract
A constructor is a named block of code that is used to initialize an object of a class immediately after the object is created. The structure of a constructor looks similar to a method. However, the similarity between the two stops right there, in their looks. They are two different constructs and they are used for different purposes.
Kishori Sharan

Chapter 10. Modules

Abstract
The code for some examples in this chapter goes through several steps. The source code for this book contains the code used in the final step for those examples. If you want to see those examples in action at every step as you read through this chapter, you need to modify the source code a bit to keep it in sync with the step you are working on.
Kishori Sharan

Chapter 11. Object and Objects Classes

Abstract
About the hierarchical class structure in Java
Kishori Sharan

Chapter 12. Wrapper Classes

Abstract
In previous chapters, you learned that primitive and reference types are not assignment compatible. You cannot even compare a primitive value with an object reference. Some parts of the Java library work only with objects; for example, collections in Java work only with objects.
Kishori Sharan

Chapter 13. Exception Handling

Abstract
About error handling in Java using exceptions
Kishori Sharan

Chapter 14. Assertions

Abstract
What an assertion is in Java
Kishori Sharan

Chapter 15. Strings

Abstract
A string literal consists of a sequence of zero or more characters enclosed in double quotes.
Kishori Sharan

Chapter 16. Dates and Times

Abstract
About the design principles behind the Date-Time API
Kishori Sharan

Chapter 17. Formatting Data

Abstract
How to format and parse dates and numbers
Kishori Sharan

Chapter 18. Regular Expressions

Abstract
How to create regular expressions
Kishori Sharan

Chapter 19. Arrays

Abstract
All example programs in this chapter are a member of a jdojo.array module, as declared in Listing 19-1.
Kishori Sharan

Chapter 20. Inheritance

Abstract
All example programs in this chapter are a member of a jdojo.inheritance module, as declared in Listing 20-1.
Kishori Sharan

Chapter 21. Interfaces

Abstract
How to declare interfaces
Kishori Sharan

Chapter 22. Enum Types

Abstract
An enum (also known as enumeration and enumerated data type) lets you create an ordered list of constants as a type. Before we discuss what an enum is and why we need it, let’s consider a problem and solve it using Java features that were available before enum, which was introduced in Java 5.
Kishori Sharan

Chapter 23. Java Shell

Abstract
In this chapter, the main topic of discussion is JShell, which can be used as a command-line tool and as a Java API. "The JShell command-line tool" refers to the capability of JShell being used as a command-line tool.
Kishori Sharan

Backmatter

Weitere Informationen

Premium Partner

    Bildnachweise