Book Image

Java Fundamentals

By : Gazihan Alankus, Rogério Theodoro de Brito, Basheer Ahamed Fazal, Vinicius Isola, Miles Obare
Book Image

Java Fundamentals

By: Gazihan Alankus, Rogério Theodoro de Brito, Basheer Ahamed Fazal, Vinicius Isola, Miles Obare

Overview of this book

Since its inception, Java has stormed the programming world. Its features and functionalities provide developers with the tools needed to write robust cross-platform applications. Java Fundamentals introduces you to these tools and functionalities that will enable you to create Java programs. The book begins with an introduction to the language, its philosophy, and evolution over time, until the latest release. You'll learn how the javac/java tools work and what Java packages are - the way a Java program is usually organized. Once you are comfortable with this, you'll be introduced to advanced concepts of the language, such as control flow keywords. You'll explore object-oriented programming and the part it plays in making Java what it is. In the concluding chapters, you'll get to grips with classes, typecasting, and interfaces, and understand the use of data structures, arrays, strings, handling exceptions, and creating generics. By the end of this book, you will have learned to write programs, automate tasks, and follow advanced courses on algorithms and data structures or explore more advanced Java courses.
Table of Contents (12 chapters)
Java Fundamentals
Preface

Preface

Note

About

This section briefly introduces the author, the coverage of this book, the technical skills you'll need to get started, and the hardware and software requirements required to complete all of the included activities and exercises.

About the Book

Since its inception, Java has stormed the programming world. Its features and functionalities provide developers with the tools needed to write robust cross-platform applications. Java Fundamentals introduces you to these tools and functionalities that will enable you to create Java programs. The book begins with an introduction to the language, its philosophy, and evolution over time, up until the latest release. You'll learn how the javac/java tools work and what Java packages are, as well as the way in which a Java program is usually organized. Once you are comfortable with this, you'll be introduced to advanced concepts of the language, such as control flow keywords. You'll explore object-oriented programming and the part it plays in making Java what it is. In the concluding lessons, you'll get to grips with classes, typecasting, and interfaces, and gain an understanding of the uses of data structures, arrays, and strings; handling exceptions; and creating generics.

By the end of this book, you will have learned how to write programs, automate tasks, and follow advanced books on algorithms and data structures, or explore more advanced Java books.

About the Authors

Gazihan Alankus is an assistant professor at Izmir University of Economics, where he teaches books related to mobile applications, games, and IoT. He received his PhD from Washington University in St. Louis and worked as an intern at Google. In 2019, he became a Google Developer Expert in the Dart programming language. He enjoys working on a variety of research and development projects.

Rogério Theodoro de Brito has a bachelor's degree in computer science and a master's degree in computational biology, both from the University of São Paulo, Brazil. Academically, he is a free/open source software (FOSS) enthusiast and teaches various subjects in computer science and IT at the Mackenzie Presbyterian University in São Paulo, Brazil. He was the technical reviewer of Packt's edX E-Learning Course Marketing.

After completing his master's degree, he started his role as an academic instructor and has been working with many languages, such as C, C++, Java, C, Perl, and Python. He writes, co-writes, and maintains a number of projects with two of the most prominent learning platforms, coursera-dl and edx-dl, and is dedicated to helping users of Massive Open Online Courses (MOOCs) download materials for their study from MOOC platforms. He is very excited by using the Java language to build Android applications.

Basheer Ahamed Fazal works as a technical architect at a renowned Software as a Service-based product company in India. He had advanced his career with technology organizations such as Cognizant, Symantec, HID Global, and Ooyala. He has seasoned his programming and algorithmic abilities by solving complex problems around agile product development, including those to do with microservices, Amazon Web Services, Google Cloud-based architectures, application security, and big data- and AI- driven initiatives.

Apart from his technical career, he has emerged as a professional trainer and has conducted various training sessions on Java, Python, application security, machine learning, and more. He holds a bachelor's degree in electronics and communication engineering from Anna University, Chennai, and has a Scrum Master Certification from Scrum Alliance.

Vinicius Isola has a diverse background with a bachelors' degree in physics from the University of Campinas. In 1999, he started learning how to program ActionScript, when Macromedia Flash was taking over the internet. In 2002, while taking a 10-month course on Visual Basic, he used it to build a simulation of life using Cellular Automata combined with Genetic Algorithms for his scientific initiation program at university.

At the beginning of 2005, he got his first job in the computer world at a call center. He was then promoted to a data support position where he learned a lot about SQL and databases. Also in 2005, he decided to learn Java and took a 5-day course at Sun Microsystems. After that, he started using Java to build tools to help him at work, automating multiple workflows and saving him a lot of time, freeing up more time to learn new technologies.

In 2007, he got his first software engineering job at IBM, working with Java and Apache Struts. Between 2008 and 2010, he worked for multiple consulting companies, gaining a lot of experience on distributed systems. In mid-2010, he started building a Java course, which drove him to start his own programming school at the beginning of 2011. In mid-2011, he had to shut down his school and go back to working full-time as a software engineer.

At the end of 2011, he moved to Boston, Massachusetts, and since then has worked for multiple companies, including Amazon, HubSpot, and Panorama Education. During this time, he has worked with many programming languages, databases, and technologies, including Android, JavaScript, Node.js, Python, Ruby on Rails, MySQL, PostgreSQL, Apache Kafka, and Apache HBase.

Nowadays, he works as a full-time software engineer at Everbridge and spends his spare time learning new programming languages, such as Go, and building tools to help developers implement powerful continuous integration and continuous deployment of automated pipelines.

Miles Obare leads the data engineering team at Betika, a Nairobi-based sports betting firm. He works on building real-time, scalable backend systems. Formerly, he worked as a data engineer for a fintech start-up, where his role involved developing and deploying data pipelines and machine learning models to production. He holds a degree in electrical and computer engineering and often writes about distributed systems.

Objectives

  • Create and run Java programs

  • Use data types, data structures, and control flow in your code

  • Implement best practices when creating objects

  • Work with constructors and inheritance

  • Understand advanced data structures to organize and store data

  • Employ generics for stronger check-types during compilation

  • Learn to handle exceptions in your code

Audience

Java Fundamentals is designed for tech enthusiasts who are familiar with some programming languages and want a quick introduction to the most important principles of Java.

Approach

Java Fundamentals takes a practical approach to equip beginners with the most essential data analysis tools in the shortest possible time. It contains multiple activities that use real-life business scenarios for you to practice and apply your new skills in a highly relevant context.

Hardware Requirements

For the optimal student experience, we recommend the following hardware configuration:

  • Processor: Intel Core i7 or equivalent

  • Memory: 8 GB RAM

  • Storage: 35 GB available space

Software Requirements

You'll also need the following software installed in advance:

  • Operating system: Windows 7 or above

  • Java 8 JDK

  • IntelliJ IDEA

Installation and Setup

IntelliJ IDEA is an integrated development environment that attempts to integrate all of the development tools that you might need into one single place.

Install IntelliJ IDEA

  1. To install IntelliJ on your machine, go to https://www.jetbrains.com/idea/download/#section=windows and download the Community Edition specific to your operating system.

  2. Open the downloaded file. You will see the following window. Click Next:

    Figure 0.1: IntelliJ IDEA Community Setup Wizard

  3. Select the directory to install IntelliJ and select Next:

    Figure 0.2: Wizard to choose the installation location

  4. Choose the preferred installation options and click Next:

    Figure 0.3: Wizard to choose the installation options

  5. Choose the start menu folder and click on Install:

    Figure 0.4: Wizard to choose the start menu folder

  6. Click on Finish once the download is complete:

    Figure 0.5: Wizard to finish the installation

    Reboot your system once IntelliJ is installed.

Install Java 8 JDK

Java Development Kit (JDK) is a development environment for building applications using the Java programming language:

  1. To install the JDK, go to https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html.

  2. Go to Java SE Development Kit 8u201 and select the Accept License Agreement option.

  3. Download the JDK specific to your operating system.

  4. Run the installer once the file is downloaded.

Conventions

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The correct instruction should be System.out.println."

A block of code is set as follows:

public class Test { //line 1
    public static void main(String[] args) { //line 2
        System.out.println("Test"); //line 3
    } //line 4
} //line 5

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Right-click the src folder and select New | Class."

Installing the Code Bundle

Download the code bundle for the book from the GitHub repository and copy it to the folder where you have installed IntelliJ.

Additional Resources

The code bundle for this book is also hosted on GitHub at: https://github.com/TrainingByPackt/Java-Fundamentals.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!