/java-a-course-for-beginners

Java Programming Tutorial for Beginners

Primary LanguageJavaScriptMIT LicenseMIT

Learn Java Programming in 250 Steps

Image

Hands on Step by Step Introduction to the most popular programming language

Getting Started

Installing Tools

Overview

Introduction

We love Programming. Our aim with this course is to create a love for Programming.

Java is one of the most popular programming languages. Java offers both object oriented and functional programming features.

We take an hands-on approach using a combination of JShell(An awesome new feature in Java 9) and Eclipse as an IDE to illustrate more than 200 Java Coding Exercises, Puzzles and Code Examples.

In more than 250 Steps, we explore the most important Java Programming Language Features

  • Basics of Java Programming - Expressions, Variables and Printing Output
  • Java Operators - Java Assignment Operator, Relational and Logical Operators, Short Circuit Operators
  • Java Conditionals and If Statement
  • Methods - Parameters, Arguments and Return Values
  • An Overview Of Java Platform - java, javac, bytecode, JVM and Platform Independence - JDK vs JRE vs JVM
  • Object Oriented Programming - Class, Object, State and Behavior
  • Basics of OOPS - Encapsulation, Abstraction, Inheritance and Polymorphism
  • Basics about Java Data Types - Casting, Operators and More
  • Java Built in Classes - BigDecimal, String, Java Wrapper Classes
  • Conditionals with Java - If Else Statement, Nested If Else, Java Switch Statement, Java Ternary Operator
  • Loops - For Loop, While Loop in Java, Do While Loop, Break and Continue
  • Immutablity of Java Wrapper Classes, String and BigDecimal
  • Java Dates - Introduction to LocalDate, LocalTime and LocalDateTime
  • Java Array and ArrayList - Java String Arrays, Arrays of Objects, Primitive Data Types, toString and Exceptions
  • Introduction to Variable Arguments
  • Basics of Designing a Class - Class, Object, State and Behavior. Deciding State and Constructors.
  • Understanding Object Composition and Inheritance
  • Java Abstract Class and Interfaces. Introduction to Polymorphism.
  • Java Collections - List Interface(ArrayList, LinkedList and Vector), Set Interface (HashSet, LinkedHashSet and TreeSet), Queue Interface (PriorityQueue) and Map Interface (HashMap, HashTable, LinkedHashMap and TreeMap() - Compare, Contrast and Choose
  • Generics - Why do we need Generics? Restrictions with extends and Generic Methods, WildCards - Upper Bound and Lower Bound.
  • Functional Programming - Lambda Expression, Stream and Operations on a Stream (Intermediate Operations - Sort, Distinct, Filter, Map and Terminal Operations - max, min, collect to List), Functional Interfaces - Predicate Interface,Consumer Interface, Function Inteface for Mapping, Method References - static and instance methods
  • Introduction to Threads and MultiThreading - Need for Threads
  • Implementing Threads - Extending Thread Class and Implementing Runnable Interface
  • States of a Thread and Communication between Threads
  • Introduction to Executor Service - Customizing number of Active Threads. Returning a Future, invokeAll and invokeAny
  • Introduction to Exception Handling - Your Thought Process during Exception Handling. try, catch and finally. Exception Hierarchy - Checked Exceptions vs Unchecked Exceptions. Throwing an Exception. Creating and Throwing a Custom Exception - CurrenciesDoNotMatchException. Try with Resources - New Feature in Java 7.
  • List files and folders in Directory with Files list method, File walk method and find methods. Read and write from a File.

What You will learn

  • You will learn how to think as a Java Programmer
  • You will learn how to start your journey as a Java Programmer
  • You will learn the basics of Eclipse IDE and JShell
  • You will learn to develop awesome object oriented programs with Java
  • You will solve a wide variety of hands-on exercises on the topics discussed below
  • You will learn the basics of programming - variables, choosing a data type, conditional execution, loops, writing great methods, breaking down problems into sub problems and implementing great Exception Handling.
  • You will learn the basics of Object Oriented Programming - Intefaces, Inheritance, Abstract Class and Constructors
  • You will learn the important concepts of Object Oriented Programming - Abstraction, Inheritance, Encapsulation and Polymorphism
  • You will learn to do basic functional programming with Java
  • You will learn the basics of MultiThreading - with Executor Service
  • You will learn about a wide variety of Collections - List, Map, Set and Queue Interfaces

Requirements

  • Connectivity to Internet to download Java 9 and Eclipse.
  • We will help you install Java9 with JShell and Eclipse.

Step Wise Details

Introduction

  • Course-Beginning
  • Course-Ending
  • Step 00 - How To Make Best use of the Course Guide?
  • Step 01 - Installing JDK 9 - with installation guide PDF
  • Step 02 - Verifying Java and Jshell
  • Step 03 - Troubleshooting Java installation
  • Step 04 - Setting Path environment variable in Windows

01-IntroductionToJavaProgrammingWithJShell-MultiplicationTable

  • Step 00 - Getting Started with Programming
  • Step 01 - Introduction to Multiplication Table challenge
  • Step 02 - Launch JShell
  • Step 03 - Break Down Multiplication Table Challenge
  • Step 04 - Java Expression - An Introduction
  • Step 05 - Java Expression - Exercises
  • Step 06 - Java Expression - Puzzles
  • Step 07 - Printing output to console with Java
  • Step 08 - Printing output to console with Java - Exercise Statements
  • Step 09 - Printing output to console with Java - Exercise Solutions
  • Step 10 - Printing output to console with Java - Puzzles
  • Step 11 - Advanced Printing output to console with Java
  • Step 12 - Advanced Printing output to console with Java - Exercises and Puzzles
  • Step 13 - Introduction to Variables in Java
  • Step 14 - Introduction to Variables in Java - Exercises and Puzzles
  • Step 15 - 4 Important Things to Know about Variables in Java
  • Step 16 - How are variables stored in memory?
  • Step 17 - How to name a variable?
  • Step 18 - Understanding Primitive Variable Types in Java
  • Step 19 - Understanding Primitive Variable Types in Java - Choosing a Type
  • Step 20 - Java Assignment Operator
  • Step 21 - Java Assignment Operator - Puzzles on Increment, Decrement and Compound Assignment
  • Step 23 - Java Conditionals and If Statement - Introduction
  • Step 24 - Java Conditionals and If Statement - Exercise Statements
  • Step 25 - Java Conditionals and If Statement - Exercise Solutions
  • Step 26 - Java Conditionals and If Statement - Puzzles
  • Step 27 - Java For Loop to Print Multiplication Table - Introduction
  • Step 28 - Java For Loop to Print Multiplication Table - Exercise Statements
  • Step 29 - Java For Loop to Print Multiplication Table - Exercise Solutions
  • Step 30 - Java For Loop to Print Multiplication Table - Puzzles
  • Step 31 - Programming Tips : JShell - Shortcuts, Multiple Lines and Variables TODO Move up
  • Step 32 - Getting Started with Programming - Revise all Terminology

02-IntroductionToMethods-MultiplicationTable

  • Step 00 - Section 02 - Methods - An Introduction
  • Step 01 - Your First Java Method - Hello World Twice and Exercise Statements
  • Step 02 - Introduction to Java Methods - Exercises and Puzzles
  • Step 03 - Programming Tip - Editing Methods with JShell
  • Step 04 - Introduction to Java Methods - Arguments and Parameters
  • Step 05 - Introduction to Java Method Arguments - Exercises
  • Step 06 - Introduction to Java Method Arguments - Puzzles and Tips
  • Step 07 - Getting back to Multiplication Table - Creating a method
  • Step 08 - Print Multiplication Table with a Parameter and Method Overloading
  • Step 09 - Passing Multiple Parameters to a Java Method
  • Step 10 - Returning from a Java Method - An Introduction
  • Step 11 - Returning from a Java Method - Exercises
  • Step 99 - Methods - Section Review

03-IntroductionToJavaPlatform

  • Step 00 - Section 03 - Overview Of Java Platform - Section Overview
  • Step 01 - Overview Of Java Platform - An Introduction - java, javac, bytecode and JVM
  • Step 02 - Java Class and Object - First Look
  • Step 03 - Create a method in a Java class
  • Step 04 - Create and Compile Planet.java class
  • Step 05 - Run Planet calss with Java - Using a main method
  • Step 06 - Play and Learn with Planet Class
  • Step 07 - JDK vs JRE vs JVM

04-IntroductionToEclipse-FirstJavaProject

  • Step 00 - Installing Eclipse
  • Step 01 - Creating a New Java Project with Eclipse
  • Step 02 - Your first Java class with Eclipse
  • Step 03 - Writing Multiplication Table Java Program with Eclipse
  • Step 04 - Adding more methods for Multiplication Table Program
  • Step 05 - Programming Tip 1 : Refactoring with Eclipse
  • Step 06 - Programming Tip 2 : Debugging with Eclipse
  • Step 07 - Programming Tip 3 : Eclipse vs JShell - How to choose?

05-IntroductionToObjectOrientedProgramming

  • Step 00 - Introduction to Object Oriented Programming - Section Overview
  • Step 01 - Introduction to Object Oriented Programming - Basics
  • Step 02 - Introduction to Object Oriented Programming - Terminology - Class, Object, State and Behavior
  • Step 03 - Introduction to Object Oriented Programming - Exercise - Online Shopping System and Person
  • Step 04 - Create Motor Bike Java Class and a couple of objects
  • Step 05 - Exercise Solutions - Book class and Three instances
  • Step 06 - Introducing State of an object with speed variable
  • Step 07 - Understanding basics of Encapsulation with Setter methods
  • Step 08 - Exercises and Tips - Getters and Generating Getters and Setters with Eclipse
  • Step 09 - Puzzles on this and initialization of member variables
  • Step 10 - First Advantage of Encapsulation
  • Step 11 - Introduction to Encapsulation - Level 2
  • Step 12 - Encapsulation Exercises - Better Validation and Book class
  • Step 13 - Introdcution to Abstraction
  • Step 14 - Introduction to Java Constructors
  • Step 15 - Introduction to Java Constructors - Exercises and Puzzles
  • Step 16 - Introduction to Object Oriented Programming - Conclusion

06-PrimitiveDataTypesAndAlternatives

  • Step 00 - Primitive Data Types in Depth - Section Overview
  • Step 01 - Basics about Java Integer Data Types - Casting, Operators and More
  • Step 02 - Java Integer Data Types - Puzzles - Octal, Hexadecimal, Post and Pre increment
  • Step 03 - Java Integer Data Types - Exercises - BiNumber - add, multiply and double
  • Step 04 - Java Floating Point Data Types - Casting , Conversion and Accuracy
  • Step 05 - Introduction to BigDecimal Java Class
  • Step 06 - BigDecimal Puzzles - Adding Integers
  • Step 07 - BigDecimal Exercises - Simple Interest Calculation
  • Step 08 - Java Boolean Data Type - Relational and Logical Operators
  • Step 09 - Java Boolean Data Type - Puzzles - Short Circuit Operators
  • Step 10 - Java Character Data Type char - Representation and Conversion
  • Step 11 - Java char Data Type - Exercises 1 - isVowel
  • Step 12 - Java char Data Type - Exercises 2 - isDigit
  • Step 13 - Java char Data Type - Exercises 3 - isConsonant, List Upper Case and Lower Case Characters
  • Step 14 - Primitive Data Types in Depth - Conclusion

07-Conditionals

  • Step 00 - Conditionals with Java - Section Overview
  • Step 01 - Introduction to If Else Statement
  • Step 02 - Introduction to Nested If Else
  • Step 03 - If Else Statement - Puzzles
  • Step 04 - If Else Problem - How to get User Input in Java?
  • Step 05 - If Else Problem - How to get number 2 and choice from user?
  • Step 06 - If Else Problem - Implementing with Nested If Else
  • Step 07 - Java Switch Statement - An introduction
  • Step 08 - Java Switch Statement - Puzzles - Default, Break and Fall Through
  • Step 09 - Java Switch Statement - Exercises - isWeekDay, nameOfMonth, nameOfDay
  • Step 10 - Java Ternary Operation - An Introduction
  • Step 11 - Conditionals with Java - Conclusion

08-Loops

  • Step 00 - Java Loops - Section Introduction
  • Step 01 - Java For Loop - Syntax and Puzzles
  • Step 02 - Java For Loop - Exercises Overview and First Exercise Prime Numbers
  • Step 03 - Java For Loop - Exercise - Sum Upto N Numbers and Sum of Divisors
  • Step 04 - Java For Loop - Exercise - Print a Number Triangle
  • Step 05 - While Loop in Java - An Introduction
  • Step 06 - While Loop - Exericises - Cubes and Squares upto limit
  • Step 07 - Do While Loop in Java - An Introduction
  • Step 08 - Do While Loop in Java - An Example - Cube while user enters positive numbers
  • Step 09 - Introduction to Break and Continue
  • Step 10 - Selecting Loop in Java - For vs While vs Do While

09-ReferenceTypes

  • Step 00 - Java Reference Types - Section Introduction
  • Step 01 - Reference Types - How are they stored in Memory?
  • Step 02 - Java Reference Types - Puzzles
  • Step 03 - String class - Introduction and Exercise - Print each word and char on a new line
  • Step 04 - String class - Exercise Solution and Some More Important Methods
  • Step 05 - Understanding String is Immutable and String Concat, Upper Case, Lower Case, Trim methods
  • Step 06 - String Concatenation and Join, Replace Methods
  • Step 07 - Java String Alternatives - StringBuffer and StringBuilder
  • Step 08 - Java Wrapper Classes - An Introduction - Why and What?
  • Step 09 - Java Wrapper Classes - Creation - Constructor and valueOf
  • Step 10 - Java Wrapper Classes - Auto Boxing and a Few Wrapper Constants - SIZE, BYTES, MAX_VALUE and MIN_VALUE
  • Step 11 - Java Dates - Introduction to LocalDate, LocalTime and LocalDateTime
  • Step 12 - Java Dates - Exploring LocalDate - Creation and Methods to play with Date
  • Step 13 - Java Dates - Exploring LocalDate - Comparing Dates and Creating Specific Dates
  • Step 14 - Java Reference Types - Conclusion

10-ArraysAndArrayList

  • Step 00 - Introduction to Array and ArrayList - Section Introduction with a Challenge
  • Step 01 - Understanding the need and Basics about an Array
  • Step 02 - Java Arrays - Creating and Accessing Values - Introduction
  • Step 03 - Java Arrays - Puzzles - Arrays of Objects, Primitive Data Types, toString and Exceptions
  • Step 04 - Java Arrays - Compare, Sort and Fill
  • Step 05 - Java Arrays - Exercise - Create Student Class - Part 1 - Total and Average Marks
  • Step 06 - Java Arrays - Exercise - Create Student Class - Part 2 - Maximum and Minimum Mark
  • Step 07 - Introduction to Variable Arguments - Need
  • Step 08 - Introduction to Variable Arguments - Basics
  • Step 09 - Introduction to Variable Arguments - Enhancing Student Class
  • Step 10 - Java Arrays - Using Person Objects and String Elements with Exercises
  • Step 11 - Java String Arrays - Exercise Solutions - Print Day of Week with Most number of letters and more
  • Step 12 - Adding and Removing Marks - Problem with Arrays
  • Step 13 - First Look at ArrayList - An Introduction
  • Step 14 - First Look at ArrayList - Refactoring Student Class to use ArrayList
  • Step 15 - First Look at ArrayList - Enhancing Student Class with Add and Remove Marks
  • Step 16 - Introduction to Array and ArrayList - Conclusion

11-ObjectOrientedProgrammingAgain

  • Step 00 - Object Oriented Programming - Level 2 - Section Introduction
  • Step 01 - Basics of Designing a Class - Class, Object, State and Behavior
  • Step 02 - OOPS Example - Fan Class - Deciding State and Constructors
  • Step 03 - OOPS Example - Fan Class - Deciding Behavior with Methods
  • Step 04 - OOPS Exercise - Rectangle Class
  • Step 05 - Understanding Object Composition with Customer Address Example
  • Step 06 - Understanding Object Composition - An Exercise - Books and Reviews
  • Step 07 - Understanding Inheritance - Why do we need it?
  • Step 08 - Object is at top of Inheritance Hierarchy
  • Step 09 - Inheritance and Overriding - with toString() method
  • Step 10 - Java Inheritance - Exercise - Student and Employee Classes
  • Step 11 - Java Inheritance - Default Constructors and super() method call
  • Step 12 - Java Inheritance - Puzzles - Multiple Inheritance, Reference Variables and instanceof
  • Step 13 - Java Abstract Class - Introductio
  • Step 14 - Java Abstract Class - First Example - Creating Recipes with Template Method
  • Step 15 - Java Abstract Class - Puzzles
  • Step 16 - Java Interface - Example 1 - Gaming Console - How to think about Intefaces?
  • Step 17 - Java Interface - Example 2 - Complex Algorithm - API defined by external team
  • Step 18 - Java Interface - Puzzles - Unimplemented methods, Abstract Classes, Variables, Default Methods and more
  • Step 19 - Java Interface vs Abstract Class - A Comparison
  • Step 20 - Java Interface Flyable and Abstract Class Animal - An Exercise
  • Step 21 - Polymorphism - An introduction

12-Collections

  • Step 01 - Java Collections - Section Overview with Need For Collections
  • Step 02 - List Interface - Introduction - Position is King
  • Step 03 - List Inteface - Immutability and Introduction of Implementations - ArrayList, LinkedList and Vector
  • Step 04 - List Inteface Implementations - ArrayList vs LinkedList
  • Step 05 - List Inteface Implementations - ArrayList vs Vector
  • Step 06 - List Inteface - Methods to add, remove and change elements and lists
  • Step 07 - List and ArrayList - Iterating around elements
  • Step 08 - List and ArrayList - Choosing iteration approach for printing and deleting elements
  • Step 09 - List and ArrayList - Puzzles - Type Safety and Removing Integers
  • Step 10 - List and ArrayList - Sorting - Introduction to Collections sort static method
  • Step 11 - List and ArrayList - Sorting - Implementing Comparable Inteface in Student Class
  • Step 12 - List and ArrayList - Sorting - Providing Flexibility by implementing Comparator interface
  • Step 13 - List and ArrayList - A Summary
  • Step 14 - Set Interface - Introduction - No Duplication
  • Step 15 - Understanding Data Structures - Array, LinkedList and Hashing
  • Step 16 - Understanding Data Structures - Tree - Sorted Order
  • Step 17 - Set Interface - Hands on - HashSet, LinkedHashSet and TreeSet
  • Step 18 - Set Interface - Exercise - Find Unique Characters in a List
  • Step 19 - TreeSet - Methods from NavigableSet - floor,lower,upper, subSet, head and tailSet
  • Step 20 - Queue Interface - Process Elements in Order
  • Step 21 - Introduction to PriorityQueue - Basic Methods and Customized Priority
  • Step 22 - Map Interface - An Introduction - Key and Value
  • Step 23 - Map Interface - Implementations - HashMap, HashTable, LinkedHashMap and TreeMap
  • Step 24 - Map Interface - Basic Operations
  • Step 25 - Map Interface - Comparison - HashMap vs LinkedHashMap vs TreeMap
  • Step 26 - Map Interface - Exercise - Count occurances of characters and words in a piece of text
  • Step 27 - TreeMap - Methods from NavigableMap - floorKey, higherKey, firstEntry, subMap and more
  • Step 28 - Java Collections - Conclusion with Three Tips

13-Generics

  • Step 01 - Introduction to Generics - Why do we need Generics?
  • Step 02 - Implementing Generics for the Custom List
  • Step 03 - Extending Custom List with a Generic Return Method
  • Step 04 - Generics Puzzles - Restrictions with extends and Generic Methods
  • Step 05 - Generics and WildCards - Upper Bound and Lower Bound

14-FunctionalProgramming

  • Step 01 - Introduction to Functional Programming - Functions are First Class Citizens
  • Step 02 - Functional Programming - First Example with Function as Parameter
  • Step 03 - Functional Programming - Exercise - Loop a List of Numbers
  • Step 04 - Functional Programming - Filtering - Exercises to print odd and even numbers from List
  • Step 05 - Functional Programming - Collect - Sum of Numbers in a List
  • Step 06 - Functional Programming vs Structural Programming - A Quick Comparison
  • Step 07 - Functional Programming Terminology - Lambda Expression, Stream and Operations on a Stream
  • Step 08 - Stream Intermediate Operations - Sort, Distinct, Filter and Map
  • Step 09 - Stream Intermediate Operations - Exercises - Squares of First 10, Map String List to LowerCase and Length of String
  • Step 10 - Stream Terminal Operations - 1 - max operation with Comparator
  • Step 11 - Stream Terminal Operations - 2 - min, collect to List,
  • Step 12 - Optional class in Java - An Introduction
  • Step 13 - Behind the Screens with Functional Interfaces - Implement Predicate Interface
  • Step 14 - Behind the Screens with Functional Interfaces - Implement Consumer Interface
  • Step 15 - Behind the Screens with Functional Interfaces - Implement Function Inteface for Mapping
  • Step 16 - Simplify Functional Programming code with Method References - static and instance methods
  • Step 17 - Functions are First Class Citizens
  • Step 18 - Introduction to Functional Programming - Conclusion

15-ThreadsAndConcurrency

  • Step 01 - Introduction to Threads and MultiThreading - Need for Threads
  • Step 02 - Creating a Thread for Task1 - Extending Thread Class
  • Step 03 - Creating a Thread for Task2 - Implement Runnable Interface
  • Step 04 - Theory - States of a Thread
  • Step 05 - Placing Priority Requests for Threads
  • Step 06 - Communication between Threads - join method
  • Step 07 - Thread utility methods and synchronized keyword - sleep, yield
  • Step 08 - Need for Controlling the Execution of Threads
  • Step 09 - Introduction to Executor Service
  • Step 10 - Executor Service - Customizing number of Threads
  • Step 11 - Executor Service - Returning a Future from Thread using Callable
  • Step 12 - Executor Service - Waiting for completion of multiple tasks using invokeAll
  • Step 13 - Executor Service - Wait for only the fastest task using invokeAny
  • Step 14 - Threads and MultiThreading - Conclusion

16-ExceptionHandling

  • Step 01 - Introduction to Exception Handling - Your Thought Process during Exception Handling
  • Step 02 - Basics of Exceptions - NullPointerException and StackTrace
  • Step 03 - Basics of Handling Exceptions - try and catch
  • Step 04 - Basics of Handling Exceptions - Exception Hierarchy, Matching and Catching Multiple Exceptions
  • Step 05 - Basics of Handling Exceptions - Need for finally
  • Step 06 - Basics of Handling Exceptions - Puzzles
  • Step 07 - Checked Exceptions vs Unchecked Exceptions - An Example
  • Step 08 - Hierarchy of Errors and Exceptions - Checked and Runtime
  • Step 09 - Throwing an Exception - Currencies Do Not Match Runtime Exception
  • Step 10 - Throwing a Checked Exception - Throws in method signature and handling
  • Step 11 - Throwing a Custom Exception - CurrenciesDoNotMatchException
  • Step 12 - Write less code with Try with Resources - New Feature in Java 7
  • Step 13 - Basics of Handling Exceptions - Puzzles 2
  • Step 14 - Exception Handling - Conclusion with Best Practices

17-Files

  • Step 01 - List files and folders in Directory with Files list method
  • Step 02 - Recursively List and Filter all files and folders in Directory with Step Files walk method and Search with find method
  • Step 03 - Read content from a File - Files readAllLines and lines methods
  • Step 04 - Writing Content to a File - Files write method
  • Step 05 - Files - Conclusion

More Concurrency with Atomic Operations and Concurrent Collections

  • Step 01 - Getting started with Synchronized
  • Step 02 - Problem with Synchronized - Less Concurrency
  • Step 03 - Enter Locks with ReEntrantLock
  • Step 04 - Introduction to Atomic Classes - AtomicInteger
  • Step 05 - Need for ConcurrentMap
  • Step 06 - Implementing an example with ConcurrentHashMap
  • Step 07 - ConcurrentHashMap uses different locks for diferrent regions
  • Step 08 - CopyOnWrite Concurrent Collections - When reads are more than writes
  • Step 09 - Conclusion

Java Tips

  • Java Tip 01 - Imports and Static Imports
  • Java Tip 02 - Blocks
  • Java Tip 03 - equals method
  • Java Tip 04 - hashcode method
  • Java Tip 05 - Class Access Modifiers - public and default
  • Java Tip 06 - Method Access Modifiers - public, protected, private and default
  • Java Tip 07 - Final classes and Final methods
  • Java Tip 08 - Final Variables and Final Arguments
  • Java Tip 09 - Why do we need static variables?
  • Java Tip 09 - Why do we need static methods?
  • Java Tip 10 - Static methods cannot use instance methods or variables
  • Java Tip 11 - public static final - Constants
  • Java Tip 12 - Nested Classes - Inner Class vs Static Nested Class
  • Java Tip 13 - Anonymous Classes
  • Java Tip 14 - Why Enum and Enum Basics - ordinal and values
  • Java Tip 15 - Enum - Constructor, variables and methods
  • Java Tip 16 - Quick look at inbuild Enums - Month, DayOfWeek

Troubleshooting

Youtube Playlists - 500+ Videos

Click here - 30+ Playlists with 500+ Videos on Spring, Spring Boot, REST, Microservices and the Cloud

Keep Learning in28Minutes

in28Minutes is creating amazing solutions for you to learn Spring Boot, Full Stack and the Cloud - Docker, Kubernetes, AWS, React, Angular etc. - Check out all our courses here

Text Lectures

Educational Announcements

Course Downloads - Course Guide and Presentation

Thank You for Choosing to Learn from in28Minutes.

Download the course material (presentation and downloads) for the course - CLICK HERE

I will see you in the next step!

Troubleshooting For Next Sections

Next sections need the latest version of Java and Eclipse Enterprise Edition.

If you face any problems:

Notes for Java and Eclipse Troubleshooting

Default Home Folder for JDK
  • Windows: C:\Program Files\Java\jdk-{version}
    • Example for JDK 16 - C:\Program Files\Java\jdk-16
    • Example for JDK 17 - C:\Program Files\Java\jdk-17
  • Mac: /Library/Java/JavaVirtualMachines/jdk-{version}.jdk/Contents/Home
    • Example for JDK 16 - /Library/Java/JavaVirtualMachines/jdk-16.jdk/Contents/Home
    • Example for JDK 17 - /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home
Default Home Folder for JDK
  • Windows: C:\Program Files\Java\jdk-{version}\bin
    • Example for JDK 16 - C:\Program Files\Java\jdk-16\bin
  • Mac: /Library/Java/JavaVirtualMachines/jdk-{version}.jdk/Contents/Home/bin
    • Example for JDK 16 - /Library/Java/JavaVirtualMachines/jdk-16.jdk/Contents/Home/bin

Notes for Next Lecture - Business Service, Data Service Code

/src/main/java/com/in28minutes/learnspringframework/sample/enterprise/flow/web/Controller.java
package com.in28minutes.learnspringframework.sample.enterprise.flow.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.in28minutes.learnspringframework.sample.enterprise.flow.business.BusinessService;

//Sending response in the right format
@RestController
public class Controller {

	@Autowired
	private BusinessService businessService;
	
	//"/sum" => 100
	@GetMapping("/sum")
	public long displaySum() {
		return businessService.calculateSum();
	}

}

/src/main/java/com/in28minutes/learnspringframework/sample/enterprise/flow/business/BusinessService.java
//Business Logic
package com.in28minutes.learnspringframework.sample.enterprise.flow.business;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.in28minutes.learnspringframework.sample.enterprise.flow.data.DataService;

@Component
public class BusinessService {
	
	@Autowired
	private DataService dataService;
	
	public long calculateSum() {
		List<Integer> data = dataService.retrieveData();
		return data.stream().reduce(Integer::sum).get();
	}
}

/src/main/java/com/in28minutes/learnspringframework/sample/enterprise/flow/data/DataService.java
package com.in28minutes.learnspringframework.sample.enterprise.flow.data;

import java.util.Arrays;
import java.util.List;

import org.springframework.stereotype.Component;

@Component
public class DataService {
	public List<Integer> retrieveData() {
		return Arrays.asList(12,34,56,78,90);
	}
	
}

Notes for Next Lecture - Docker and MySQL Configuration

Launch MySQL using Docker

docker run --detach --env MYSQL_ROOT_PASSWORD=dummypassword --env MYSQL_USER=courses-user --env MYSQL_PASSWORD=dummycourses --env MYSQL_DATABASE=courses --name mysql --publish 3306:3306 mysql:5.7

application.properties configuration

#spring.datasource.url=jdbc:h2:mem:testdb

spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost:3306/courses
spring.datasource.username=courses-user
spring.datasource.password=dummycourses
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL57Dialect

#courses-user@localhost:3306

mysqlsh commands

mysqlsh
\connect courses-user@localhost:3306
\sql
use courses
select * from course;
\quit

Docker Commands

docker container ls
docker container stop ID

Educational Announcements About Course Updates

Course Updates - Java New Features + Spring + Spring Boot + REST API

Thanks for helping this course reach 100,000 learners. There are thousands of learners pursuing this course every day! Thanks for all your love.

Java is evolving continuously. Really excited to announce amazing updates to the course! We are adding a Real World Project with Spring and Spring Boot to the course!

Important Updates

  • Updated the course to use JDK 16 (released last week)
  • Added New Content
    • Java Modularization
    • Records
    • Text Blocks
    • Switch Expression
    • Local Variable Type Inference
    • New Java API in Files, List, Set, Map and String
  • Added a New Section to Build a Real World Java Rest API using:
    • Spring Framework
    • Spring Boot
    • JPA
    • Data JPA
    • H2/MySQL
    • Docker

What are you waiting for?

I'm really excited about these changes. I hope you are too!

Good Luck.

Please feel free to post your questions here!

Ranga

Keep Learning Every Day!

Later

Last week we announced amazing updates to the course.

We are receiving wonderful feedback from our learners.

All the updates are FREE for the existing learners of the course.

Get started with Java New Features, Spring and Spring Boot right now!

Good Luck

Docker and Kubernetes are essential in the microservices world today. Recognising the need, In January 2021, we announced amazing updates to the course:

Section 6 - Microservices with Spring Cloud - V2 Section 7 - Docker with Microservices using Spring Boot and Spring Cloud - V2 Section 8: Kubernetes with Microservices using Docker, Spring Boot and Spring Cloud - V2 We are receiving wonderful feedback from our learners.

All the updates are FREE for the existing learners of the course.