What is the equivalent to Python\'s pass
in Java? I realize that I could use continue
or not complete the body of a statement to achieve that effec
I feel, there is no construct in Java identical to pass in Python. This is mostly because Java is a statically typed language where as Python is a dynamically typed language. More so when you are defining a method / function. In that context, the provided answers are valid / correct only for a method that returns void.
For example for a Python function
def function_returns_void:
pass
you can have a Java method
public void function_returns_void(){}
or
public void function_returns_void(){;}
but when a method is supposed to return a value, while pass may still work in Python, one will stuck with compilation problem when not returning a value.