I am trying to understand how Observables are executed but can't seem to get this simple code to work.
public class RxJavaExample {
public static void main(String[] args) {
Observable<String> hello = Observable.fromCallable(() ->
getHello()).subscribeOn(Schedulers.newThread());
hello.subscribe();
System.out.println("End of main!");
}
public static String getHello() {
System.out.println("Hello called in " +
Thread.currentThread().getName());
return "Hello";
}
}
Shouldn't hello.subscribe()
execute getHello()
?