49,19 €
This comprehensive guide introduces readers to Java programming from the ground up, beginning with the language’s history, installation, and core syntax. Early chapters cover imperative programming concepts, object-oriented principles, and essential data types like arrays and strings. As the journey progresses, readers explore custom classes, inheritance, interfaces, exceptions, and nested types, building a solid foundation in Java’s structure and design.
Midway, the book dives into advanced topics such as generics, lambda expressions, functional programming, and concurrency. Readers gain practical knowledge of modern Java features including module systems, the extensive Java class library, and the nuances of thread management. The coverage also extends to data structures, algorithms, file I/O, and database connectivity with JDBC, empowering readers to handle real-world programming challenges with confidence.
The final sections focus on testing with JUnit, software design patterns, and Java development tools, equipping readers with skills to write clean, maintainable, and efficient code. Throughout this journey, the book emphasizes practical examples and best practices, making it an indispensable resource for learners aiming to master Java from basics to advanced professional techniques.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 1749
Veröffentlichungsjahr: 2025
Christian Ullenboom
The Comprehensive Guide
This e-book is a publication many contributed to, specifically:
Editor Hareem ShafiGerman Edition Editor Anne Scheibe, Almut PollTranslation Winema Language Services, Inc.Copyeditor Yvette ChinTechnical Reviewer Dirk EversIllustration Leo Leowald, GermanyCover Design Graham GearyPhoto Credit iStockphoto: 1332719560/© zxvisual; Shutterstock: 190908608/© picoStudioProduction E-Book Graham GearyTypesetting E-Book III-satz, Germany
We hope that you liked this e-book. Please share your feedback with us and read the Service Pages to find out how to contact us.
The Library of Congress has cataloged the printed edition as follows: Names: Ullenboom, Christian, author. Title: Java : the comprehensive guide / by Christian Ullenboom. Description: 1st edition. | Bonn ; Boston : Rheinwerk Publishing/SAP Press, 2022. | Includes bibliographical references and index. Identifiers: LCCN 2022029163 | ISBN 9781493222957 (hardcover) | ISBN 9781493222964 (ebook) Subjects: LCSH: Java (Computer program language) | Computer programming. Classification: LCC QA76.73.J38 U45 2022 | DDC 005.13/3--dc23/eng/20220812 LC record available at https://lccn.loc.gov/2022029163LC record available at https://lccn.loc.gov/2020023822 LC ebook record available at https://lccn.loc.gov/2020023823
ISBN 978-1-4932-2295-7 (print)ISBN 978-1-4932-2296-4 (e-book)ISBN 978-1-4932-2297-1 (print and e-book)
© 2023 by Rheinwerk Publishing Inc., Boston (MA)1st edition 202316th German edition published 2022 by Rheinwerk Verlag, Bonn, Germany
The first iteration of the book that you now hold in your hands was published for German readers in 2003. Today, that bestselling guide is in its 16 th edition in Germany. What does it mean to write 16 editions of a book? Consider: reading your work repeatedly over the course of 20 years; expanding, rewriting, and refining, until you know the text like the back of your hand; evaluating changes to the topic area and sorting through hundreds of pages of text to implement the minutest updates to the Java language; reading, reviewing, and testing code snippets; and, of course, working through 16 editions of editor feedback and critique.
In many ways, this translation is a 17 th edition, built on years of previous work. Christian Ullenboom has honed his manuscript once again, making key updates to ensure that this guide is the best resource for both new Java programmers and experienced professionals. And he’s done this in a new language, to bring his decades of knowledge to English readers. I’m certain that you will find his expertise invaluable.
What did you think about Java: The Comprehensive Guide ? Your comments and suggestions are the most useful tools to help us make our books the best they can be. Please feel free to contact me and share any praise or criticism you may have.
Thank you for purchasing a book from SAP PRESS!
Hareem ShafiEditor, SAP PRESS
hareems@rheinwerk-publishing.comwww.rheinwerk-computing.comRheinwerk Publishing • Boston, MA
This e-book is protected by copyright. By purchasing this e-book, you have agreed to accept and adhere to the copyrights. You are entitled to use this e-book for personal purposes. You may print and copy it, too, but also only for personal use. Sharing an electronic or printed copy with others, however, is not permitted, neither as a whole nor in parts. Of course, making them available on the internet or in a company network is illegal as well.
For detailed and legally binding usage conditions, please refer to the section Legal Notes.
This e-book copy contains a digital watermark, a signature that indicates which person may use this copy:
You are reading this e-book in a file format (EPUB or Mobi) that makes the book content adaptable to the display options of your reading device and to your personal needs. That’s a great thing; but unfortunately not every device displays the content in the same way and the rendering of features such as pictures and tables or hyphenation can lead to difficulties. This e-book was optimized for the presentation on as many common reading devices as possible.
If you want to zoom in on a figure (especially in iBooks on the iPad), tap the respective figure once. By tapping once again, you return to the previous screen. You can find more recommendations on the customization of the screen layout on the Service Pages.
“Some people think they are polite just because they still use words at all and not fists.”—Friedrich Hebbel (1813–1863)
In the beginning was the Word. Much later, on May 23, 1995, at SunWorld in San Francisco, the head of Sun Microsystems’s then Science Office, John Gage, and Netscape co-founder Marc Andreessen introduced the new Java programming language with its integration into the Netscape web browser. This event was the beginning of the triumphal procession of a language that offers elegant ways to program on any platform and to express your thoughts in an object-oriented (OO) way. The possibilities of the language and its libraries are nothing new in themselves but have been packaged so well that Java is pleasant and fluid for programming. Java is now one of the most popular programming languages on the planet. In its 23 chapters, this book deals with the Java technology with an intense focus on the Java programming language. Important topics include object-oriented programming (OOP), designing classes, and the structure of Java’s standard libraries.
The chapters of this book are designed for beginners to the Java programming language as well as for advanced users. Basic knowledge of a structured programming language such as C, Python, JavaScript, or Visual Basic and knowledge of OOP are helpful because the book doesn’t explicitly address computer architectures or what programming actually is. So, if you’ve already programmed in any language, this book is for you!
This book shouldn’t be taken as a programming book for beginners. If you have never programmed before and associate the word “translation” primarily with “interpreting,” you should start with a basic tutorial or follow one along in parallel. Many areas in the life of an industrial programmer are covered in this book to a general depth, but this book cannot replace the Java Language Specification (JLS), available at https://docs.oracle.com/javase/specs.
Java technologies have exploded in recent years, so that their initial manageability has given way to strong specialization. Today, covering everything in one book isn’t possible, and we certainly won’t aim for that goal with this one. A book that deals specifically with the graphical user interface (GUI) JavaFX or Swing—both parts of standard Java—could be as extensive as the book you’re holding in your hands. Other special topics include OO analysis/design, Unified Modeling Language (UML), parallel or distributed programming, Enterprise JavaBeans (EJBs), database connectivity, object-relational mapping, web services, dynamic web pages, and many other topics. For all those topics, special-purpose books may be required to satisfy your curiosity.
This Java book trains you on the syntax of the programming language, the handling of important standard libraries, development tools and development environments, OO analysis and design, design patterns, and program conventions. But this book can’t help you impress the cool IT geeks at a party. Sorry.
My involvement with Java started over 20 years ago and is related to a compulsory university course. In 1997, our project group dealt with an OO dialog specification. A state machine had to be programmed, and the question of which programming language to use came up. Since I wanted to introduce Java to the seminar’s participants, I prepared a set of slides for our presentation. Parallel to the slides, the professor expected an elaboration in the form of a seminar paper. Working with Java was fun and something completely different from what I had been used to until then. Before Java, I had coded in Assembler for about 10 years; then later, I used the high-level languages Pascal and C, and mainly built compilers. I tried and tested code, wrote down my experiences, and learned about Java and its libraries. The work grew with my experience. During time in this group project, a fellow student approached me to give a Java training as a speaker. I felt like doing it but didn’t have any documents. So, I kept writing training materials for the course. When the professor asked for the seminar paper at the end of the group project, the preliminary manuscript of the current book was already so extensive that this introduction more or less became the seminar paper.
That was in 1997, and of course, I could have stopped writing immediately after I turned in the paper. But to this day, I still enjoy Java and look forward to each new version. And I am not alone in my optimism: The forecasts for Java remain promising because the use of Java is now as established as that of COBOL in banking and insurance. That’s why people keep talking about Java being “the new COBOL.”
After about two decades, I now consider this book to be a multifaceted Java resource for ambitious developers who want to look behind the scenes. Its level of detail is not reached by any other book about the basics of Java in English—at least that I know of! I have enjoyed extending the book, even if many topics are hardly addressed in a normal Java course.
The basis for this book is Java Platform Standard Edition (Java SE) version 17 using the free OpenJDK implementation, which is a kind of Java Development Kit (JDK). The JDK essentially consists of a compiler and a runtime environment—the Java virtual machine (JVM) —and is available for the Windows, macOS, Linux, and Solaris platforms.
A graphical development interface, called an integrated development environment (IDE), is not part of the JDK. While I don’t advocate relying on one vendor (because vendors appeal to different groups of developers), this book introduces IntelliJ development environments in slightly greater detail. Our sample programs can basically be entered into any other development environment or text editor—such as Microsoft Visual Studio Code (VS Code) or vi—and compiled on the command line. However, pure text editors are outdated in development, and a graphical command-line approach simplifies program creation.
Since Oracle (then still led by Sun) introduced the Java programming language in 1995 with version 1.0, the version spiral has inexorably turned. A new version is released every 6 months, and every 2 years, a Long-Term-Support-Release (LTS), with updates for a longer period of time, is released. The latest LTS is Java 17. Especially for authors writing books about Java, the question arises as to which Java version the text should be based on and which libraries should be described. In this book, we always describe the capabilities of the latest version, which was Java 18 at the time of this writing. For the didactics of OOP, the version question is fortunately irrelevant.
The examples in this book are consistently based on Java 17.
This book is ideal for self-study. The first chapter is for warming up. If you don’t have a development environment installed on your computer, you should first install the JDK from Oracle. Because the JDK only installs command-line tools, every developer should install a graphical IDE because an IDE makes the development of Java programs much more comfortable. An IDE provides several advantages over the raw command line, such as the following:
Editing, compiling, and running a Java program are quick and easy with a keystroke or mouse click.
An editor should highlight the syntax of Java in color ( syntax highlighting ).
A context-sensitive help shows the parameters for methods and at the same time provides access to the application programming interface (API) documentation.
Other benefits such as a GUI builder, project management, and debugging are added but don’t play any role in this book.
In software development, the documentation of API interfaces is essential. Documentation can usually be viewed from the development environment with the touch of a button or found online. Chapter 1 also provides URLs for the available documentation.
Everything really starts with Chapter 2, and from then, we’ll go step by step. Anyone with knowledge of JavaScript, C, C#, or C++ can easily skim Chapter 2. Those more familiar with OOP in C# or C++ can quickly read Chapter 3 and then jump on. Chapter 6 and Chapter 7 form the OO center of the book: These chapters teach the OO concepts of class, method, association, inheritance, and dynamic binding. After Chapter 7, the basic OO training is complete, and with Chapter 15 , you’ll have been introduced to all the basics of Java.
If using this book in self-study, a successful learning strategy can be described. The key to understanding, as is so often the case, is the psychology of learning, which examines the reading conditions under which a text can be optimally understood. The method I’d like to present is called the PQ4R method , which stands for the following steps:
Preview : First, you should get an initial overview of the chapter, for example, by browsing the table of contents and skipping the pages of individual chapters. Look at the figures and tables a little longer, as they already give away the content and make you want to read the text.
Questions : Each chapter attempts to convey a thematic block. Before reading, you should consider the questions you want the chapter to answer.
Read : Here we go—you must read the text. Unless you’ve borrowed a library book, you should highlight passages you think are important with lots of color and add notes in the margins. The same applies to new terms. Everyone should be able to answer the previously asked questions. If new questions arise, store them in your memory!
Reflect: Whether motivated or not—an interesting finding from another study—anyone can learn. Success depends only on how deeply the knowledge is processed (called elaborative processing). In this process, topics must be linked to other topics. Think about how the statements fit with the other parts. Now is also a good time for practical exercises. For the examples given in this book, you should think of your own examples. If we describe an if statement using age as an example, an idea of your own could be something like an if statement on your height.
Recite : At this point, you should be able to answer the questions posed earlier, without the text. For me, writing is a good way to reflect on what I know, but everyone should restate content in their own way. Great fun can be had by reflecting about all the keywords and their meanings, the relationship between abstract classes and interfaces, etc. while taking a shower.
Explaining out loud helps with many types of problem solving—just chat up the toaster. Even nicer is learning with someone and explaining procedures to each other. An interesting visualization technique is the mind map, which can be used to organize the content.
Review: Now, go through the chapter again and see if you’ve understood everything without further questions. Some “quick” explanations may have turned out to be wrong. Perhaps, the text doesn’t clarify everything either. Then, a note directed to me ([email protected]) will be very welcome.
The PQ4R method facilitates the acquisition of knowledge. However, like all learned things, if you don’t refresh your knowledge regularly, you’ll forget it. The PQ4R method should therefore be given an additional “R” for long-term success: “R” for “repeat” or “refresh.” As a rule, people over-read something at the beginning and pay little attention to details. Later, when more background knowledge is available, even basic things can appear in a new light and fit into the overall picture. Readers should therefore pick up the book again and again and turn its pages.
Some sections are written for experienced programmers or computer scientists. Newcomers may need to stray from the sequential path of chapters at some points since some chapters may require more background information and familiarity with programming languages. Comparisons with other programming languages are intended for loosening up and comparison and aren’t necessary for the understanding of Java.
The Java universe is rich in subtlety and often confuses newcomers. For this reason, the book weights knowledge in two ways. First, boxes set off from the text provide specialized and advanced information. Furthermore, some headings end in an asterisk (*), which means that this section can be skipped without the reader missing anything essential for later chapters.
With this book and a trusted development environment, you can develop your first programs. However, reading is not enough to learn a new programming language. If you want to learn a programming language, you must practice and speak it like a foreign language.
Accompanying this book are practice exercises available online at https://tutego.de/javabuch/aufgaben/index_en.html. At that site, you’ll find links to complete solutions. The site is updated periodically with new tasks and solutions.
Chapter 1 highlights the special features of the Java language. In this chapter, I draw some comparisons with other popular OO languages. This chapter is not particularly technical and also describes the historical course of Java’s evolution. The chapter isn’t didactically structured, so that some concepts aren’t covered in depth until the later chapters; beginners should skim through it. We’ll also show you how to obtain and install a JDK so that your first programs can be compiled and run. Learning will be more fun with a development environment, so an introduction to IDEs is provided as well.
Things really get going in Chapter 2 . This chapter describes variables, types, and imperative language elements by describing statements and expressions that form the foundation of any program. Descriptions of case statements, loop types, and methods can also be found in this chapter. These features are still possible without much object orientation.
Things do actually become OO in Chapter 3. We’ll first explore the classes available in the standard library and develop our own classes later because our focus is on the basic concepts first, such as the keyword new, references, the null reference, and reference comparisons. The standard library is so rich that, with predefined classes and this basic knowledge alone, many programs can be developed. The provided data structures can be used in many ways.
Several data types can be combined in an array, which is introduced in Chapter 4. Arrays also form the basis of some Java concepts such as variable argument lists and the extended for .
The reason behind many problems is the changed “handling of characters and strings,” which we’ll introduce in Chapter 5. In this chapter, the important types Character (the data type for single characters), String, and StringBuilder (data types for strings) will be introduced. Concerning strings, sometimes, parts must be cut out, recognized, and converted. A split(...) from the String class is possible, and the Scanner class can split strings into substrings using separators. Format objects put any output into the desired format, including the output of decimal numbers.
With this knowledge about object creation and references, the next step can take place: Chapter 6 deals with writing custom classes. Using games and rooms, we’ll model object properties. Important concepts such as constructors, static properties, and enumerations are described in this chapter.
Object relationships, that is, the associations between objects (also referred to as “uses-A relationships”) and inheritance relationships are the subjects of Chapter 7 . This chapter introduces “real” OOP and covers dynamic binding, abstract classes, and visibility.
Java supports several types, and besides classes, another important type is the interface. Chapter 8 introduces this particular type as well as two other types: enumeration types and records.
Exceptions, which are discussed in Chapter 9 , form an important backbone for all programs since errors can hardly be avoided. For this reason, the active support of their handling is advised since doing so forces a programmer to take care of errors and fix them.
Chapter 10 describes how classes can be nested within each other. This nesting can improve encapsulation because implementations can then also be local.
Chapter 11 describes classes that are central to the Java library, such as comparison classes, wrapper classes, and the Object class, which is the superclass of all Java classes.
Generics can be used to declare classes, interfaces, and methods with a kind of type placeholder, where the concrete type is defined later. Chapter 12 provides insight into this technology.
Lambda expressions have been around since Java 8; they simplify functional programming in particular. We devote Chapter 13 to language properties. In this chapter, you’ll also learn about many standard types that are used in functional programming.
At this point, the foundations have been laid, and the remaining chapters build on the knowledge already acquired. Chapter 14 introduces SOLID principles, shows applications of good OOP, and introduces design patterns . Based on various examples, this chapter demonstrates how interfaces and class hierarchies can be used effectively in Java. The key is to think small but to write big applications.
Chapter 15 describes how, in Java, individual components or systems of components can be used flexibly for other applications.
After the first 15 chapters, readers will be almost completely familiar with the Java language. However, since Java is not only a language but also a set of standard libraries, the second half of the book focuses on basic APIs. At the end of each chapter, a “Further Reading” section provides references to interesting online resources. At this point, readers can leave the sequential path and focus on individual topics since the remaining topics are usually not directly interdependent.
The Java library consists of over 4,000 classes, interfaces, enumerations, exceptions, and annotations. Chapter 16 provides an overview of the most important packages and picks out some classes from the library, such as loading classes. In this chapter, you’ll also find classes for configuring applications or ways to run external programs.
Chapter 17 through Chapter 22 provide an overview of selected Java SE APIs. Chapter 17 provides an introduction to concurrent programming, while Chapter 18 shows common data structures such as lists, sets, and associative memory in a practical way. Chapter 19 provides an overview of how you can read from and write into files. If you want to use a relational database to store data, you’ll find useful information in Chapter 20. Chapter 21 introduces you to the Math class, which provides typical mathematical methods to perform trigonometric calculations, for example. With another class, you can generate random numbers. The chapter also covers the handling of arbitrarily long integers or floats.
Automatic testing of applications helps detect errors in code, especially if silly code changes are introduced subsequently and the program no longer behaves in accordance with the specification. Chapter 22 introduces the concept of test cases and demonstrates how to execute test cases easily and automatically. In addition, this chapter focuses on the design of testable applications.
Finally, Chapter 23 provides a brief overview of command-line tools like javac for compiling Java programs and java for starting the JVM and executing Java programs.
The following conventions are used in this book:
Newly introduced terms are italicized, and the index refers to that exact location. Furthermore, file names, HTTP addresses, names of executable programs, program options, and file extensions ( .txt ) are italicized.
User interface (UI) terms are written in bold .
Listings, methods, and other program elements are set in programming font. In some places, a bent arrow has been placed after a listing line as a special character to mark a line break. So, the code from the next line still belongs to the previous one.
Method names and constructors are always followed by a pair of parentheses to distinguish methods/constructors from object/class variables. Thus, when writing System.out and System.gc() , you can clearly see that the former is a class variable, and the latter is a method.
If a method or constructor has a parameter, the type is enclosed in parentheses, for example, Math.abs(double a) or Point(int x, int y). Often the parameter name is also omitted, for example, “ System.exit(int) exits the program with a return value.” The Java API documentation does the same. If a method or constructor has a parameter list, but is not relevant in the text, it’s abbreviated with ellipses, as in “ ...”. For example: “The System.out.print(...) method converts the passed arguments to strings and prints them.” Thus, an empty pair of parentheses means that a method or constructor really has no parameter list. To make the specification short and yet precise, you’ll see some specifications in the text like getProperty(String key[, String def]), which is an abbreviation for getProperty(String key) and getProperty(String key, String def) . Elsewhere, the ellipses (...) are also found when the implementation or screen outputs aren’t further required for understanding.
To specify a group of methods, the * identifier symbolizes a placeholder. For example, print*(...) stands for the methods println(...), print(...), and printf(...) . From the context, you should clearly see which methods are meant.
Long package names are sometimes abbreviated, so that com.tutego.island.game becomes c.t.i.g , for example.
To indicate compiler errors or runtime errors in the program code, a line may contain a . Thus, you can see at first glance that the line is not compiled or throws an exception at runtime due to a programming error, for example, the following code:
In case of compiler errors—as in the previous point—messages are usually printed by the javac compiler and partly by the Eclipse Java compiler. Errors are detected by both compilers; only the output differs in wording.
Facebook is now called Meta, and Sun became Oracle in early 2010. The name “Sun” only appears in the book when discussing a technology initiated by Sun and that came onto the market when Sun was responsible for it. The younger generation will hardly remember Sun Microsystems, that’s how long ago it was. In 2010, Apple released the first iPad, which was also quite a long time ago.
Entire program listings are structured in the following way:
Listing 1 Candy.java
The source code shown is located in the file Candy.java. If the type (class, enumeration, interface, or annotation) is in a package, the path specification is placed with the file name:
Listing 2 com/tutego/island/Candy.java
To save space, the book often presents source code snippets. The complete source code is available on the internet (www.rheinwerk-computing.com/5557). If an excerpt of a file like Person.java is displayed, we’ll indicate this editing in the caption, for example, in the following ways:
Person.java (Snippet)
Person.java, main(), Part 1
If sample programs are provided for certain classes, the class names of these programs generally end in Demo. Thus, for the DateFormat Java class, a sample program that demonstrates the functionality of the DateFormat class is named DateFormatDemo .
Class/object variables, constructors, and methods are found in a special listing that makes it easy to find in the book and use as a reference work.
Date parse(String source) throws ParseExceptionParses a date or time string.
The rectangle contains the fully qualified class or interface name (such as the DateFormat class in the java.text package) or the name of the annotation or enumeration type. The following lines list the superclass ( DateFormat inherits from Format) and the implemented interfaces ( DateFormat implements Cloneable and Serializable). Since any class that doesn’t have an explicit superclass automatically inherits from Object, this inheritance is not specified separately. Visibility is public unless otherwise specified, which is common for library methods. If an interface is described, the methods are automatically abstract and public, and the abstract and public keywords aren’t additionally specified. The subsequent enumeration class/object variables are followed by constructors and methods. Unless otherwise specified, visibility is public. If errors are specified with throws, then they aren’t RuntimeExceptions but only checked exceptions. Deprecated methods aren’t listed but may be mentioned if no alternative exists.
Executable programs on the command line can be recognized by a dollar sign at the beginning (even if other operating systems and command lines display a different prompt). The characters to be entered by the user are set in bold; the output isn’t, as in the following example:
I was 9 years old when my parents opened the world of computers to me with the Commodore 64. Because I lacked a medium to save programs and data, I had no choice but to re-enter everything after rebooting—the way I learned how to program. To my parents, a big thanks for the computer, for the love, and for trusting me.
Thanks are due to Sun Microsystems, which began development on Java in 1991. Without Sun, there would be no Java, and without Java, there wouldn’t be this book. Thanks also to Oracle, as the buyer of Sun, because perhaps without the acquisition Java would have been finished.
Java lives—maybe I should say, “survives”—through many free tools and an active open-source community. A big “thank you” goes to all developers who write and maintain the many great Java tools, libraries, and frameworks available today, such as Eclipse, Maven, JUnit, and Spring Tomcat. Without them, Java wouldn’t be where it is today.
Finally, I would like to express my thanks to Rheinwerk Publishing for helping me publish this book. I’m grateful for the collaboration with my editor.
All sample programs are available for you to download from the book’s website: Go to www.rheinwerk-publishing.com/5557. Click on the Resources tab to view downloadable files with a brief description of each file’s content. Click the Download button to start the download process. Depending on the size of the file (and your internet connection), some time may be required for the download to complete.
No matter how carefully we’ve gone through the chapters of this book, discrepancies are likely in over 1,100 pages, just as any software can have purely statistical errors. If you have any comments, suggestions, corrections, or questions about specific points or general didactics, please don’t hesitate to email me at [email protected]. I’m always open to suggestions, praise, and reprimands.
Now, we’re ready to explore life between the curly brackets and follow the Greek philosopher Plato, who said, “The beginning is the most important part of the work.”
“We’re producing information en masse today, just like cars used to be.”—John Naisbitt (1929–2021)
After 20 years, Java has finally established itself as a platform. Millions of software developers worldwide make their living with the language, billions of devices run Java programs (e.g., all Blu-ray players). Every week, Oracle’s runtime environment is downloaded millions of times. In this chapter, we’ll introduce you to Java, discuss its features, compare it to other programming languages, and explore its platforms and development environments.
Figure 1.1 Many Devices Speak Java
In the 1970s, when hippies were still dancing to the music of Jimi Hendrix, Bill Joy wanted to create a programming language that would combine all the advantages of MESA[ 1 ] and C. Joy, co-founder of Sun Microsystems, was initially unable to fulfill this wish, and only in 1990s could he describe what a new object-oriented (OO) language might look like, in his article “Further.” For Joy, its basic principles should be based on C++ . Only later did he realize that C++ was unsuitable as a base language and too unwieldy for large programs.
At that time, James Gosling was working on the Standard Generalized Markup Language ( SGML) . He developed in C++ and wasn’t happy with this language either. The new language Oak was born out of this displeasure. The name came to Gosling’s mind when he looked out the window and saw an oak