Question: I have a multi-line ASCII string coming from some (Windows/UNIX/...) system. Now, I know about differences in newline character in Windows and UNIX (CR-LF / LF) and I want to parse this string on both (CR and LF) characters to detect which newline character(s) is used in this string, so I need to know what "\n" in VS6 C++ means.

My question is if I write a peace of code in Visual Studio 6 for Windows:

```
bool FindNewline (string & inputString) {
    size_t found;
    found = inputString.find ("\n");
    return (found != string::npos ? true : false);
}

```

does this searches for CR+LF or only LF? Should I put "\r\n" or compiler interprets "\n" like CR+LF?

Answer: 
Just say no to mutable static, m'kay.

It's atrocious design. The usual quoted consequence is that testability fails. It will be difficult to reproduce without reloading the class. Bad design is also bad for many other reasons. Just to mention one, classes should, by default, be thread-agnostic. Add a mutable static and you are thread-hostile - a bad place to be.

Creating a new instance every time seems wasteful. Although, of course, don't optimise prematurely (if you were optimising, you wouldn't be using `java.util.Random`). The initial see incrementing might also cause issues.

The best approach is to pass in an instance ("Parameterise from Above" or "using constructors correctly"). Then you can test, reproduce, mock, etc. You are efficient and can flip in a different implementation.
Use a static variable when the instance isn't expected to change or when you want to share it between instances.

```
private final static int SOME_CONSTANT=1;

```

is an example.

```
public class USA {
    private final static Map statesOfTheUnion = new HashMap();
    // etc
}

```

could be another. In the latter case, we don't expect that the states will change from instance to instance. Thus is makes no sense for each instance to have its own copy.