Skip to content

Commit f795d2b

Browse files
committed
Fix errors in Interoperability.md
Fixes #246
1 parent 34a6223 commit f795d2b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/user/Interoperability.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ Finally, to interoperate with Java (only when running on the JVM), you can use t
137137
```python
138138
import java
139139
BigInteger = java.type("java.math.BigInteger")
140-
myBigInt = BigInteger(42)
141-
myBigInt.shiftLeft(128)
140+
myBigInt = BigInteger.valueOf(42)
142141
# public Java methods can just be called
143-
myBigInt["not"]()
144-
# Java method names that are keywords in Python can be accessed using "[]"
142+
myBigInt.shiftLeft(128)
143+
# Java method names that are keywords in Python can be accessed using `getattr`
144+
getattr(myBigInt, "not")()
145145
byteArray = myBigInt.toByteArray()
146146
# Java arrays can act like Python lists
147147
print(list(byteArray))

0 commit comments

Comments
 (0)