How can i pass two integers to the secondary constructor
class Test(var name:String){
constructor(age:Int,data:Int):this(data){
println("$age $data")
}
fun display(){
println("hello world $name")
}
}
fun main(args: Array<String>) {
var t=Test("john")
var t1=Test(10,25)
t.display()
}
but it gave me the error
Simplest version.kt
Error:(8, 39) Type mismatch: inferred type is Int but String was expected
Warning:(17, 8) Variable 't1' is never used
But after some googling i solved this problem by making one of the parameter as String type. But want to pass those parameters as integer type .How can i achieve that?