Computer scienceProgramming languagesKotlinObject-oriented programmingObject-oriented programming basic

Visibility modifiers for members

Private constructor

Report a typo

Inside the Friend class, make the primary constructor private and then add a secondary constructor that allows us to provide a custom name when creating an instance of the Friend class.

Write a program in Kotlin
class Friend {
private var name: String = "Alex"
// write code here
}
___

Create a free account to access the full topic