Is static inner class thread safe inside another java class?

Viewed 9519

For collection of smaller helper utility classes, I have created a general class MyUtils:

// MyUtils.java
public final class MyUtils
{
  public static class Helper1 {};
  public static class Helper2 {};
//...
}

This helper classes from inside MyUtils will be used in the other files of the package:

// MyClass1.java
public class MyClass1
{
  private MyUtils.Helper1 help1 = new MyUtils.Helper1();
  public void method ()
  {
    private MyUtils.Helper2 help2 = new MyUtils.Helper2();
  }
}

To let them accessible, I have made them static inside MyUtils (which doesn't have any data/function member of its own). My code is thread safe before creating MyUtils.

My worry is, by making these inner classes staticwill they remain thread safe, when their multiple instances will exist across the files ? Or is their any bad implication am I missing due to making them static ?

Edit: I am not touching any shared variable inside the helper classes. My only concern was that will the instance of the static classes be thread safe (since they are static).

5 Answers
Related