Term:side-effect

From Juneday education
Jump to: navigation, search

When calling a method changes the state of the object. Also used when calling a method has an effect on the world outside of the JVM, such as logging or printing to standard out.

A side-effect-free method is more "pure" like a mathematical function. Side-effect-free methods instead just produce a value based on its input parameters, like calling Math.sqrt(9.0) (produces 3.0, the square root of 9).