-1

Is it possible to use a Java API in Kotlin. For example I want to use a Barcode Scanner API, which ist written in Java, in my Kotlin code. So how can I use the constructor? In Java it is new BarcodeScanner() how can I do this in Kotlin

2
  • 1
    Of course you can. Or simply, instead of new keyword which mentioned by another user, write your codes in Java class language (if you're beginner in Kotlin) then use Code -> Convert java file to Kotlin file and it will convert it to Kotlin which is a good place to start Kotlin and learning how it can be changed from java to kotlin. Commented Aug 18, 2018 at 12:13
  • 1
    This might be of some help. Commented Aug 18, 2018 at 12:14

1 Answer 1

1

Almost the same just without the new keyword.

val scanner = BarcodeScanner()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.