Java uses only call by value while passing reference variables as well. It generates a copy of refer…