java - Is int[] an object? -
this question has answer here:
- is array object in java 8 answers
had look, , can't seem find question same this. question int[]
in java.
when create int[]
, use syntax:
int[] x = new int[5];
the methods part of int[]
make me think it's object
, doesn't follow java naming convention classes, what's confusing me. array of primitive type, can used primitive.
is int[]
(or primitive array guess) object, or primitive?
an array in java subclass of object
, therefore it's object type - if contains primitive types. can check this:
int[] x = new int[5]; if (x instanceof object) system.out.println("it's object!");
Comments
Post a Comment