Eg: int vs Integer
int is primitive type, while Integer is a class (eg: Integer.parseInt("1") is a call of Integer's class method)
All primitive type in Java has an equivalent wrapper class:
- byte -> Byte
- short -> Short
- int -> Integer
- long -> Long
An application calls an Observable object's notifyObservers method to have all the object's observers notified of the change.
Usage: Weather notification, wechat notification
Restrict the instantiation of a class to one object. eg:Login system.
The instance of Singleton class is created at the time of class loading
| // change to the date range you want yyyy/mm/dd | |
| var fromDate = new Date('2018/08/05'); | |
| var toDate = new Date('2018/10/25'); | |
| fromDate.setHours(0, 0, 0, 0); | |
| toDate.setHours(0, 0, 0, 0); | |
| var intervalId = null; | |
| var weirdSound= new Audio("https://www.freesound.org/data/previews/256/256458_4772965-lq.mp3"); | |
| var monthNames = ["January", "February", "March", "April", "May", "June", | |
| "July", "August", "September", "October", "November", "December" |
Usually, ticket released every day at 12 or 14:30(Time in Ireland).
https://burghquayregistrationoffice.inis.gov.ie/Website/AMSREG/AMSRegWeb.nsf/AppSelect?OpenForm
- Use sequenced ID
public class Codec {
String chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
String prefix = "https://www.amz/";
HashMap<String, String> map = new HashMap<>();
int count = 1;
private String genShortUrl() {https://leetcode.com/problems/max-area-of-island/ Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water.
Find the maximum area of an island in the given 2D array. (If there is no island, the maximum area is 0.)
Example 1:
[
[0,0,1,0,0,0,0,1,0,0,0,0,0],| <component name="ProjectCodeStyleConfiguration"> | |
| <code_scheme name="Project" version="173"> | |
| <JetCodeStyleSettings> | |
| <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> | |
| </JetCodeStyleSettings> | |
| <codeStyleSettings language="kotlin"> | |
| <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> | |
| </codeStyleSettings> | |
| </code_scheme> | |
| </component> |
| #!/usr/bin/env bash | |
| # prepare_env.sh — Prepare prerequisites for your init.sh on Amazon Linux 2023 | |
| # Works for: al2023-ami-2023.8.20250808.1-kernel-6.1-x86_64 | |
| set -euo pipefail | |
| log(){ echo -e "[$(date +'%F %T')] $*"; } | |
| log "[0] 清理可能干扰的第三方 Docker 仓库(如果有)..." | |
| sudo rm -f /etc/yum.repos.d/docker-ce.repo || true |


