Backend-Skill-Stack Documentation

website·Indexed 31 days ago

https://backend.incoder.org

A comprehensive collection of learning notes and summaries for Java backend development. It covers Java SE basics, JDK 1.8 features, object-oriented programming, MySQL Connector/J type conversions, and enterprise-level application development including frameworks, middleware, and data structures.

Tokens
5.5K
Snippets
23
Records
47
Agent score
50%

What's inside Backend-Skill-Stack

  1. Overview of Java Platform Editions

    Java is divided into three primary platform editions based on the target environment:

    • Java SE (Standard Edition): The core Java programming platform.
    • Java ME (Micro Edition): Designed for small, embedded devices.
    • Java EE (Enterprise Edition): Built on top of Java SE, designed for large-scale, enterprise-level applications.
  2. Overview of JDK 1.8 (Java 8) Key Features

    JDK 1.8, released by Oracle on March 18, 2014, introduced significant updates to the Java ecosystem, focusing on functional programming and modern API improvements. Key additions include:

    Language Enhancements:

    • Lambda expressions and Functional Interfaces
    • Default and Static methods in interfaces
    • Method References
    • Repeating annotations
    • Improved Type Inference
    • Extended Annotations Support

    Compiler Updates:

    • Support for Parameter names

    New Libraries and APIs:

    • Optional for handling nulls
    • Streams API for functional-style operations on collections
    • New Date/Time API (JSR 310)
    • Nashorn JavaScript engine
    • Base64 encoding/decoding
    • Parallel Arrays
    • Concurrency improvements

    New Tools:

    • jjs: The Nashorn engine shell
    • jdeps: Class dependency analyzer
  3. Understand Java Cross-Platform Capabilities

    Java achieves cross-platform compatibility (often described as "Write Once, Run Anywhere") by compiling source code into bytecode rather than native binary code. This bytecode is executed by the Java Virtual Machine (JVM). Note that while the Java programs are cross-platform, the JVM itself is platform-specific and must be installed for the target hardware/OS.
  4. Define classes and objects in Java

    In Java, a class is an abstract concept consisting of data (properties/member variables) and operations (methods). An object (or instance) is a concrete representation of a class. The process of creating an object is called instantiation.
    修饰符 class 类名 {
        // Member variables (properties)
        // Methods
    }
  5. Understand Java Date and Time Core Concepts

    Java's date and time handling is based on several key concepts aligned with ISO-8601 and UTC standards:

    • UTC (Coordinated Universal Time): A standard time without a specific timezone. It can be represented as a timestamp (e.g., 2018-10-8T11:22:33.567z) or with a timezone offset (e.g., 2018-10-8T11:22:33.567+08:00 for Beijing Time, UTC+8).
    • Instants: A specific point on the timeline (a single moment).
    • Intervals: The time span between two specific instants.
    • Durations: A quantity of time measured in milliseconds (adding a Duration to an Instant results in a new Instant).
    • Periods: A date-based period (e.g., days, months, years).
    • Chronology: A set of rules defining a calendar system.
    • TimeZones: Regional settings that define the offset from UTC.
  6. Core Concepts of Java Object-Oriented Programming (OOP)

    Java is an object-oriented programming language. Its design allows developers to create custom types and associated operations to manage large-scale software engineering more effectively. The core pillars of Java's OOP approach include:

    • Classes and Objects
    • Inheritance
    • Polymorphism
    • Encapsulation
    • Abstraction
  7. Instantiate objects using the new keyword

    The new keyword is used to create an object. It performs three steps:

    1. Allocates memory for the object.
    2. Calls the class constructor.
    3. Returns the memory address of the generated object.
    ClassName variableName = new ClassName();
  8. Initialize classes using static blocks

    Static blocks are used for class-level initialization. They execute exactly once when the class is loaded into the JVM, before any constructors are called. While constructors run every time a new object is created, the static block runs only once per class loading.
  9. Use the static keyword for shared members and methods

    The static keyword defines members that belong to the class rather than a specific instance:

    • Static Properties: All instances of a class share a single copy of a static variable. Changes made by one instance affect all others. Access via ClassName.variableName is recommended.
    • Static Methods: Accessed via ClassName.methodName. Static methods can be inherited but cannot be overridden.
  10. Implement constructors in Java

    Constructors initialize object properties. They must have the exact same name as the class (case-sensitive) and have no return type (not even void).

    • Default Constructor: If no constructor is declared, the Java compiler automatically adds a parameterless constructor with an empty body.
    • Custom Constructor: If a constructor is explicitly declared, the compiler will not provide a default one.
  11. Define abstract classes and methods in Java

    The abstract keyword is used to define classes and methods that are not fully implemented:

    • Abstract Class: A class modified with abstract cannot be instantiated (cannot be used with the new keyword).
    • Abstract Method: A method modified with abstract has a declaration but no implementation. Abstract methods must be defined within an abstract class.
  12. Install and configure Java on MacOS

    Install Java on MacOS by downloading the .dmg installer from the official Oracle website. After installation, configure the system environment variables in the profile file to ensure the Java runtime and compiler are accessible.
    # Check current Java version
    java -version
    
    # Edit the profile file
    sudo vim /etc/profile
    
    # Add the following lines to the end of /etc/profile
    # Replace 'jdk1.8.0_191.jdk' with your actual installed version path
    JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/"
    CLASS_PATH="$JAVA_HOME/lib"
    PATH=".:$PATH:$JAVA_HOME/bin"
    
    # Apply the configuration
    source /etc/profile
    
    # Verify JAVA_HOME is set correctly
    echo $JAVA_HOME