Xóa bài viết
Bạn có chắc chắn muốn xóa bài viết này không ?
Xóa bình luận
Bạn có chắc chắn muốn xóa bình luận này không ?
Kotlin – Java Static Method equivalent in Kotlin
https://grokonez.com/kotlin/kotlin-java-static-method-equivalent-kotlin
Kotlin – Java Static Method equivalent in Kotlin
This tutorial shows you a way to represent Java static method in Kotlin using Object Expression.
I. Technology
- Java 1.8
-
Kotlin 1.1.2
II. Practice
1. Java static Classes and Methods
public class Foo { public static String exe() { return "grokonez.com"; } public static String upperCase(String s) { return s.toUpperCase(); } public static class Bar { public static String bar() { return "Bar"; } } public static class Num { public static Integer doubleInt(Integer i) { return new Integer(i.intValue() * 2); } } }
2. Equivalent in Kotlin
Using Kotlin Object Expression, we can make "static" Equivalent:
More at:
https://grokonez.com/kotlin/kotlin-java-static-method-equivalent-kotlin
Bình luận

{{ comment.user.name }}
Bỏ hay
Hay

Cùng một tác giả

1
0
Tutorial Link: (Link) (Ảnh) Django is a Pythonbased free and opensource web framework that follows the modeltemplateview architectural pattern. A...

1
0
https://loizenai.com/angular11nodejspostgresqlcrudexample/ Angular 11 Node.js PostgreSQL Crud Example (Ảnh) Tutorial: “Angular 11 Node.js Postg...

1
0
Angular Spring Boot jwt Authentication Example Github https://loizenai.com/angularspringbootjwt/ (Ảnh) Tutorial: ” Angular Spring Boot jwt Authe...
Bài viết liên quan

0
0
https://grokonez.com/kotlin/kotlinreadwritecsvfileexample How to read/write CSV file in Kotlin In this tutorial, we're gonna look at examples tha...

0
0
Kotlin Spring Boot + Angular 6 CRUD HttpClient + MySQL example | Spring Data JPA + REST APIs example
https://grokonez.com/frontend/angular/angular6/kotlinspringbootangular6crudhttpclientmysqlexamplespringdatajparestapisexample Kotlin Spring Boot +...