Book description
Get a solid understanding of Java fundamentals to master programming through a series of practical steps
About This Book- Enjoy your first step into the world of programming
- Understand what a language is and use its features to build applications
- Learn about a wide variety of programming applications
Introduction to Programming is for anybody who wants to learn programming. All you'll need is a computer, internet connection, and a cup of coffee.
What You Will Learn- Understand what Java is
- Install Java and learn how to run it
- Write and execute a Java program
- Write and execute the test for your program
- Install components and confgure your development environment
- Learn and use Java language fundamentals
- Learn object-oriented design principles
- Master the frequently used Java constructs
Have you ever thought about making your computer do what you want it to do? Do you want to learn to program, but just don't know where to start? Instead of guiding you in the right direction, have other learning resources got you confused with over-explanations?
Don't worry. Look no further. Introduction to Programming is here to help.
Written by an industry expert who understands the challenges faced by those from a non-programming background, this book takes a gentle, hand-holding approach to introducing you to the world of programming. Beginning with an introduction to what programming is, you'll go on to learn about languages, their syntax, and development environments. With plenty of examples for you to code alongside reading, the book's practical approach will help you to grasp everything it has to offer. More importantly, you'll understand several aspects of application development. As a result, you'll have your very own application running by the end of the book. To help you comprehensively understand Java programming, there are exercises at the end of each chapter to keep things interesting and encourage you to add your own personal touch to the code and, ultimately, your application.
Style and approachThis step-by-step guide will familiarize you with programming using some practical examples.
Table of contents
- Title Page
- Copyright and Credits
- Dedication
- Contributors
- Packt Upsell
- Preface
- Java Virtual Machine (JVM) on Your Computer
- Java Language Basics
- Your Development Environment Setup
- Your First Java Project
- Java Language Elements and Types
- Interfaces, Classes, and Object Construction
- Packages and Accessibility (Visibility)
- Object-Oriented Design (OOD) Principles
-
Operators, Expressions, and Statements
-
What are the core elements of Java programming?
-
Operators
- Arithmetic unary (+  -) and binary operators:  +   -   *   /   %
- Incrementing and decrementing unary operators:  ++   -- 
- Equality operators:  ==   !=
- Relational operators:  <  >  <=  >=   
- Logical operators:  !  &  |  
- Conditional operators:  &&   ||    ? : (ternary)
- Assignment operators (most popular):  =   +=   -=   *=   /=   %=
- Instance creation operator: new
- Type comparison operator:  instanceof
- Preferring polymorphism over the instanceof operator
- Field access or method invocation operator:  .
- Cast operator:  (target type)
- Expressions
- Statements
-
Operators
- Operator precedence and evaluation order of operands
- Widening and narrowing reference types
- Widening and narrowing conversion of primitive types
- Boxing and unboxing between primitive and reference types
- Method equals() of reference types
- Exercise – Naming the statements
- Summary
-
What are the core elements of Java programming?
- Control Flow Statements
- JVM Processes and Garbage Collection
- Java Standard and External Libraries
-
Java Collections
- What are collections?
-
List - ArrayList preserves order
- Prefer variable type List
- Why is it called ArrayList?
- Adding elements
- size(), isEmpty(), clear()
- Iterate and stream
- Add using generics
- Add collection
- Implementing equals() and hashCode()
- Locating element
- Retrieving elements
- Removing elements
- Replacing elements
- Sorting String and numeral types
- Sorting custom objects
- Comparing with another collection
- Converting to array
- List implementations
-
Set - HashSet does not allow duplicates
- Preferring variable type Set
- Why is it called HashSet?
- Adding elements
- size(), isEmpty(), and clear()
- Iterate and stream
- Adding using generics
- Adding collection
- Implementing equals() and hashCode()
- Locating element
- Retrieving elements
- Removing elements
- Replacing elements
- Sorting
- Comparing with another collection
- Converting to array
- Set implementations
-
Map – HashMap stores/retrieves objects by key
- Preferring variable type Map
- Why is it called HashMap?
- Adding and maybe replace
- size(), isEmpty(), and clear()
- Iterate and stream
- Adding using generics
- Adding another Map
- Implementing equals() and hashCode()
- Locating element
- Retrieving elements
- Removing elements
- Replacing elements
- Sorting
- Comparing with another collection
- Map implementations
- Exercise – EnumSet methods
- Summary
-
Managing Collections and Arrays
-
Managing collections
- Initializing collections
- Immutable collections
-
java.util.Collections class  
- Copy 
- Sort and equals()
- Reverse and rotate
- Search and equals() 
- Comparing two collections
- Min and max elements
- Add and replace elements
- Shuffle and swap elements
- Converting to a checked collection
- Convert to a thread-safe collection
- Convert to another collection type
- Create enumeration and iterator
- Class collections4.CollectionUtils
- Manage arrays
- Exercise – Sort list of objects
- Summary
-
Managing collections
-
Managing Objects, Strings, Time, and Random Numbers
- Managing objects
-
Managing strings
- StringBuilder and StringBuffer
-
Class java.lang.String
- Constructors
- format()
- replace()
- compareTo()
- valueOf(Objectj)
- valueOf(primitive or char[])
- copyValueOf(char[])
- indexOf() and substring()
- contains() and matches()
- split(), concat(), and join()
- startsWith() and endsWith()
- equals() and equalsIgnoreCase()
- contentEquals() and copyValueOf()
- length(), isEmpty(), and hashCode()
- trim(), toLowerCase(), and toUpperCase()
- getBytes(), getChars(), and toCharArray()
- Get code point by index or stream
- Class lang3.StringUtils
- Managing time
- Managing random numbers
- Exercise – Objects.equals() result
- Summary
- Database Programming
- Lambda Expressions and Functional Programming
- Streams and Pipelines
- Reactive Systems
- Other Books You May Enjoy
Product information
- Title: Introduction to Programming
- Author(s):
- Release date: June 2018
- Publisher(s): Packt Publishing
- ISBN: 9781788839129
You might also like
book
JavaScript Cookbook, 3rd Edition
Why reinvent the wheel every time you run into a problem with JavaScript? This cookbook is …
book
Java 11 Cookbook
Solutions for modular, functional, reactive, GUI, network, and multithreaded programming Key Features Explore the latest features …
book
C++ Crash Course
Upgrade your Code with C++ C++ is one of the most widely used languages for real-world …
book
Java Projects - Second Edition
Learn how to build scalable, resilient, and effective applications in Java that suit your software requirements. …