DEV Community

Cover image for Java 的常數
Leon
Leon

Posted on • Originally published at editor.leonh.space

Java 的常數

很簡單,在宣告前加個 final 關鍵字就是常數,如同多數程式語言,常數的命名習慣上全大寫。

final int MY_ANGEL = 689;
Enter fullscreen mode Exit fullscreen mode

常數建立後是不能修改的,編譯時會檢查。

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay