About the Course
This course will cover the basic knowledge needed for writing Java programs. Participants will write, compile and execute Java programs, with special emphasis on basics, programming techniques and key practices of object-oriented programming. The learners in this course will write, compile and execute Java programs using both command-line interface (CLI) or an IDE (Eclipse, IntelliJ or VS Code).
System.out.println("Hello Java");
0. Java Environment and Tools
Installing the JDK
Configuring IDE
Creating a project
Running the project and inspecting output
1. Hello Java
The main() method
Variables
Statements Note: statements describe all activities of a program; statements appear inside methods and classes.
Expressions Note: Expressions produce values; an expression is evaluated to produce a result that is to be used as part of another expression or in a statement.
2. Java Language, Hello Again
Comments
Javadoc comments
Variables and Constants Note: In just about every programming language and programs, we have to keep track of many pieces of data, such as marks in an exam, a date of birth, email addresses, position of an image on the screen, current score in a game etc. So we create variables to hold that data. A variable is a container, its you grabbing a little piece of computer memory and giving it a name, so that we can use it while our program is running. We create it, we name it, we put a value in it and we change the value as we need to.
In Java you create a variable like this: Syntax: <data type> <identifier name>; Examples: int myInteger; String myString; char aSingleLetter;
Thus, variables store information that you plan to change and reuse over time. On the other hand, Constants store information that is, well, constant.
Statements
Expressions
Types
Operators
Arrays
3. Statements and Expressions, Again
Control flow statements
if/else conditionals
switch statements
Looping statements
do/while statement
while statement
the for statement
the enhanced for loop
break/continue
Unreachable statements
Assignment
The null value
String type
Variable access
Method invocation
4. Objects in Java
Object creation Note: we look at object creation in detail in a later section
The instanceof operator
Arrays
Types and Classes and Arrays, Oh My!!
5. Classes and Objects
Declaring and Instantiating Classes
Accessing Fields and Methods
Access modifiers preview
Methods
Local variables
Shadowing
Argument passing
Method overloading
6. Object creation
Constructors
Working with overloaded constructors
Object destruction
Wrappers for primitive types
7. Packages
Importing classes
Custom Packages
Member Visibility and Access
Compiling with Packages
8. Advanced Class Design
Subclassing and Inheritance
Interfaces
9. Text
Note: Parsing and formatting text is a large, open-ended topic.
Constructing Strings
Strings from Objects
Comparing Strings
Searching
String Method Summary
Parsing Numbers
Tokenizing Text
10. Utilities
The java.lang.Math Class
Local Dates and Times
Comparing and Manipulating Dates and Times
Time Zones
Parsing and Formatting Dates and Times
Parsing Errors
11. Exception handling
Exceptions
try/catch clause
Stack traces
The finally clause
Throwing exceptions