In java, we can declare a null class object like this
VideoRecord videoRecord;
After that, we can check if it is null or not
if (videoRecord == null){
videoRecord = new VideoRecord();
}
I am new to Kotlin and I would like to do the same thing in Kotlin. I have tried this code below.
lateinit var videoRecord1:VideoRecord
if (videoRecord1 == null){
videoRecord1 = VideoRecord()
}
But it gives me a warning like the condition videoRecord1 == null is always false. How can I make the same thing in Kotlin?