I'm trying to create multiple instances of an object and store it in an array. However, the last instance of it overwrites the previous ones. Is their a way I can create each individual object?  I've tried creating an array and filling each individual object separately. I've also tried creating new instances of it.  class Card {  private static String name;   public Card(String name) {   this.name = name;  }   public String getName() {   return name;  } }  public class Main {  static Card[] deck = new Card[5];  public static void main(String args[]) {   deck[0] = new Card("Ace");   deck[1] = new Card("Club");    System.out.println(deck[0].getName());   System.out.println(deck[1].getName());  } }   The output of deck[0] should be "Ace" while deck[1] should be "Club".  What is outputting is "Club" twice. How can I fix this?
To be specific, I was trying this code:  package hello;  public class Hello {      Clock clock = new Clock();      public static void main(String args[]) {         clock.sayTime();     } }   But it gave the error      Cannot access non-static field in static method main   So I changed the declaration of clock to this:  static Clock clock = new Clock();   And it worked. What does it mean to put that keyword before the declaration? What exactly will it do and/or restrict in terms of what can be done to that object?
Why is the upper Riemann integral the infimum of all upper sums? I was reading the theory of Riemann integration when I cam across the following ,   If $f$ is bounded on $[a,b]$, and $P = \{x_0,x_1,x_2.......x_n\}$ is a partition of $[a,b]$, let $$M_j = \sup_{x_{j-1}\leq x\leq x_j}f(x)$$ The upper sum of f over P is $$S(P) = \sum_{j=1}^{n} M_j(x_j-x_{j-1})$$ and the upper integral of $f$ over $[a,b]$, denoted by $$\int_{a}^{b^-} f(x)dx$$ is the infimum of all upper sums.  The theorem similarly goes on to state the result for lower sums.  My doubt is : I do not understand how is $$\int_{a}^{b^-} f(x)dx$$ the infimum of all upper sums. I understand that if we refine the partition P, then the upper sum would decrease, so it may be a lower limit for all the upper sums computed on the refinements of P (but still being the lower limit does not prove that it is the infimum) and what about those partitions for which P itself is the refinement of?  How do I know that it will be a lower limit for those, let alone a infimum? I want to make a logistic model from my survey data. It is a small survey of four residential colonies in which only 154 respondents were interviewed. My dependent variable is "satisfactory transition to work". I found that, of the 154 respondents, 73 said that they have satisfactorily transitioned to work, while the rest did not. So the dependent variable is binary in nature and I decided to use logistic regression. I have seven independent variables (three continuous and four nominal). One guideline suggest that there should be 10 cases for each predictor / independent variable (Agresti, 2007). Based on this guideline I feel that it is OK to run logistic regression.    Am I right? If not please let me know how to decide the number of independent variables? Easy way to write contents of a Java InputStream to an OutputStream I was surprised to find today that I couldn't track down any simple way to write the contents of an InputStream to an OutputStream in Java. Obviously, the byte buffer code isn't difficult to write, but I suspect I'm just missing something which would make my life easier (and the code clearer).  So, given an InputStream in and an OutputStream out, is there a simpler way to write the following?  byte[] buffer = new byte[1024]; int len = in.read(buffer); while (len != -1) {     out.write(buffer, 0, len);     len = in.read(buffer); } I just ran the following command in a directory with several files, some owned by root, some by a normal user. I got a strange message:  $ sudo chmod -rwx * chmod: example-file: new permissions are ----w----, not ---------   Why the heck does chmod refuse to clear all permissions, if a file had group write rights? What is the thought behind this behaviour?  And is there a way to force removing all permissions in one step, without having to execute sudo chmod g-w * afterwards? Is it possible to have an object ignore a certain light source but still be affected by others? I want to create an effect on a character where their skin and clothing are effected by two different light sources. The clothing should only reflect a bright bounce light, but have the skin should not be affected by this light source.    In the example image I have two objects a cube, a sphere and three emission  lights . I want the two white lights to hit both objects, and I need the purple light to hit and reflect off of the sphere, but ignore the cube entirely (no reflections).  Someone suggested to composite the layers together, it works... but this is very impractical and cumbersome because it forces the background to be transparent and it will be a pain to try and layer together a more complex scene, especially if its animated which is what I want this effect for.  I know you can have objects ignore shadows and all kinds of other things so im hoping someone knows how to get an object to ignore light with a few settings. Could someone please explain the differences between the 3 fitting methods, method = c("CSS-ML", "ML", "CSS"), in Arima?  If I run the code below I get an error message, but if I specify method="ML" in Arima it runs fine.  So I was curious what the difference was between the 3 fitting methods.  Code with error:  library("fpp")  tsTrain &lt;- window(hsales,end=1989.99)  pvar&lt;-1:10 dvar&lt;-1:2 qvar&lt;-1:7  OrderGrid&lt;-expand.grid(pvar,dvar,qvar)  n &lt;- function(a,b,c) {Arima(tsTrain, order=c(a,b,c))} ModFit &lt;- do.call(Vectorize(n, SIMPLIFY=FALSE), unname(OrderGrid))   Fixed Code:  library("fpp")  tsTrain &lt;- window(hsales,end=1989.99)  pvar&lt;-1:10 dvar&lt;-1:2 qvar&lt;-1:7  OrderGrid&lt;-expand.grid(pvar,dvar,qvar)  n &lt;- function(a,b,c) {Arima(tsTrain, order=c(a,b,c),method="ML")} ModFit &lt;- do.call(Vectorize(n, SIMPLIFY=FALSE), unname(OrderGrid)) Is there a faster way to open a process as Administrator (With UAC enabled)? Currently (In Windows 10) - if I want to open a CMD prompt, I'll hit the Windows key, type CMD and hit Enter. If I want it open as an administrator, I have to right click the item and click Run As administrator. Is there a way I can do this without using the mouse? What is the usage of Zero Ohm & MiliOhm Resistor? I am new to PCB design and I noticed that some schematics use 0Ω or 100mΩ resistors. What is their purpose and why do we need to use them in our PCB design?  Normally if we wish to probe how much current the load is taking, we put a jumper pin across the PCB trace (then measure current across the pin using a multimeter). Adding resistors for this purpose seems like it would waste a lot of PCB real-estate. Is this the sole reason why 100mΩ resistors are being placed (since I = V/0.1Ω) instead of a jumper pin?   If so, is there any consideration we should take when placing such a mΩ resistor on board so it doesn't affect the signal or behaviour of the circuit? Conditional Linq Queries We're working on a Log Viewer. The use will have the option to filter by user, severity, etc. In the Sql days I'd add to the query string, but I want to do it with Linq. How can I conditionally add where-clauses? Prove or Disprove: If every nontrivial subgroup of a group $G$ is cyclic, then $G$ is cyclic. Prove or Disprove: If every nontrivial subgroup of a group $G$ is cyclic, then $G$ is cyclic.    This is a question from page $181$, Chapter $3.4$ Elements of Modern Algebra ($8^{th}$ Edition) by Linda Gilbert.  My intuition tells me that the given statement is false, however, I cannot seem to find a rigorous argument (or counterexample) to disprove the statement. Can anyone please point me in the right direction?  I know that if a group $G$ is cyclic, then every subgroup is cyclic. This is not an if and only if statement - hence my intuition telling me the above mentioned statement is false. Outcast boy meets girl underwater Noether's Theorem: Lie groups vs. Lie algebras; finite vs. infinitesimal symmetries I've had a brief look through similar threads on this topic to see if my question has already been answered, but I didn't find quite what I was looking for, perhaps it is because I'm finding it hard to put words on my question and I hope that you will be able to help me ask it clearly.  I'm trying to link what I know from mathematics to what we are writing in physics for Noether's theorem. If I understand correctly we are looking at the symmetries of the action i.e. under which symmetry groups is it invariant. Noether's theorem allows us to calculate a conserved current in the case of a continuous symmetry (Lie groups), by means of so-called infinitesimal symmetries which I believe to be elements of the Lie algebra (so the tangent space to the neutral element) of the Lie group.  I'm guessing that if the action is invariant under the symmetry then it's "variation" should be 0 when we vary the system (space-time coordinate, or field) using this symmetry; it is exactly this step that I would like to understand better, how can I formalize this step correctly mathematically? How should I understand this variation, and how does it's calculation give rise to the elements of the Lie algebra? Do you have any useful awk and grep scripts for parsing apache logs? I can use log analyzers, but often I need to parse recent web logs to see what's happening at the moment.   I sometimes do things like to figure out top 10 ips that request a certain file  cat foo.log | grep request_to_file_foo | awk '{print $1}' |  sort -n | uniq -c | sort -rn | head   What do you have in your toolbox? Google Maps Location History is showing an incorrect location Height and minimal number of generators of an ideal How can I determine the height and the least number of generators of the ideal $ I=(xz-y^2,x^3-yz,z^2-x^2y) \subset K[x,y,z] $?      I tried to calculate the dimension of the vector space $I/I\mathfrak m$ with $\mathfrak m=(x,y,z)$, but I'm not able to find it.  I think the height is $2$, because the affine variety should be a curve, and also I know that the ideal is prime, so I need a chain $0\subset \mathfrak p \subset I$. Maybe $(xz-y^2)?$ Is it prime? Intuitive idea of the Lipschitz function I'm trying to understand intuitively the notion of Lipschitz function.   I can't understand why bounded function doesn't imply Lipschitz function.   I need a counterexample or an intuitive idea to clarify my notion of Lipschitz function.  I need help  Thanks a lot Rounded corner shape with rounded sides Allow given application to run as administrator, without prompting user for credentials Recently I have updated my postgresql version. I have also upgraded pgAdmin from 3 to 4. But I was unable to load shapefile. I didn't find any plugin called shapefile loader. How can I get the shapefile loader plugin in pgAdmin 4? Javascript add js libraries by code