Javaで文字列連結を + 演算子で書いて、上司やレビュアーに指摘された経験はありませんか? 私は最初の現場で「ループ内で + 連結してるけど、ここは改善したほうがいい」と言われてから、基本は StringBuilder(必要なら StringBuffer)を使うようになりました。
Stringクラスは固定文字列を、StringBufferクラスは可変文字列を実装するクラスですが、簡単な文字列の操作では、どちらを使っても同様の結果を得られます。しかし、Javaでは文字列リテラルはStringクラスのオブジェクトとして扱われますので、特に必要が ...
アクセスログを記録する―FileWriter/BufferedWriter・StringBuffer・Calendar/Date/SimpleDateFormatクラス― テキストファイルは ...
Though Java already has a character type and char keyword to represent and manipulate characters, the language also requires a Character class for two reasons: Character c1 = new Character ('A'); ...
If you concatenate strings inside a loop, this creates many short-lived string objects on the heap, polluting memory and triggering garbage collection. To solve this, Java provides StringBuffer and ...
※この記事の対象:2026年9月6日の3級、2027年1月17日の2級・3級 Javaプログラミング能力認定試験の勉強を一通り終えても、StringとStringBuffer、オーバーライドとオーバーロード、throwとthrowsなど、似た用語が並ぶところで「どっちだったっけ?」と迷うことは ...
Strings are often used to hold sensitive data such as database URLs, usernames, passwords, and file paths. If strings were mutable, an attacker could change the content of these strings and ...
一部の結果でアクセス不可の可能性があるため、非表示になっています。
アクセス不可の結果を表示する