Java - Multi-Paradigm Programming - Software Application Development

Fanuc Industrial Robots for Tesla Manufacturing
Fanuc Industrial Robot in room 2001 D from our department: www.dice.ase.ro
... Meet Robotics as optional lecture for the Economic Informatics 3rd year students
@ http://www.acs.ase.ro/robotics

Please follow the info @:

REPOs

Java Standard Edition lectures are published @ https://github.com/acsroeu/java | from the personal Cristian Toma's GitHub account: https://critoma.github.io/javase/ & https://github.com/critoma/javase/

You can use this command to clone the repo on your storage / simply download the ZIP from the website: git clone https://github.com/acsroeu/java.git 

Mission

Technological transfer from the teacher/university to the students of the practical and theoretical knowledge regarding Software Applications Development & Multi-paradigm Programming and achievment of the object oriented and other programming paradigms concepts within cross-platform and open source approach using Java platform.

Lectures & Labs

No.
Lecture
PDF
Lecture Headlines Description

Lecture

Sources

Laboratory Description Access
Lab - Eclipse / IntelliJ Project
-

Java Programming administrative issues

General Recommandations:
- Download the bundle lecture archives, in order to run Samples in command line in Linux Ubuntu OS LTS  - native or in Oracle VM VirtualBox / Docker.

How does a PC work? 
https://www.youtube.com/watch?v=d86ws7mQYIg

Computational Thinking:
https://acs.ase.ro/code-club 

Linux OS Commands Recap:

https://www.youtube.com/watch?v=ghTJS52ghGU&list=PL1bEcqKguUdOHl1nqggWCqTWx9vyoyWJ9
https://www.youtube.com/playlist?list=PL1bEcqKguUdOHl1nqggWCqTWx9vyoyWJ9

OS Recap: 

https://www.youtube.com/watch?v=b6MxozZv6-M
https://www.youtube.com/playlist?list=PLRJP-g0nSX0e0kgIW6bom0kQtx4dyHyZx
 

General Recommandations:

Download ZIP (not installer):
1. OpenJDK 21 LTS: https://jdk.java.net/21/ | https://jdk.java.net/archive/ 

2. IDE: Eclipse 2023-12 Enterprise Edition | IntelliJ IDEA Community Edition


- Download the bundle laboratories archives, in order to import and run Samples in Eclipse IDE under Linux Ubuntu OS LTS - native or in Oracle VM VirtualBox. Alternatively, Docker container may be use, although the Eclipse/IntelliJ IDE for the labs is not included into the image.

01.

Java and JVM Overview, Java SE Synthax intro (if, switch, for, while), methods, Arrays, OOP intro and C++ analogy - will be reloaded in next lecture + RasbianOS on a real RPi 3 board / macOS / Ubuntu Linux / Google Shell Cloud, the Java byte-code class running without any modification/re-compiling - Write Once, Run Anywhere! concept.

Classes & Objects in theory vs. engineering + HOW is working a Stack VM + run&debug in IDE and command line - set the environment and Clone method.

JVM:
https://www.youtube.com/watch?v=QHIWkwxs0AI 

Oracle Java Bytecode Crash Course:
https://www.youtube.com/watch?v=e2zmmkc5xI0

Multi-paradigm Programming Motivation

The clone method necessity and implementation, "shallow" versus "deep" copy,, class and objects. 
02. Java Arrays and OOP Recap. Java SE Deployment alternatives from command line classes and libraries/JARs to ANT/Maven/Gradle build automation tools, Graal VM and Continous Integration Engineering in Jenkins. Java Arrays example in Eclipse IDE with standard programming, OOP - export to JAR library and the libraries usages and the modules.







03. Java OOP - Class, Objects + Immutable objects, Interface, Abstract Class, Inheritance, Polymorphism - late binding, "has a" versus "is a" relationship, Interface as Type ( declarative versus real type) analogy with C++ "pure" polymorphism, ClassCastException + Robocode Assignments. Java Inheritance, Polymorphism, Interface as type, Class cast exception. The exemple has also JUnit 4 for training the students with automatic evaluation approach - second project. The entry point for the development is the third project.



04. Java Generics Programming and Data Structures/JCF - Java Collection Framework in analogy with C++ STL (Standard Template Library) in terms of: containers, iterators, and algorithms. Java Generics and Datastructures/JCF - Java Collection Framework with List<E> and Map<K,V> for interface as type.
05. Java I/O - Input / Output at byte and char level in stream oriented approach, File and RandomAccessFile classes. Java Native Interface - JNI (for understanding native methods) and Annotation plus Reflection (for understanding FTP server/automation of tests and XML parsing) will be a plus for understanding future topics. Also minimal JUnit 4 Intro as examplification of the annotations and reflections topics. Java IO DataInputStream, DataOutputStream and RandomAccessFile sample. The second projects contains the JUnit4 validation (as in the test and exam) and the thrid link is an epmty project same as in the test.


06.

YouTube: https://www.youtube.com/@cristian-valeriutoma7358

Reload the previous lecture in terms of serialization, annotation + reflection, and JNI. Also as new topics the exceptions mechanism and two Source Code Design Patterns - Factory Methods and Singleton.

Java Objects Graph serialization sample.
07. Java 8+/21+ Features and Functional Programming: JavaScript Engine, Call-back and Inner Classes, Method references, default method, lambda expressions + functional interfaces, processing streams, Optional, Date/Time, and new API (Base64). Java 8 sample for testing the functional interfaces and lambda.
08. Multi-threading vs. multi-process, Multi-threading models, features, atomic operations, JVM and OS threads; Java API for multi-threading, Java Multi-threading issues – Singleton vs. Immutable Objects - Software Design Patterns impacted by Multithreading; Parallelism Q&A - sample for concurrent access and file parallel copying. Multi-threading for common concurrent resources access (Synchronized - build-in monitor objects).
09. Advanced Java Multi-threading (java.util.concurrent - ExecutorService + Future-Callable + Lock/Semaphore + Producer/Consumer) and Java 8+ Lamdba expressions for multi-threading mechanisms for HPC + Fabrics - Virtual Threads. Standard Multi-Threading, Executor/Service and Future-Callable + Virtual Threads - Fabrics from java.util.concurrent for adding the elements of vectors/arrays in parallel. 
* The didactic activity (lecture/laboratory/seminar 9) is dedicated for the test on PC; it could be in extra time
10. Java Networking Intro: TCP vs. UDP over IP with Java Socket programming. UDP case study with traffic analysis. UDP Socket Programming for uni-cast/multi-cast/broad-cast communications sample
11. Socket WebServer (TCP-HTTP with multi-threading), Java NIO (New Input/Output), RegEx (Regular Expressions) and Java 9+ New Features (e.g. HTTP2 Client, modified try-catch statements, etc.) - JDK 9+ Modules (see lecture 1, 2)  TCP Socket for implementing a trivial web/HTTP server sample with reg-ex parsing and NIO TCP Client

12. Java XML (JAXB2), JSON Parsing (JSON.org / Jackson) and JDK 11+ Reactive Streams Java XML and JSON - Data Structures Encoding/Decoding within Reactive Streams Sample
13. JDBC and NoSQL Database Programming

Database Programming Sample for working with relational database (MySQL/SQLite) via JDBC and NoSQL database (MongoDB) via Java MongoDB library

14. GUI Intro (FX) and event handling. Java FX (MVP - Model View Presenter design pattern architecture for RIA - Rich Interface Applications) and Kotlin intro as another JVM based language with Multi-paradigm programming support (Object Oriented, Functional, etc.) Java FX + Multi-threading + socket including JAR development and call-back/lambda mechanism and reactive streams from GUI for asynchronous calls. There is a ZIP empty for interaction within the labs. After the Java language synthax and the OOP (Objected Oriented Programming) and FP (Functional Programming) are assimilated, the multi-paradigm programming key concepts can be studied in another programming laguage/platform JVM (Java Virtual Machine) based - such as: Kotlin, Scala, Jython, etc.



 
 

*. Additional to the didactic activities (lectures/labs/seminars) will be items dedicated for the team projects presentations and/or discussions regarding Java eco-system into: Smart-Cards / Secure Elements (Java Card) - CyberSecurity, IoT - Internet of Things/Robotics/Drones (Java SE-e), Embedded/Mobile devices (Android Java/Kotlin), Cloud & Web - Jakarta EE, Reactive Micro-Services and REST Java, A.I. - Neural Networks - DeepLearning4J/Java Keras/Tensorflow, Microbiology/Neurosciences - BioJava, Quantum Computing - Java Strange & StrangeFX, ...

 

Prerequisites

Fundamentals of C/C++ - OOP - Object Oriented Programming, Linux/Windows OS and Networking topics. 

E-Framework Solutions & Resouces Downloads / Access:

E-Framework solutions for Java Programming lectures and labs are stored in Git. The students may get them into the Oracle VM VirtualBox client virtual machine or Docker Container Image, and they are provided by Cyber Security Master program - http://ism.ase.ro

The details are the following:

1. The source code for the lectures and labs is in Git @: https://github.com/critoma/javase | https://github.com/critoma/javase/archive/master.zip | https://critoma.github.io/javase/

2. Docker Container Image with Linux Ubuntu 20.04 LTS for download (docker pull critoma/linux-u20-dev-security-ism):
https://hub.docker.com/r/critoma/linux-u20-dev-security-ism

Evaluation & Gradebook Mark

The final exam mark is 70% (in examination session for the lecture), and the assesments/homeworks/reports/test&quizzes done by the student, during the semester are 30% (seminar/laboratory) from the evaluation mark. As milestone during the semester, there is a PC test, in terms of Java SE written programs for a specific task and the (team) project in week 14 or another test.

For passing the discipline the student MUST obtain the final mark 5 out of 10 with the following cummulative conditions which MUST be achieved - MANDATORY:
- The examination mark within exam session must be at least 5 out of 10
- The test(s) during the seminar is/are mandatory
- The project/test must be presented within laboratory classes / submitted to the theacher within the deadline (where is requested; the project can be replaced by a test at the teacher decision)
- At least 75+ % presences (for the gropus with 14 weeks: 11 didactic activities out of 14) within the seminars / laboratories; because the lack of the resources / infrastructure (e.g. # of rooms with 40+ PCs, large groups of the 2nd year - the avg. studentts no per group is 22+, etc.), the students from 3rd year may not attend to the labs.
- At least half of the lectures assignments must be submitted due the deadlines.
- At least half of the lectures and seminars assignments must be submitted due the deadlines and compliant with the published conditions.
- Min mark at the lab/seminar is 40% from the max of the seminar mark in order to enter in the exam
- At lectures, Kahoot or Socrative is used for interractive mini-contests and the presences are taking into account for the examination.

References

1. Scott Selikoff, Jeanne Boyarsky, "OCP Oracle Certified Professional Java SE 17 Developer Study Guide", Sybex/John Wiley & Sons (2022), ISBN: 978-1-119-86458-5

2. Herbert Schildt, "Java: The Complete Reference, Eleventh Edition, 11th Edition", Publisher McGraw-Hill, (Dec, 2018), Language: English, ISBN: 9781260440249
3. Joshua Bloch, "Effective Java 3rd Edition", Publisher Addison-Wesley (Dec 27, 2017), ISBN: 978-0 9780134686097
4. Elisabeth Freeman, Eric Freeman, Bert Bates, Kathy Sierra, Elisabeth Robson, "Head First Design Patterns", Publisher: O'Reilly Media; 1 edition (November 1, 2004), ISBN-10: 0596007124, ISBN-13: 978-0596007126
5. Bruce Eckel, “Thinking in Java", Publisher: Prentice Hall; 4 edition (February 20, 2006) , ISBN-10: 0131872486, ISBN-13: 978-0131872486
6. James Gosling, Bill Joy, Guy Steele, Gilad Bracha, Alex Buckley - "The Java Language Specification, Java SE 7 Edition": http://docs.oracle.com/javase/specs/jls/se7/jls7.pdf
7. Tim Lindholm, Frank Yellin, Gilad Bracha, Alex Buckley – “The Java Virtual Machine Specification, Java SE 7 Edition”: http://docs.oracle.com/javase/specs/jvms/se7/jvms7.pdf
8. Bill Venners, “Inside the Java 2 Virtual Machine", Publisher: McGraw-Hill Companies; 2nd edition (January 6, 2000), ISBN-10: 0071350934, ISBN-13: 978-0071350938
9. My Experience and lectures/labs slides presentations, examples, virtual machines/docker images-containers + your visual, kinetic and auditory memory + http://ism.ase.ro | http://acs.ase.ro

10. Web Resources & Tutorials:
https://openjdk.java.net | http://java.sun.com
http://www.oracle.com/technetwork/java/index.html
http://www.oracle.com/technetwork/index.html
http://docs.oracle.com/javase/tutorial/
11. Java support archive

Laboratory Test Evaluation Topics

  • Mark 5:
    • Development of Java projects - stand-alone and libraries (JAR) in command line with JDK (8/9/11) and IDE - Eclipse/IntelliJ IDEA
    • Java classes with minimum 3 fields according with the test requirements
    • Default constructor and constructors with parameters
    • Methods inhereted overriding from Object class: clone and equals
    • Accessor methods: get/set
    • Java arrays: uni-dimenssional and multidimenssional
    • Inheretance with polymorphism highlighting
    • Class relationships "has a" (composition) and "is a" (inheretance)
    • Debugging at runtime and objects memory layout understanding (deep-copy versus shallow-copy)
  • 1 point:
    • Java I/O Streams - byte and char oriented
    • Serialization and Deserialization mechanism
    • Exceptions handling with: try {...} catch() {...} and throws statements
    • Interfaces implementations and abstract classes approaches + immutable objects and Comparable interface (method compareTo) + hash method overriding
  • 1 point:
    • Java Generics & Reflection
    • Java Collection Framework: containers, iterators and algorithms - java.util.*
    • Software Design Patterns Intro: Singleton & Factory Methods
  • 1 point: Functional programming and Lambda Expressioons in Java 8
  • 1 point:
    • "Classic" Multi-threading for parallelism and concurrency 
  • 1 point:
    • Call-back mechanism / Advanced JVM feaures
    • Memory and algorithms optimizations
    • Original implementations of the test requirements

EXAM PC Development Final Evaluation in the Examination Session

  • Mark 5 (All items are MANDATORY):
    • Development of Java projects - stand-alone and libraries (JAR) and JDK 9 and 11 modules, in command line with JDK (8 and 9 and 11) and IDE - Eclipse/IntelliJ
    • Default constructor and constructors with parameters
    • Methods inhereted overriding from Object class: clone and equals
    • Accessor methods: get/set
    • Java arrays: uni-dimenssional and multidimenssional
    • Java classes with the composition ("has a") and inheritance ("is a") relationships plus polymorphism highlighting
    • Interfaces implementations and abstract classes approaches + immutable objects and Comparable interface (method compareTo) + hash method overriding
    • Java I/O Streams - byte and char oriented
    • Serialization and Deserialization mechanism
    • Exceptions handling with: try {...} catch() {...} and throws statements
    • Java Generics & Reflection + Annotations (including Meta-annotations)
    • Java Collection Framework: containers, iterators and algorithms - java.util.*
    • Multi-threading for parallelism and concurrency (incl. java.util.concurrent  - Executor/Services and Callable/Future mechanisms plus parallel computing - HPC = High Performance Computing)
    • Networking Programming (TCP, UDP and TCP with muti-threading) + Objects serialization/deserialization within the TCP/IP connections
    • Debugging at runtime and objects memory layout understanding (deep-copy versus shallow-copy)
  • 1 point:
    • Simple Software Design Patterns: Singleton & Factory Methods
    • Functional programming and Lambda Expressioons in Java 8+
  • 1 point:
    • JDBC (Java Data-Base Connectivity) using SQLite / MySQL / Oracle and NoSQL programming
  • 1 point:
    • XML Parsing (using annotations within JAXB2 library) and JSON objects encoding/decoding (using third-party libraries such as JSON.org/Jackson)
  • 1 point: Java NIO - New Input Output / HTTP2 sync & async programming (client) 
  • 1 point:
    • GUI - Java FX + call-back mechanisms / Reactive Streams
  • * point:
    • Advanced JVM features / Gradle, Maven, ANT for projects building automation - optional / Profiling & Test Intro (JUnit) - optional
    • Memory and algorithms optimizations
    • Original implementations of the test requirements

Assignments

The assignments are useful for practicing the Java lectures topics in developement and implementation for individual and team tasks.

Assignment 01.

Deadline - YYYY/MM/dd HH:mm: Current Year/03/11 23:50 GMT+2
Problem description: "Computing Taxes Problem - The US federal personal income tax is calculated based on the filing status and taxable income. There are four filing statuses: single filers, married filing jointly, married filing separately, and head of household. The tax rates for 2009 (20xx?) are shown below:"

Upload and packiging: "The ZIP file has the source code files + *.sh/*.bat file for compiling and running the sample. The ZIP filename rule will have JavaSE_A01_SURNAME_FirstName1_FirstName2.zip". The upload is available through SAKAI/Moodle, please see E-Learning Solution section from this page.
Objective: Implement using if-else and switch statements - please see Lecture 01 for start-up.
Copyright: Liang, Introduction to Java Programming, Eighth Edition, 2011 Pearson Education, Inc. All rights reserved. 0132130807

Assignment 02.

Deadline - YYYY/MM/dd HH:mm: Current Year/03/11 23:50 GMT+2
Problem description: "Write a simple Java program that uses nested for loops to print a multiplication table – nested loops."
Upload and packiging: "The ZIP file has the source code files + *.sh/*.bat file for compiling and running the sample. The ZIP filename rule will have JavaSE_A02_SURNAME_FirstName1_FirstName2.zip". The upload is available through SAKAI/Moodle, please see E-Learning Solution section from this page.
Objective: Implement using for and while statements - please see Lecture 01 for start-up.
Copyright: Liang, Introduction to Java Programming, Eighth Edition, 2011 Pearson Education, Inc. All rights reserved. 0132130807

Assignment 03.

Deadline - YYYY/MM/dd HH:mm: Current Year/03/11 23:50 GMT+2
Problem description: "Declare one hundred numbers in a Java program, compute their average, and find out how many numbers are above the average."
Upload and packiging: "The ZIP file has the source code files + *.sh/*.bat file for compiling and running the sample. The ZIP filename rule will have JavaSE_A03_SURNAME_FirstName1_FirstName2.zip". The upload is available through SAKAI/Moodle, please see E-Learning Solution section from this page.
Objective: Implement using Java methods, arrays, for and while statements - please see Lecture 01 for start-up.
Copyright: Liang, Introduction to Java Programming, Eighth Edition, 2011 Pearson Education, Inc. All rights reserved. 0132130807

Assignment 04.

Deadline - YYYY/MM/dd HH:mm: Current Year/03/11 23:50 GMT+2
Problem description: "Develop in Java, 'Matrix' class and write a program that uses Matrix objects."
Upload and packiging: "The ZIP file has the source code files + *.sh/*.bat file for compiling and running the sample. The ZIP filename rule will have JavaSE_A04_SURNAME_FirstName1_FirstName2.zip". The upload is available through SAKAI/Moodle, please see E-Learning Solution section from this page.
Objective: Implement OOP - Object Oriented Progrmming paradigms using Java class, interface, methods, arrays, for and while statements - please see Lecture 01 for start-up.

Assignment 05.

Deadline - YYYY/MM/dd HH:mm: Current Year/03/15 23:50 GMT+2 
Problem description: "Develop in Java, Eclipse/IntelliJ projects in BOTH: non-OOP and OOP approaches (but without the JCL - Java Collection Framework) for the following problems - also include the pics with the logic flow:

5.1. A person is tracking the gas consume of the his/her car in terms of liters and money invest per litre in every day. Find the overall consume and the average consume in both money and liters.

5.2. A software developer is staying a certain number of the minutes in front of the screen per day and he/she is counting them for 3 weeks. Find out the biggest and the smallest amount in minutes in front of the display and in which days happened.

5.3. In a students class we have m students and n assignments mark for each student. We have to find the average mark for each student and the average mark of the entire class. Extend the example to calculate the average per class and total for the entire year with minimum 5 groups/classes.

5.4. In a rent-car company, there are n cars and they are monitored m days in terms of the km per day. Find out the average per m days for each car. In addition find out the max and min of the km per day for each car.

5.5. In a parking lot with OCR cameras and access cards there are n places for the cars. In each parking place, there are parking different cars which are staying the different number of minutes. Each parking place is monitored for 5 working days. Find out the max and min time spent by the car for each place."

Upload and packiging: "The ZIP file has the source code files + *.sh/*.bat file for compiling and running the sample. Also the ZIP bundle must contain the JPEG small pics of the data flows exported from http://draw.io or MS Visio. The ZIP filename rule will have JavaSE_A05_SURNAME_FirstName1_FirstName2.zip". The upload is available through SAKAI/Moodle, please see E-Learning Solution section from this page.
Objective: Implement business logic flow and OOP - Object Oriented Progrmming paradigms using Java class, interface, methods, arrays, for and while statements - please see Lecture 01 for start-up.

Assignment 06.

Deadline - YYYY/MM/dd HH:mm: Current Year/03/22 23:50 GMT+2
Problem description: Implement in Java Robocode (robocode-1.9.0.0), the following tasks:
6.1 Using just the ahead and turnRight/turnLeft methods create a robot that travels in a complete square once, beginning from its starting position. Make the robot travel 150 units for each side of the square.
6.2 Using a for loop create a robot that travels in a complete square 10 times.
6.3 Adapt the code so that it uses a loop that repeats four times to control the forward movement and turns.
6.4 Using a while loop create a robot that travels in a square forever (or until the round ends anyway).
6.5 Alter your robot so that it counts the number of squares it has travelled and writes this to the console.
6.6 Alter the above robot so that it incorporates an if statement such that it travels first clockwise and then anti-clockwise (hint: x % 2 == 0 for even numbers of x, and turnRight and turnLeft can accept negative degrees). Also have the robot print out whether it's currently travelling clockwise or anti-clockwise.
6.7 Create a new method called moveInSquare. The method should return void, and accept a single parameter, of type int called lengthOfSide. Alter the code from exercise 5.5 above so that the statements that describe how to move in a square are now in this method. Alter the run method so this method is called to make the robot move.
6.8 Experiment with adding additional attributes that control your robots behaviour:
a. a boolean attribute called aggressive can indicate whether the gun should fire at each corner
b. a boolean attribute called scanForRobots can control whether the robot rotates its radar at each corner
c. other attributes can control the size of the square, the number of degrees the gun and radar are turned, the direction of their turn, etc.
Also, create into the robot code with an 'onScannedRobot' method. Consult the documentation for the parameters and return types of the method. Implement the method to do something useful when it receives the event, e.g:
a) Write out the name of the robot you’ve seen, its current energy, and its distance
b) Fire on it!
Note: this extends the previous exercise so that its got all the other behaviour. It just adds this one extra event handler.

Upload and packiging:
"The ZIP file has the source code files + *.sh/*.bat file for compiling and running the sample. The ZIP filename rule will have JavaSE_A06_SURNAME_FirstName1_FirstName2.zip". The upload is available through SAKAI/Moodle, please see E-Learning Solution section from this page.
Objective: Implement if-else, switch, for and while statements inside a AI Game framework already developed by a third-party entity - please see Lecture 01 and 02 for start-up.
Hints: Download Robocode 1.9.0.0 from http://sourceforge.net/projects/robocode/files/latest/download?source=files. Be sure that you are testing the "game" using a network connection available. Please take a look into the following sections for hints.
- Unzip/extract the kit in /home/stud/javase/lectures
- Go to into the extracte directory and change permision for *.sh files from the directory of robocode (chmod 755 *.sh).
- Run (double click) on 'robocode.sh' file
- Click in main menu on 'Robot->Source editor' and create the source code of the robot ('File->New->Robot' - Package: eu.ase.jrobot) in order to implement the exercices.
- Implement the requirements in 'public void run()' method from the your class robot, which extends 'robocode.Robot' class.
- Compile the created source code ('Compiler->Compile').
- Start new battle from the main window of the Robocode ('Battle->New')

Assignment 07.

Deadline - YYYY/MM/dd HH:mm: Current Year/04/15 23:50 GMT+2
Problem description: Implement the following tasks using Java Multithreading API:
7.1 Parallel addition for two large vectors - benchmark with running time on various configurations (e.g. millis consumed in 8 threads on 2 cores, 4 threads on 4 cores, etc.)
7.2 Parallel dot product between two large vectors - benchmark
7.3 Parallel addition for two large matrixes - the two input matrix are read from file stream (text file) and the output is written also in file stream (text file) + benchmark
7.4 Parallel addition of the items from each row of a matrix object - benchmark
Upload and packiging: "The ZIP file has the source code files + *.sh/*.bat file for compiling and running the sample. The ZIP filename rule will have JavaSE_A07_SURNAME_FirstName1_FirstName2.zip". The upload is available through SAKAI/Moodle, please see E-Learning Solution section from this page.
Objective: Use Java API multi-threading for concurrency and parallelism.