From 9e77242b6d0a5a794d77fdcba05d25824f60fa80 Mon Sep 17 00:00:00 2001 From: Joseph Olugbohunmi <37001871+mayorJAY@users.noreply.github.com> Date: Tue, 6 Dec 2022 22:21:35 +0100 Subject: [PATCH] Accessing Class members --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index db57b45..abe3600 100644 --- a/README.md +++ b/README.md @@ -931,6 +931,33 @@ public class User { --- +## Accessing Class members +> Java + +```java +Student student = new Student(); +student.setName("Smith"); +student.setCourse("Geology"); +student.setYear(2015); +student.setCode(200); +student.register(); + +``` + +> Kotlin + +```kotlin +Student().apply { + name = "Smith" + course = "Geology" + year = 2015 + code = 200 + register() +} +``` + +--- + ### Important things to know in Kotlin - [Mastering Kotlin Coroutines](https://amitshekhar.me/blog/kotlin-coroutines) - Mastering Kotlin Coroutines