I have multiple global booleans in a java class and since I didn't want to copy and paste a method over and over again, I made the method below. problem is that when I enter "y" it's supposed to make the variable in parameter a true, but every time I checked the variable it's still false, even though the price works the way it should.  I tried shuffling the order around to see if it did anything (it didn't). should I just make a method for each variable instead?  public void wants(String b, boolean a){    while(!b.equalsIgnoreCase("y") &amp;&amp; !b.equalsIgnoreCase("n")){        System.out.println("Please enter y or n");        b = keyboard.next();    }    if(b.equalsIgnoreCase("y")){         a = true;         price += 0.5;    }    else if(b.equalsIgnoreCase("n")){         a = false;    } }   (Continuation) So I checked out "Is Java 'pass-by-reference' or 'pass-by-value'?" question and came to the conclusion of 'oh, so I need to make some getters and setters and the problem will be solved!' I definitely did something wrong though since I'm getting the error message 'boolean cannot be dereferenced' so it's not even letting me compile which is big oof.  //private vars (project requirement, can't be removed) private boolean wantsCheese, wantsGuac, wantsCream;  public void takeOrder() {     System.out.println("Do you want cheese? (Y/N)");     //was initially wants(keyboard.next(), wantsCheese); for previous method     wantsCheese.wants(keyboard.next()); } ... public void wants(String b){     while(!b.equalsIgnoreCase("y") &amp;&amp; !b.equalsIgnoreCase("n")){        System.out.println("Please enter y or n");        b = keyboard.next();    }    if(b.equalsIgnoreCase("y")){        setCheese(true);        price += 0.5;    }    else if(b.equalsIgnoreCase("n")){       setCheese(false);    } } public boolean getCheese(){    return this.wantsCheese; } public void setCheese(boolean wantsCheese){    this.wantsCheese = wantsCheese; } public boolean getGuac(){    return this.wantsGuac; } public void setGuac(boolean wantsGuac){    this.wantsGuac = wantsGuac; } public boolean getCream(){    return this.wantsCream; } public void setCream(boolean wantsCream){    this.wantsCream = wantsCream; }   }
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?
Pure virtual destructor in C++ Is it wrong to write:  class A { public:     virtual ~A() = 0; };   for an abstract base class?  At least that compiles in MSVC... Will it crash at run time? How to truncate all logfiles? Roth-IRA withdrawal penalty: 10% of what? Early non-exempt withdrawal from a Roth-IRA results in a "10% penalty". A 10% penalty on what amount: The amount withdrawn? The remaining balance of the Roth IRA? Both?   Insight appreciated Handling multiple regex matches in Ampscript Given this string:  SET @text = "&lt;a href=""https://salesforce.stackexchange.com""target=""_blank""&gt;Salesforce&lt;/a&gt; &lt;a href=""https://stackoverflow.com"" target=""_blank""&gt;Everything else&lt;/a&gt;"   And this function:  SET @matching = '\s+(?:[^&gt;]*?\s+)?href="([^"]*)"' SET @output = RegExMatch(@text, @matching, 1)   How can I manage to find and print an arbitrary number of matches in my string? E.g. in above example, I would like to present e.g. a rowset with each URL in each row. Let $(A,+,\cdot)$ be a unity ring with the property that if $x \in A$ and $x^2=0$ then $x=0$. Consider the set $M=\{a\in A | a^3=a\}$. Prove that:      a) $2a\in Z(A)$, $\forall a\in M$, where $Z(A)$ denotes the centre of the ring $A$;   b) $ab=ba$, $\forall a,b\in M$.   My attempts revolved around the fact that an idempotent element in a reduced ring is central. So, since for $a\in M$ we have that $(a^2)^2=a^2$, it follows that $a^2\in Z(A)$, $\forall a\in M$. The next thing I wanted to use in order to solve a) was that $Z(A)$ is a subring of $A$, so if I had proved that $(a+1)^2 \in Z(A)$, $\forall a\in M$, then we would have reached the desired conclusion. However, I couldn't prove this and I honestly doubt that it is true. Another idea that I had was to prove that $M$ is a subring of $A$. Of course, this didn't work out because I cannot even prove that $M$ is closed under addition. Again, I don't know if this is true and it most likely isn't. As for b), I think that a) should be of use, but I don't know how. It is a well-known problem that a ring with $x^3=x$ for any $x$ in that ring is commutative, but since $(M,+,\cdot)$ is almost definitely not a ring, this doesn't help. EDIT: Is there any chance that this question is simply wrong? I tended to believe this before asking it here too, but since nobody has made any progress on it until now I am even more inclined to think so. Cannot delete directory with Directory.Delete(path, true) I'm using .NET 3.5, trying to recursively delete a directory using:  Directory.Delete(myPath, true);   My understanding is that this should throw if files are in use or there is a permissions problem, but otherwise it should delete the directory and all of its contents.  However, I occasionally get this:  System.IO.IOException: The directory is not empty.     at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)     at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive)     at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive)     ...   I'm not surprised that the method sometimes throws, but I'm surprised to get this particular message when recursive is true.  (I know the directory is not empty.)  Is there a reason I'd see this instead of AccessViolationException? Suppose $A,B,C$ are sets. Prove that $A\mathbin\triangle B\subseteq C \iff A\cup C=B\cup C$. Suppose $A,B,C$ are sets.  Prove that $A\mathbin\triangle B\subseteq C \iff A\cup C=B\cup C$.  I proved that for $x\in A\setminus B$, $x\in A\cup C$ and for $x\in B\setminus A$, $x\in B\cup C$. How do I show that $A\cup C=B\cup C$, and that $A\mathbin\triangle B\subseteq C \iff A\cup C=B\cup C$? I get the following error when trying to ls *.txt | wc -l a directory that contains many files:  -bash: /bin/ls: Argument list too long   Does the threshold of this "Argument list" dependent on distro or computer's spec?  Usually, I'd pipe the result of such big result to some other commands (wc -l for example), so I'm not concerned with limits of the terminal. I cannot find the Polygon Neighbors tool. I have searched for it as I usually do and I have also browsed the proximity toolset but it is not there. The other Tools, e.g. Buffer and Near are there and work fine. Here is a screenshot: Does That's very sweet of you  in the US sound like That's very sweef you? the of is only speak f and link with swee Prove norm doesn't come from inner product. Please help me prove this. I'm not sure how to apply the parallelogram law to the norm. What info does Google backup? Does anyone know what exactly does Google backup (and restore) when you enable that option?  Also, are we able to see this list somewhere? (Maybe hidden n-levels deep in Google Account information?)  Reason I ask is I've had the unfortunate experience of my SD Card dying on me, put in a temporary SD Card and allowed Google to do the auto-restore.  Some things that were restored:   Saved wireless networks Background Some apps - strangely enough only a subset of my apps were restored (some with data, some without). All previous apps were installed via Android Market.   Then finally got my new SD Card, put that in and the following were restored   Saved wireless networks Some apps - again, same problem... only a subset (different subset, even fewer apps). This time no data seemed to have been restored either.   I think it would be very helpful to be able to view/manage a list of what is backed up, and thus would be restored (but I have yet to find this list... if it even exists). UTF8 to/from wide char conversion in STL Is it possible to convert UTF8 string in a std::string to std::wstring and vice versa in a platform independent manner? In a Windows application I would use MultiByteToWideChar and WideCharToMultiByte. However, the code is compiled for multiple OSes and I'm limited to standard C++ library. Can't install Oracle Java 8 in Ubuntu 16.04 Finding an expression for $\tan (a+ b + y)$ which involves only $\tan a, \tan b,$ and $\tan y$. How to find this ?   I'm stuck at $1$ and how to $1$ to change the tangent associated with a,b or c.  I meant this ,everybody.  $\frac{tan(a)+tan(b)+tan(y)−tan(a)tan(b)tan(y)}{1−tan(a)tan(b)−tan(a)tan(y)−tan(b)tan(y)}$ Run a command before & after ubuntu apt upgrade & unattended-upgrades Why is $X^4+1$ reducible over $\mathbb F_p$ with $p \geq 3,$ prime Finite Sum $\sum\limits_{k=1}^{m-1}\frac{1}{\sin^2\frac{k\pi}{m}}$ Custom date format with jQuery validation plugin How can I specify a custom date formate to be validated with the  for jQuery? Ubuntu 18.04 No WiFi adapter found [Dell Inspiron 3542.]