Using a static inner class I have a question about use of static inner class in the following code, adapted from Eckel's Thinking in Java 4th edition (page 625).  The code uses a static inner class called Node.  When you create a Stack structure, you can then push the nodes onto the stack and pop them off - so far so good.  But I'm confused about why the node class is static?  Wouldn't that mean that there would be only one Node created in the LinkedStack class?  How / why is it that in fact you can push many different nodes onto the stack, and then pop them off (which of course is what the stack is supposed to do).  In fact, you can change private static class Node to 'private class Node` and it also works ... so why did Eckels choose static class Node?  In this example, the input is the three words "Phasers", "on", "stun!" and output is "stun!", "on", "Phasers".  public class LinkedStack&lt;T&gt; {      //generic inner class node     private static class Node&lt;U&gt; {          U item;         Node&lt;U&gt; next;         Node() {             item = null;             next = null;         }         Node(U item, Node&lt;U&gt; next) {             this.item = item;             this.next = next;         }         boolean isDummyNode() {             return item == null &amp;&amp; next == null;         }     }      //initialize top of stack as a dummy first node     private Node&lt;T&gt; top = new Node&lt;T&gt;();      public void push(T item) {         top = new Node&lt;T&gt;(item, top);     }      public T pop() {         T result = top.item;         if(!top.isDummyNode())             top = top.next;         return result;     }      public static void main(String[] args) {         LinkedStack&lt;String&gt; stack = new LinkedStack&lt;String&gt;();         for(String s : "Phasers on stun!".split(" "))             stack.push(s);         String s;         while((s = stack.pop()) != null)             System.out.println(s);     }  }
Java inner class and static nested class What is the main difference between an inner class and a static nested class in Java? Does design / implementation play a role in choosing one of these?
Is there an easy way to convert a number to a word in PHP? What are some practical examples of a constant current source? Please don't state the obvious that nothing is a perfect constant current source.  And please do not give examples of how to create them from components.  I looked at this  which stated the obvious - that you can not have a perfect current source.  So when I say constant current source, I am not referring to the mathematical concept used in circuits, but "natural" components that provide a close approximation to this. Key word is approximation.  A bit of research pulled up one interesting example which was a solar cell.  Is this a valid example?  A google search pulls up a similar Quora question . Which gave the example of a solar cell.  This is a more technical site and I was looking for a more engineering answer not a mathematical or laymen's answer.  Thanks. 90s (or early 2000s) scifi (mini)series where a boy and old man chase a black guy in metal suit My ListView (of my ViewFilipper) fills the parent and buttons on the bottom get hidden How do you performance test JavaScript code? CPU Cycles, Memory Usage, Execution Time, etc.?  Added: Is there a quantitative way of testing performance in JavaScript besides just perception of how fast the code runs? Both are in the present perfect, but one uses the verb 'to go' and the other 'to be'. Is there a rule for this?  Is there any chance that the differences between "I have been" vs. "I have gone", are differences in English dialect (I don't know if this is the right word).  Edit Could I say that North American English speakers use "I have gone", and maybe U.K speakers say "I've been"? Or vice versa. Show that the set of functions $\mathbb{N}\to\{0,1\}$ is not countable Recall that a countable set $S$ implies that there exists a bijection $\mathbb{N}\to S$. Now, I consider (0,1). I want to prove by contradiction that $(0,1)$ is not countable.  First, I assume the contrary that there exists a bijection $f$, and I can find an element in $S$, but not in the range of $f$. But I can't find such element. How can you construct such $f$? When is 6 a square in Zp To find when $6$ is a square I divided $6$ in to $2$ and $3$ by The Legendre symbol.  $$\frac{6}{p} = \frac{2}{p} \times \frac{3}{p}$$  I know that we can multiply the cases of when $2$ and $$ are squares because then it is (1)(1) by Legendre.   $2$ is a square when $p \equiv 1 \pmod{8}$   $3$ is a square when $p \equiv 1 \pmod{12}$  so $6$ is a square when $p \equiv 1 \pmod {24}$ ($96$, but the $lcm(8,12)= 24$)   but how do I find the cases when $2$ and $3$ are both NOT squares? because then $6$ would be a square then as well, $(-1)(-1) = 1$ by Legendre. $\operatorname{Aut}(\mathbb Z_n)$ is isomorphic to $U_n$. I've tried, but I can't solve the question. Please help me prove that:  $\operatorname{Aut}(\mathbb Z_n)$ is isomorphic to  $U_n$. Which JDK version is compatible with Netbeans on Ubuntu? I'm trying to install Netbeans on my Ubuntu. It was successfully installed but was unable to create new projects or new files. I have installed JDK 12 and then I removed it because I found here a solution that recommended removal of latest versions of JDK and set JDK 8 as default. I did what solution said but now I can't install JDK 8. It is showing me this error message:   E: Package 'oracle-java8-installer' has no installation candidate    So I started searching on the Internet about the solution and I found that "Oracle Java (JDK) 8 Installer PPA (DISCONTINUED)".   What should I do now? Is it generally true that if $|P(A)|=|P(B)|$ then $|A|=|B|$?  Why? Thanks. Unsealed meat in freezer Below is my situation:  Is completely (vacuum) sealing leftover meat in the freezer absolutely necessary? I would always just use a plastic bag to cover the meat and fold it around couple of times so it's almost as good as sealed (usually grocery plastic bag is much bigger than the piece of meat) and have never had a problem with it last a decade or so I have been cooking.  But recently I got this new roommate who insists on me using special small plastic bags with sealers to use and he is being very paranoid, obsessive about it.  So my question is: Is he right? Can I fetch the value of a non-standard CSS property via Javascript? I am trying to read a custom (non-standard) CSS property, set in a stylesheet (not the inline style attribute) and get its value. Take this CSS for example:  #someElement {   foo: 'bar'; }   I have managed to get its value with the currentStyle property in IE7:  var element = document.getElementById('someElement'); var val = element.currentStyle.foo;   But currentStyle is MS-specific. So I tried getComputedStyle() in Firefox 3 and Safari 3:  var val = getComputedStyle(element,null).foo;   ...and it returns undefined. Does anyone know a cross-browser way of retreiving a custom CSS property value?  (As you might have noticed, this isn't valid CSS. But it should work as long as the value follows the correct syntax. A better property name would be "-myNameSpace-foo" or something.) How to loop over the lines of a file? I have noticed that I hardly ever use the \negthinspace command  \!.  This is because I don't know how to use it properly (I do use other spacing commands quite a bit, because I can better understand the guidelines of when they might be useful). When might it be considered appropriate to use this spacing command? Can screen layouts or workspaces be locked? I need to find out the modular inverse of 5(mod 11), I know the answer is 9 and got the following so far and don't understand how to than get the answer. I know how to get the answer for a larger one such as 27(mod 392) but am stuck because they are both low numbers.  11=5 (2)+1  5=1 (5) The Bash Manual says   { list; }        Placing a list of commands between curly braces causes the list to be executed in the current shell context. No subshell is   created. The semicolon (or newline) following list is required.      The braces are reserved words, so they must be separated from the list   by blanks or other shell metacharacters.       The parentheses are operators, and are recognized as separate tokens   by the shell even if they are not separated from the list by   whitespace.   If I remove the semicolon, like this:  $ { date } &gt;    Why does it expect stdin input? A metacharacter is a character that separates words.  The semicolon and whitespace are both "shell metacharacters". Why can't whitespace separate words date and }? Why do we need a semicolon instead of a whitespace for separating the words? I have a card that is 50% used with 7% interest. The max credit limit on the card is $10,000, and I used $5000. I have another card that is $14,000 and I have $2900 used, but the interest is 14.9%. I want to move the $2900 card to the other card that has a lower interest rate (7%). This will bring the balance close to the max, but the idea is to focus on this one card and bring the balance down as quickly as possible. is this a wise choice? I am looking to purchase a house in 6 months so I thought that this might be enough time to pay it off and keep my score up. My scores are currently in the low 700s. In Catan, can you continue a "circular" road? If I have 6 roads that go all around a single hex tile, they are a continuous uninterrupted road (assuming none of my opponents interrupts it with their settlements/cities). But, can I continue this 6-piece road and create a 7-piece continuous road by building a road that goes out of this hex tile? Here's an image of what I'm talking about:    Is this a valid 7-piece continuous road?