Joseph Michael wrote:In reactive programming we declare the unit of work and leave execution (i.e. concurrency) up to the runtime.
This is not limited to reactive programming. This is true for all asynchronous programming styles.
Does Java supports imperative and reactive programming? How?
Almost everything you do in Java is imperative. It provides asynchronous programming models with the Stream API. If you are wondering about reactive programming specifically, there are libraries for this, such as RxJava.
2. Can someone explain with an example of imperative and reactive programming with an example?
Imperative:
Reactive:
Asynchronous through Stream API:
3. Concurrency can be done via call back or futures. What is the difference between having a call back or using futures?
With callbacks you supply operations to perform next directly to the asynchronous operation. With futures, the asynchronous operation returns an object with which you can register operations to perform next.
Callback:
Future: