Without keyword

Report a typo

Complete the code so that the Person class can be created in two ways:

new Person("Alice",20) // Person(Alice,20)

Person("Alice",20) // Person(Alice,20)

Sample Input 1:

new Person("Alice",20)
Person("Alice",20)

Sample Output 1:

Person(Alice,20)
Person(Alice,20)
Write a program in Scala
class Person(val name: String, val age: Int)

???
___

Create a free account to access the full topic