Giter Site home page Giter Site logo

java-guide's Introduction

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

java-guide's People

Contributors

akullpp avatar forax avatar jeffmaury avatar mvitz avatar oboff avatar sormuras avatar stevenschlansker avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.