-1
public class MainViewModel extends ViewModel {

    ...

    private class Repository {

        ...

    }

}

enter image description here

I created an instance from the Repository class inside the MainViewModel class but I don't know why IDE tells me to make the Repository class static.

Wei291
  • 15
  • 8
  • A `static` inner class has less quirks than a regular inner class. See https://stackoverflow.com/questions/70324/java-inner-class-and-static-nested-class for details – byxor May 18 '22 at 10:44
  • 2
    Why did you make Repository an inner class in the first place? Static inner classes are functionally the same as classes declared in their own file, which is what you usually do in java with each class. Are you aware what an inner class is and what there purpose is? – OH GOD SPIDERS May 18 '22 at 10:44

0 Answers0