Question: I want to ask question connected with synchronization in Java and to clarify my doubts I wrote simple code as follows:

```
class A {
 public int variable;
 public int secondVariable;
 public Object variableLock = new Object();
 public Object secondVariableLock = new Object();

 public void doingSthWithVariable() {
  synchronized (variableLock) {
  .... } } 

 public void doingSthWithVariableInOtherMethod() {
  synchronized (variableLock) {
  .... } }

 public void doingSthWithSecondVariable() {
  synchronized (secondVariableLock) {
  .... } }

 public void doingSthWithSecondVariableInOtherMethod() {
  synchronized (secondVariableLock) {
  .... } }

}

class B {
 public A instanceOfA;

 public void doingSthWithAVariables() {
  synchronized (instanceofA.variableLock) {
    synchronized (instanceofA.secondVariableLock) {
      ....} } }
 }

```

My question is: if it's safe and is it a good practice to use variableLock/secondVariableLock from class A in class B? 
I mean, I need to block any change of these two variables in instance of class B and I'm wondering if it's a good way to do it. 
And another question: what if I have the same instanceOfA in more than one B objects? 

It seems to me like answer is yes (it's not unsafe), but I just want to ensure and ask about better ways to do it.

Answer: 
Overwhelmingly likely answer: use `putChar` (or, for longer outputs, its big brothers `putStr` and `putStrLn`) instead of `print`.
You can simply define

```
showNoQuotes :: Show a => a -> [Char]
showNoQuotes x = [c | c <- show x, c /= '\'']

```

Try it:

```
> putStrLn $ showNoQuotes '%'
%

```