In JAVA CompletableFuture is a class which contains a static method named supplyAsync() I can call this static method using CompletableFuture.supplyAsync() pattern but I am unable to call the static method on object of the same class CompletableFuture.
Example:
CompletableFuture c = new CompletableFuture();
c.supplyAsync() //->doesnt work cant recognize the method supplyAsync!
My doubt is why cant we call static method on object of the same class?
I was expecting the supplyAsync method to be called on object of class CompletableFuture.
It's wrong. You can call static methods on objects like this,
But you shouldn't do this. Static methods are class-level methods, they should not be called on an object.