エントリーの編集
エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
ClassCastException対策(Javaマスター)
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
ClassCastException対策(Javaマスター)
まずはもっとも基本的なパターンです。 Personクラスと、それを継承したStudentクラスを、相互にキャス... まずはもっとも基本的なパターンです。 Personクラスと、それを継承したStudentクラスを、相互にキャストする実験です。 package samples.exception.cls; class Person { } class Student extends Person { } public class ClassCastExceptionTest { public static void main(String[] args) { try { Person p1 = new Student(); Student s1 = (Student)p1; Person p2 = new Person(); Student s2 = (Student)p2; } catch (Exception e) { e.printStackTrace(); } } } C:\JavaMaster\

