I was kind of baffled when I saw the following code did not work as expected.  I thought Java always passed variables by references into functions.  Therefore, why can't the function reassign the variable?   public static void main(String[] args) {    String nullTest = null;    setNotNull(nullTest);    System.out.println(nullTest); }  private static void setNotNull(String s) {   s = "not null!"; }   This program outputs null.
I always thought Java uses pass-by-reference. However, I've seen a couple of blog posts (for example, ) that claim that it isn't (the blog post says that Java uses pass-by-value). I don't think I understand the distinction they're making. What is the explanation?
When do you use Quantum Mechanics? Given a problem, how does one know whether to use quantum mechanics or classical mechanics?   Take for example electron scattering from a nucleus. The electrons are given a wavefunction in this case. Why not use the classical approach? How to play a YouTube clip in background/minimised? Using VHDL code to design a JK Flip Flop I'm using quartus II to design a JK Flip Flop. However, my results show unknown output. Why is it?  Intended design circuit:    VHDL code:  library IEEE;  use IEEE.STD_LOGIC_1164.ALL;  entity JKFlipFlopGate is     port(         J,K,Clk : in std_logic;             --JK Flip-Flop gate input 1 &amp; 2         Q,Qbar : out std_logic              --JK Flip-Flop gate output     ); end JKFlipFlopGate;  architecture result of JKFlipFlopGate is         signal out1,out2,out3,out4 : std_logic;  begin     out1    &lt;= NOT(J AND Clk AND out4);                      out2    &lt;= NOT(K AND Clk AND out3);      out3    &lt;= out1 NAND out4;     out4    &lt;= out2 NAND out3;      Q       &lt;= out3;     Qbar    &lt;= out4;     end result; I have two examples of different scenarios that are confusing to me.  First, if I have a 1/1 creature with first strike and deathtouch, and my opponent blocks it with a 2/2 creature, will my creature die? I can see two alternative ways this could play out and I'm not sure which is correct.   My creature deals his first strike damage, immediately killing the opponent's creature before he is able to deal combat damage as a state-based effect. My creature deals his first strike damage, which would normally be lethal due to deathtouch, but state-based effects are not checked, and thus the opposing creature deals his damage and both die.   I'm almost positive in this case that it's the first option above.  What gets trickier is, for example, if a creature has first strike and a triggered ability "Whenever this creature deals combat damage to a creature, return that creature to its owner's hand."  This is not a state-based effect, but rather uses the stack. Similar to above, there are two possibilities.   My creature deals his first strike damage, and his triggered ability is placed on the stack. The stack waits to resolve until after all combat damage is dealt, so the opposing creature still kills mine. My creature deals his first strike damage, and his triggered ability is placed on the stack. Both players now gain priority between first strike and combat damage (which I don't think normally happens, thus my confusion). The stack finishes resolving, and the opponent's creature doesn't have a chance to deal damage.   Can someone clarify this area of the rules? I applied for a standard visitor visa to the UK for seven days. I earn £278/month and have been working at the same organization for more than a year. I have saved up enough funds for the trip and I attached bank statements to prove it. The ECO refused my visa stating:      I note that you stated that your trip to the UK will cost you £1100, this is approximately 4 times your monthly income. I do not find it credible that you spend this amount on a trip.   I am a single woman, with no financial responsibilities and I saved up for this trip because I really wanted to visit the UK.  How do I prove to the ECO and the authorities that spending £1,100 for my trip wouldn't have caused me any financial harm neither would I have had to access UK government funds?    Another concern of mine is that if I reapply without the partial funding of my father or get sponsored by a different person, does the amount given by my father previously cause hindrance in my visa application?  Won't they still reject it on the basis of my pay being too insignificant? Find $(a,b)$ such that $\lim\limits_{x\to 0}\frac{f(x)}{x}=1$ implies $\lim\limits_{x\to 0}\frac{x(1+a\cos x)-b\sin x}{(f(x))^3}=1$ Let $f$ denote any function such that $\lim\limits_{x\to 0}\frac{f(x)}{x}=1$. Find the value of $a$ and $b$, assuming that $\lim\limits_{x\to 0}\frac{x(1+a\cos x)-b\sin x}{(f(x))^3}=1$.   My  attempt: $\lim_{x\to 0}\frac{x(1+a\cos x)-b\sin x}{(f(x))^3}=1$ $\lim_{x\to 0}\frac{x(1+a\cos x)-b\sin x}{x^3\frac{(f(x))^3}{x^3}}=1$ $\lim_{x\to 0}\frac{x(1+a\cos x)-b\sin x}{x^3}=1$ $\lim_{x\to 0}\frac{1+a\cos x-b\frac{\sin x}{x}}{x^2}=1$ $\lim_{x\to 0}\frac{1+a\cos x-b}{x^2}=1$ As denominator is tending to zero,so numerato will also tend to zero. $1+a-b=0............................(1)$ Applying L Hospital rule, $\lim_{x\to 0}\frac{-a\sin x}{2x}=1$ So $a=-2$ and $b=-1$ But the answer given in my book is $a=\frac{-5}{2}$ and $b=-\frac{3}{2}$. I do not understand where have i gone wrong? Am I going to have trouble flying with a reversed name on the ticket? I'm flying to Peru with my girlfriend next week and I realized that her name is incorrect on the reservation.  Instead of Sally Marie Jones it's Jones Marie Sally.  We're flying into Houston, then Lima, and in Lima we switch airlines for our flight to Cajamarca.  I booked the ticket with Orbitz who made the reservation with United. United booked the flight with LAN air, the Peruvian airline.  Both companies say that they are unable to change the name because of TSA restrictions not allowing a name change. I asked if I could just cancel and re-book, but United said they could not do this because there are multiple airlines involved.  A note has been attached to the reservation explaining the issue, and the United rep said that they would be able to print her boarding pass with the correct name. However, he said there are no guarantees that she'll be able to fly because although the boarding pass will be correct, the ticket will still have the reversed name.  I was prepared to just take the chance that it will all work out, seeing how it's really obvious the name is just backwards, but with recent events I'm worried that US airport security is going to be extra strict for the next little while.  Is this something I need to worry about, or are chances good that this will work out fine?  The United rep said there's a chance we could cancel the United flights and get a new ticket with the correct name for no cost, but we'd have to pay for new tickets within Peru ($500 out of the total $1300 ticket cost). I'd rather not do this unless there's a reasonable chance we'll have trouble at the airport. Book series about preparation for a war at the Singularity I am looking for a book series (almost certainly a trilogy) that starts with some humans in a space station being abducted by a small funny-looking alien and taken to a prison planet. They find out that the way space travel works is by creating copies of the passengers, and the originals remained on the space station. This is actually good for the aliens since they believe every sentient being will resurrect at the Singularity and will be forced to fight a battle, so the more the merrier.  The one other detail I remember is that the world economy has a rampant inflation, so people take any cash they have at the end of the day and buy 20th-century memorabilia that doesn't devalue as much. Why shouldn't I use "Hungarian Notation"? Proof for maximal ideals in $\mathbb{Z}[x]$ I have been trying to prove the following theorem:      Every maximal ideal in $\mathbb{Z}[x]$ has the form $(p, f(x))$ where $p$ is prime integer and $f$ is primitive integer polynomial that is irreducible modulo $p$.    Idea: I tried to establish a homomorphism $\phi: \mathbb{Z}[x] \rightarrow \mathbb{F}$. Since $\mathbb{F}$ is a field it has characteristic $p$ and so integer prime p are mapped to 0 in $\mathbb{F}$. Hence $p\in \ker \phi$. Next we consider $\phi': \mathbb{Z}[x] \rightarrow \mathbb{Z_p}[x]$ and pick an arbitrary maximal ideal $M\in \mathbb{Z}[x]$. So, $\phi'(M)$ is maximal as long as $p \in M$ by correspondence. But now I am stuck at this stage and do not know how to proceed. I guess we might have to use primitivity given in problem but dont know how. iMac disk partion FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF and fusion drive unlinked Energy-momentum tensor transformation I am trying to lock some boxes in a map of mine, and I used this command:   /blockdata 10 4 9 {Lock:Elyiana's Mage Key}   At first it worked, but then when I logged back on the next day it gave me this error message:    Data tag parsing failed: Expected '}' but ''' at: {Lock:Elyiana'&lt;--[HERE]     I don't know why it doesn't like the apostrophe in the key's name. I would change it, but it already worked and locked some other items. My version is 1.12, does anyone have an answer to my problem? Prove that if $(ab)^i = a^ib^i \forall a,b\in G$ for three consecutive integers $i$ then G is abelian I'm trying to make a conditional formatting rule in Google Spreadsheet that would highlight a row green based on text in multiple cells.   If cells L2, M2, and N2 = APPROVED; and cell O2 = X; then row 2 = highlighted green. if a complex function $f$ is real-differentiable, then $f$ or $\overline{f}$ are complex-differentiable This is an exercise from Remmert's Theory of Complex functions.  Let $D\subset \mathbb{C}$ be a domain and $f:D\rightarrow \mathbb{C}$ a real-differentiable function. Assume that the following limit exists:  $ \mathrm{lim}_{h\rightarrow 0} \left|  \frac{f(c+h) - f(c)}{h}   \right|.$  Show that either $f$ or $\overline{f}$ is complex-differentiable.  I've tried showing that $\frac{\partial f}{\partial \overline{z}} = 0$ or $\frac{\partial \overline{f}}{\partial z} = 0$ by using the fact that there exist continuous functions $g$ and $h$ such that in $D$ one can write   $f(z) = f(c) + (z-c)g(z) + (\overline{z} - \overline{c})h(z)$   and that  $g(c)= f_{z}(c)$ and $h(c) = f_{\overline{z}}$ and then plugging this into the limit above. Does this approach works and I just can´t see how to do it? Can someone give a hint or a guideline solution to this? Rotating hatch labels based on orientation changes in Data Driven Pages Strip maps? I've created a strip map for a linear feature and have it loaded as a data driven page.  I want to show stationing for the line.  The stationing displays properly on the first data driven page but on each subsequent page the stationing labels get messed up as the map orientation changes. I want the stationing labels perpendicular to the linear feature as shown in the first image.  The tick marks seem to rotate and stay perpendicular to the line but the labels won't.  How can I fix this? So I've been experiencing this in the last few days: sometimes when someone replies to my comment, and I reply to the reply, then the "add/show 1 more comment" link appears immediately after I post my comment. However, when I click it, it disappears and nothing is shown.  I don't think it's that OP is posting two comments of which he deletes the second one, because this has happened to me several times, even when I was replying within 2-3 seconds.  I do, however, believe that this is more or less the same bug as , except that I don't have to reload the page in order the link to be gone, and I also seem to be getting the erroneous behavior only if I reply to a comment which is itself a reply to an earlier comment of mine.  Unfortunately, I wasn't careful enough to take a screenshot last time this happened, but here's what I am talking about for those who like visual demonstration better: Average distance between two random points in a square A square with side $a$ is given. What is the average distance between two uniformly-distributed random points inside the square?  For more general "rectangle" case, see . The proof found there is fairly complex, and I am looking for a simpler proof for this special case. I expect it could be significantly simpler.  See also . requireJS optional dependency