1
0

More than 1 year has passed since last update.

xxx.getClass() と xxx.class

Posted at

いわゆる型。よくわからなくなってきたのでconsoleに出力して確認

sample.java
    public static void main(String[] args) {
        String s1 = new String("1");
        System.out.println(s1.getClass());
        System.out.println(String.class);
        System.out.println(s1 instanceof String);
    }

実行結果

class java.lang.String
class java.lang.String
true
1
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
1
0