+ 2

I want some help to implement this code more in Kotlin style rather than Java Style.

This my code Sum as cubes which displays a number as a sum of cubes. I initially wrote this code in Java but I now want to write this code in Kotlin as well using its features to make it more compact. I implementing a few of its features but still it looks more like a Java Style. Here's my Kotlin code : https://code.sololearn.com/cwD8nFwR4n9H/?ref=app My original Java code : https://code.sololearn.com/c9ebQ0NVmSVl/?ref=app Suggest me changes.

7th Jun 2020, 1:14 PM
Siddharth Golecha
Siddharth Golecha - avatar
1 Respuesta
+ 1
Actually your Java is more Kotlin like as you did not make use of classes, which is the key part of the language. Only main needs to be static for this code. The bulk of your code should be instance based OOP to be Java like.
10th Jun 2020, 7:42 PM
John Wells
John Wells - avatar