Question: Strings are immutable, does it mean that i always have to do something like that with a string passed to a method?

```
str= str.toLowerCase();

```

or is 

```
str.toLowerCase();

```

fine? I tried the second one and it doesn't give me any errors, why?

Answer: 
Only the first will work; the `String.toLowerCase()` returns is a new string, it doesn't change anything in place.
A Java String is immutable, so

```
str.toLowerCase();

```

won't change anything in `str` but just return a new String with all characters of `str` converted to lower case. So if you want to use the lower case string of `str` you must code

```
String lower = str.toLowerCase(); 
System.out.println(str + " to lower case: " + lower);

```

If `str` is a method parameter rather than a local variable or field you should not use the following assignment even though it's valid:

```
public String toLowerCase(String str) {
  str = str.toLowerCase();
  return str;
}

```

This is considered a bad programming practice. Never assign a new value to a method parameter (there is enough memory on the call stack ;-).