0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Java Silver3

Last updated at Posted at 2021-10-11

前回の続きです

今回はchapter3の演算子と分岐文です。

・値を代入する場合型変換は適用される(int型にcharを代入)

・キャストがないと代入できずコンパイルエラーになる

・「||」は1番目の式がtrueなら2番目の式は評価しない

・「&&」は1番目の式がtrueでも2番目の式を評価する

・「a++」はaに1を先に加算して代入する、「++a」はa先に代入して加算する

・switch文の式の結果はbyte,char,short,intおよびラッパークラス,enum,Stringの型(double、float、longは含まない)

・defaultがないとその後の処理も実行される

・1|2はビット演算子(二進数の合計3が返ってくる)

・equals()メソッドは同じ文字列かどうか比較する

・Stringクラスは読み取り専用クラスなのでオブジェクトが保持する文字列を書き換えることはない

・痴漢後の文字列を変数に再代入しているか確認する

・+演算子で文字列の連結は可能だが、-は不可能

・Stringクラスで生成した文字列は変わらないがStringBuilderクラスで生成した文字列は変更可能

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?