Reputation: 4963
I wanted to know the underlying java class for this
val x: Array<Int> = arrayOf(1, 2, 3, 4, 5)
val y: List<Int> = listOf(1, 2, 3, 4, 5)
println(x.javaClass)
println(y.javaClass)
The output is
class [Ljava.lang.Integer;
class java.util.Arrays$ArrayList
Can someone point out what is [Ljava.lang.Integer
Am i missing something?
Upvotes: 1
Views: 48
Reputation: 821
It's a valid string representation of the type of Integer[]
. You are actually calling implicit toString()
by println()
, which calls getName()
. You can find the documentation of this naming scheme here:
https://docs.oracle.com/javase/6/docs/api/java/lang/Class.html#getName()
Upvotes: 3