public class variables versus methods
Hi,
I have written a class that takes the 'nth root' of a java BigDecimal, but I am wondering how to structure it.
I need to provide access to a number of the class variables. Obviously, the root itself, and also the 'number of iterations' performed by the root finding algorithm, are 'returned'.
The way i've usually done this, is by declaring the class variables in question as public variables. However, I have come across an algorithm that performs square roots, and it returns a number of variables, but it uses methods to do so.
What is the better way of doing this?? Is the method route preferable over declaring class variables as public?