Skip to content

Commit c70d7aa

Browse files
committed
Interoperability
1 parent 9384d06 commit c70d7aa

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/MyJavaFile.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
3+
/*
4+
* Interoperability Example
5+
* */
6+
public class MyJavaFile {
7+
8+
public static void main(String[] args) {
9+
10+
int sum = MyKotlinInteroperabilityKt.addNumbers(3, 4);
11+
System.out.println("Printing sum from Java file :" + sum);
12+
}
13+
14+
public static int getArea(int l, int b) {
15+
return l * b;
16+
}
17+
}

src/myKotlinInteroperability.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
3+
/*
4+
* Interoperability Example
5+
* */
6+
fun main(args: Array<String>) {
7+
8+
var area = MyJavaFile.getArea(10, 5)
9+
println("Printing area from Kotlin file: $area")
10+
}
11+
12+
fun addNumbers(a: Int, b: Int): Int {
13+
return a + b
14+
}

0 commit comments

Comments
 (0)