I have FooClass with barMethod() that returns "bazz" string. How to print in console barMethod
along with bazz
?
For example:
public class FooClass {
String barMethod() {
return "baz";
}
}
System.out.println(FooClass.barMethod()) //Prints "baz"
How can I print the following?
customPrint(FooClass.barMethod()) //barMethod = baz
Note: I can't modify barMethod() or FooClass.
Found How to get a string name of method in java on stack overflow but it isn't what I'm looking for.