Get the App
SLTechnology News&Howtos  ›  Development  › 

How to implement POJO class with Kotlin

Shulou Source: shulou.com Published: 2022-06-01 04:24:21 09月25日 Update

This article will explain in detail how to use Kotlin to achieve POJO class, the editor thinks it is very practical, so share it for you to do a reference, I hope you can get something after reading this article.

Using Kotlin to implement POJO Class

In Java

Public class User {private String firstName; private String lastName; public String getFirstName () {return firstName;} public void setFirstName (String firstName) {this.firstName = firstName;} public String getLastName () {return lastName;} public void setLastName (String lastName) {this.lastName = lastName;}}

In Kotlin, it can be simplified to:

Class User {var firstName: String? = null var lastName: String? = null} this is the end of the article on "how to implement POJO classes with Kotlin". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: Articles more good practical content articles knowledge reference help related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple macOS NVidia OPPO Reno vpn