Skip to content
forked from forax/java-guide

A guide of modern Java (Java 17)

License

Notifications You must be signed in to change notification settings

atos93/java-guide

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

java-guide

A guide to modern Java (Java 17)

This guide is about learning Java from scratch if you know a bit of C or JavaScript.

This is a Work in progress, it should be ready when the next LTS of Java (Java 17) will be released. All the codes run with Java 14 with the preview features enabled.

Note: if you are looking to only what's new in Java 14 I have set of slides for that.

Content

  1. genesis.md
  2. basic_types.md
  3. methods.md
  4. jshell_vs_java.md
  5. numbers.md
  6. control_flow.md
  7. interface.md
  8. lambda.md
  9. list_and_map.md
  10. string_formatting.md
  11. class_and_encapsulation.md
  12. equals_hashCode_toString.md
  13. contract.md
  14. modifiable_vs_mutable.md
  15. null_and_optional.md
  16. inheritance.md
  17. exception.md
  18. enum.md
  19. nested_classes.md
  20. array.md
  21. implementing_interface.md
  22. generics.md
  23. wrapper.md
  24. variance.md
  25. limitation_of_generics.md
  26. stream.md
  27. collector.md
  28. data_structure.md
  29. sort.md

Using Java Shell (jshell)

Each chapter comes with executable examples that you can run using jshell.

To get the examples, just clone this repository

  git clone http://github.com/forax/java-guide

Then run jshell (at least Java 14 version)

   jshell --enable-preview

Then you can copy paste the examples inside jshell and see by yourself.

To quit use '/exit', to enable verbose error messages '/set feedback verbose', otherwise to get the help type '/help'

Using Jupyter notebook

on the cloud

You can run it directly in your browser Binder

or using docker

You need to have docker already installed, then

  • get the docker image from dockerhub
      docker pull forax/java-guide
    
  • run the docker image in a container
      docker run -p 8888:8888 forax/java-guide
    
  • open your browser using the tokenId printed on the console
      firefox http://localhost:8888/?token=tokenId
    

or install everything on your laptop

You need to have python3 and Java 14 already installed, then

  • clone this repository
      git clone http://github.com/forax/java-guide
      cd java-guide
    
  • install jupyter
      pip install notebook
    
  • install the ijava 1.3.0 kernel (from Spencer Park)
    wget https://github.com/SpencerPark/IJava/releases/download/v1.3.0/ijava-1.3.0.zip
    python3 install.py --sys-prefix
    
  • patch it with the repository file kernel.json list all kernels to see if the java kernel is installed
    jupyter kernelspec list
    
    then copy the file kernel.json from the folder docker to the java kernel directory
    cp docker/kernel.json /path/to/jupyter/kernels/java
    
  • set the env compiler option enabling the preview features
    export IJAVA_COMPILER_OPTS="--enable-preview -source 14"
    
  • run the notebook
    cd jupyter
    jupyter notebook
    

Build markdown and jupyter files from jshell files

The markdown files (.md) and the jupyter files (.ipynb) are derived/generated from the jshell files using a small Java script.

Using java 14

  java --source 14 --enable-preview build/build.java

About

A guide of modern Java (Java 17)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 93.0%
  • Java 6.4%
  • Dockerfile 0.6%