I have a problem understanding access modifiers in Java.   public: can be used anywhere. private: can only be used inside the same class. protected: can only be used in subclasses.   I saw many examples and tried but I couldn't understand. I know only the definition. Please any one help me one this give me more examples.  What kind of programs would use private?  What kind of programs would use protected?  What kind of programs would use public?
In Java, are there clear rules on when to use each of access modifiers, namely the default (package private), public, protected and private, while making class and interface and dealing with inheritance?
When I create a UV sphere and add the subdivision surface modifier, the following wrinkle appears.    How can I avoid it?  I've read the article  but there seems to be no clear solution.  UPDATE 1  I've used the word 'apply' in the first sentence of the initial version of this question. It's misleading since I want to preserve the modifier without 'applying' it. Rather, what I meant is 'adding' the modifier.  UPDATE 2  I followed josh sanfelici's solution, but still there is an artifact at the pole.  Here is the screen: (A rendered view with a sun lamp)    Maybe it's the limitation of the general-purpose subdivision modifier.  BTW, when the cast modifier is added after the subdivision modifier, the sphere becomes perfect (even for my original wrinkled sphere).  But since I want to edit the resulting sphere (for example, scaling X, Y, etc) while modifier is added but not applied, it's not usable. How to initialize all members of an array to the same value? I have a large array in C (not C++ if that makes a difference). I want to initialize all members of the same value.  I could swear I once knew a simple way to do this. I could use memset() in my case, but isn't there a way to do this that is built right into the C syntax? Mclaurins with $e^{\sin(x)}$ To evaluate $e^{\sin(x)}$ I use the standard series $e^t$ and $\sin(t)$, combining them gives me:  $e^t = 1+t+\dfrac{t^2}{2!}+\dfrac{t^3}{3!}+\dfrac{t^4}{4!}+O(t^5)$  $\sin(t) = t-\dfrac{t^3}{3!}+O(t^5)$  $\therefore e^{\sin(x)} = 1+\sin(x)+\dfrac{\sin^2(x)}{2!}+\cdots+O(x^5)$  $\iff e^{\sin(x)}=1+\left(x-\dfrac{x^3}{6}\right)+\dfrac{\left(x-\frac{x^3}{6}\right)^2}{2}+\dfrac{x^3}{6}+O(x^5) = 1+x +\dfrac{x^2}{2}-\dfrac{x^4}{6} + O(x^5)$  In the last step, I only evaluate up to $\sin^3x$ term, everything above has a grade equal to or greater than $x^5$  However, I'm wrong. According to Wolfram, the series expansion for $e^{\sin x} = 1+x+\dfrac{x^2}{2}-\dfrac{x^4}{8}+O(x^5)$.  What did I do wrong? I can't seem to find what or where. Consider:  List&lt;String&gt; someList = new ArrayList&lt;String&gt;(); // add "monkey", "donkey", "skeleton key" to someList     for (String item : someList) {     System.out.println(item); }   What would the equivalent for loop look like without using the for each syntax? Given the following class  public class Foo {     public int FooId { get; set; }     public string FooName { get; set; }      public override bool Equals(object obj)     {         Foo fooItem = obj as Foo;          if (fooItem == null)          {            return false;         }          return fooItem.FooId == this.FooId;     }      public override int GetHashCode()     {         // Which is preferred?          return base.GetHashCode();          //return this.FooId.GetHashCode();     } }   I have overridden the Equals method because Foo represent a row for the Foos table.  Which is the preferred method for overriding the GetHashCode?  Why is it important to override GetHashCode? Correlated joint normal distribution: calculating a probability Given   $$ f_{XY}(x,y) = \frac{1}{2\pi \sqrt{1-\rho^2}} \exp \left( -\frac{x^2 +y^2 - 2\rho xy}{2(1-\rho^2)} \right) $$  $Y = Z\sqrt{1-\rho^2} + \rho X$  And   $$ f_{XZ}(x,z) = \frac{1}{2\pi } \exp \left( -\frac{x^2 +z^2}{2} \right) $$  Show that $P(X&gt;0,Y&gt;0)= \frac{1}{4}+\frac{1}{2\pi}(\arcsin \rho) $  I'm supposed to use the fact that X and Z are independent standard normal random variables, but I don't quite understand how. Any help would be greatly appreciated. Is there a modal command for MakeLowercase? Analog to  question I've been wondering WHAT is to \lowercase as \bfseries is to \textbf? (... and for uppercase, or \MakeLowercase and MakeUppercase, etc., which also seem to be text-block commands as explained .)  Is there a "switch"/"declaration"/"modal command" (what is the correct term here?, is there a difference between them?) that would allow one to turn something into lowercase/uppercase in the same way that one would use \scshape for example, i.e., not as text-block command with the curly braces?  Or how to create such a command?  I couldn't find any clue on the forum. Tangent and Normal lines that pass through the origin Let $\alpha$ be a regular curve in $\mathbb{R}^2$ and let all of its tangent lines pass through the origin. Also, let $\beta$ be a regular curve in $\mathbb{R}^2$ and let all of its normal lines pass through the origin.   How can I show that $\alpha$ is contained in a straight line through the origin and that $\beta$ is contained in a circle around the origin?  I know that the tangent line $\alpha(t)$ is the line that points in the direction of the tangent vector $T(t)$ and that the normal line of $\beta(t)$ is the line that points in the direction of $N(t)$, but how can I put this all together to complete the proof? Transfer from JFK Terminal 2 to Terminal 4 I have family who does not speak English.  They are changing planes in JFK Airport and will most likely be transferring from Terminal 2 (Delta) to Terminal 4 (China Southern Airlines).  At first I thought that directing them to use the Airtrain would be best.  However, in doing more reading my understanding is that the Airtrain would mean they would need to go through security again.  I found this on Delta's site:   If they use the JITNEY Shuttle to change from Terminal 2 to Terminal 4, does that mean they would not need to re-clear Security?  Edit: They are flying TO China. They are going from Tampa -> NY JFK -> China. When should I use # and = in ASP.NET controls? What term refers to those who adhere to scientism? Find the sum of the series $\sum \frac{1}{n(n+1)(n+2)}$ How can I remove these apps from my device? How to elegantly ignore some return values of a MATLAB function Combinatorial argument for the identity $k\binom{n}{k} = n\binom{n-1}{k-1}$ I am looking for the combinatorial argument for the identity:  \begin{equation} k\binom{n}{k} = n\binom{n-1}{k-1} \end{equation}  This is easy to show algebraically as:  \begin{equation} \binom{n}{k} = \dfrac{n(n-1)(n-2)(n-k+1)}{k(k-1)!} \end{equation}   What is the combinatorial argument? What are some general ideas to get started?   Here is a clarification of 2. From what I have seen so far, proving (combinatorially) an identity with an addition sign usually implies that we need to partition a set (this makes sense because of the addition rule and provides a nice visual). On the contrary, the previous observation leads me to believe that multiplication in identities can be resolved with the multiplication principle, but what is the "visual/interpretation" for this? Could someone provide such an interpretation for the example identity given above? Sadly, yesterday I've spilled some water on my MacBook Pro (El Capitan). Before you yell at me - it was closed, turned off and it wasn't a lot of water, the laptop was wet only on the top and under - not inside.  Today I've turned him on. At first battery wasn't recharging for some reason, but SMC reset fixed the problem.  At the first booting speaker was like talking to me, hard to explain but it was weird. Also only right speaker was "talking", despite the fact that only left side of the laptop was watered. Then there was no sound at all, not from the speakers, nor from the headphones. Also microphone's not working. USB ports are okay. The water was spilled from the left side of the laptop. I know this is hardware issue, and something's broken, but I want to be 100% sure. No it's not muted. I've also tried NVRAM reset a few times, but it doesn't fix the problem :(  There might be one factor, before spilling, my laptop "died" for the first time (battery energy ran off), but I doubt it's the case. (but hey, every info matters, right?)  It wouldn't be weird for me, if only left speaker wouldn't work, but built-in microphone not working is kinda weird in this case, isn't it?  I just want to ask you guys, what else can I check, before I'll be 100% sure it's dead inside?  I've plugged in external microphone - it's not working too. This is problem 31b) from Dummit and Foote chapter 14.2. I am looking for a hint on how to attack the problem, since I have been thinking about it for a couple of hours but I don't even know where to start. The problem says:  Let $K$ be a finite extension of $F$ of degree $n$. Let $\alpha$ be an element of $K$. Prove that the minimal polynomial for $\alpha$ over $F$ is the same as the minimal polynomial for the linear transformation $T_{\alpha}$. In this problem, $T_{\alpha}$ is an $F$-linear transformation of $K$ that arises from $\alpha$ acting by left multiplication on $K$.  I appreciate any helpful suggestions on how to start attacking the problem or any possible hint. Thanks! What are a few examples of noncyclic finite groups? I just want to make sure that every group $\mathbb{Z}_n$ for any $n$ is cyclic. Further, every group of prime order is cyclic because it is isomorphic to $\mathbb{Z}_p$. I think I have a handle on that, but what other finite groups are there that aren't cyclic? In particular, I'm looking for examples that aren't direct products of groups, just simply groups like $\mathbb{Z}_n$, not $\mathbb{Z}_a \times \mathbb{Z}_b$, etc. Dense sets in Hilbert space of square summable sequences? Let $l^2 = \{x = (x_n)| x_n \in \mathbb{R}, \sum_{n=1}^{\infty} x_n^2 &lt; \infty\}$  be the Hilbert space of square summable sequences and let $e_k$ denote the $k^{th}$ co-ordinate vector (with $1$ in $k^{th}$ place, $0$ elsewhere). Which of the following subspaces is NOT dense in $l^2$?   span$\{e_1-e_2, e_2-e_3, \ldots\}$ span$\{2e_1-e_2, 2e_2-e_3, \ldots\}$ span$\{e_1-2e_2, e_2-2e_3, \ldots\}$  span$\{e_2, e_3, \ldots\}$   By definition, we have to prove that for any $x \in l^2$ and for any $\epsilon &gt; 0$, there exists $y$ in the respective sets such that $\|x-y\| &lt; \epsilon$. How to proceed further? Initialization of an ArrayList in one line