Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit adda044

Browse files
author
haohao
authored
Update README.md
1 parent 4f5fd93 commit adda044

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

‎README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,57 @@ MyClass().foo(0)
711711
// member
712712
// extension
713713

714+
```
715+
---
716+
### Kotlin Call Java
717+
**Java**
718+
```java
719+
public class Person {
720+
private String name = null;
721+
private int age = 0;
722+
723+
public Person(String name, int age) {
724+
this.name = name;
725+
this.age = age;
726+
}
727+
728+
public Person() {
729+
}
730+
731+
public String getName() {
732+
return name;
733+
}
734+
735+
public int getAge() {
736+
return age;
737+
}
738+
739+
public void setName(String name) {
740+
this.name = name;
741+
}
742+
743+
public void setAge(int age) {
744+
this.age = age;
745+
}
746+
747+
@Override
748+
public String toString() {
749+
return "name : " + name + ", age : " + age;
750+
}
751+
}
752+
753+
```
754+
**Kotlin**
755+
756+
```kotlin
757+
var p = Person()
758+
p.name = "haohao"
759+
p.age = 25
760+
761+
println(p.toString())
762+
763+
// name : haohao, age : 25
764+
714765
```
715766
---
716767
## 持续更新中。。。

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /