
I generally prefer private static class, except when i cant use it like in the previous case, cause intellij will give warnings otherwise. / An object of class StatCalc can be used to compute several simple statistics. Moreover, if you want to access from inside B a non-static field of A, then you can't have B as private static class. Cannot retrieve contributors at this time 78 lines (69 sloc) 2. He was talking about visibility and not to be taken too literally. java/hws/javanotes7.0.1-exercise-solutions/chapter6/StatCalc.java Go to file Go to fileT Go to lineL Copy path Copy This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. In case of static fields/methods you need to use a private static class. Unfortunately ThreadGroup is broken in so many ways. Now, from inside class A, for non-static fields/methods you can always refer to class B, either by saying new A.B() or just new B() and it doesnt matter (no compilation/runtime errors) if B is private class or private static class. The applet will have an instance variable of type StatCalc that does the computations. But in case of private classes B within class A, you dont have this issue, cause B is not accessible outside A anyway. Exercise 7.1: Exercise 5.2 involved a class, StatCalc.java, that could compute some statistics of a set of numbers.Write an applet that uses the StatCalc class to compute and display statistics of numbers entered by the user. inner class -> An inner class is a non-static nested class.Īs the accepted response says, static vs non-static nested classes differ on the way and possibility to access methods/fields outside the outer class.Sample Size and Power calculations include Population Survey, Cohort or Cross-Sectional, and Unmatched Case-Control. The summary data do not need to be contained in an Epi Info 7 project or entered in any other tool.


static nested class -> Nested classes that are declared static are called static nested classes StatCalc is a statistical calculator that produces summary epidemiologic information.Nested class -> a class within another class.All the responses are generally about inner classes, that are not 100% applied to that question.

If i understand correctly, the question is for private class vs private static class.
