Here we have two classes, TestA and TestB.  TestB is a subclass of TestA.  The output of this program is 8, but I don't understand how it reaches this output because from my understanding it makes more sense for it to be 6.  I ran the program and found that whenever TestB is invoked, it visits the constructor of TestA before it executes its own constructor. This doesn't make sense since subclass should not inherit the superclass' constructor.  Can someone explain why this is happening? Thanks!  public class TestA{     static int x;     static TestA a;     static TestB b;      TestA(){         x++;     }      static void runTest(){         a = new TestA();         b = new TestB();     }      public static void main(String[] args){         runTest();         runTest();         System.out.println(a.x + b.x);     } }  class TestB extends TestA {     static int x;      TestB(){         x += 2;     } }
I have a question about inheritance in Java.  I have two classes A and B , and class B, inherits from A:  public class A {      public A() {          System.out.println("Hi!");      } }   public class B extends A {      public B() {          System.out.println("Bye!");      }       public static void main(String[] args) {          B b = new B();      } }   When I run program B, the output is:  Hi! Bye!      Question : why the constructor of class A is invoked, when I create and object of class B ?    I know that B inherits everything from A - all instance or class variables, and all methods, and in this sense an object of B has all characteristics of A plus some other characteristics defined in B. However, I didn't know and didn't imagine that when I create an object of type B, the constructor of A is also invoked. So, writing this:  B b = new B();   creates Two objects - one of type B, and one of type A.  This is getting interesting,   can somebody explain why exactly this happens?
Encouraging users to create an account (and keep it) This is what I have come up with so far, but I am rather lost at lines 3-4...  $$\begin{align} (a,b)\in A\times (B\setminus C)\iff&amp; a\in A \land b\in (B\setminus C)\\ \iff&amp; a\in A \land (b\in B \land \lnot(b\in C))\\ \iff&amp; (a\in A \land b\in B) \land (a\in A \land b\notin C)\\ \iff&amp; (a\in A \land b\in B)\setminus (a\in A \land b\in C)\\ \iff&amp; (a,b)\in (A\times B)\setminus ((a,b)\in A\times C)\\ \iff&amp; (a,b)\in (A\times B)\setminus (A\times C) \end{align}$$ How to reinstall yum? I made a big mistake: I removed yum. So now when I for example run the following it gives me an error:  $ yum clean all yum command not found.   I can download the package succesfully:  wget mirror.centos.org/centos/6/os/i386/Packages/yum-3.2.29-40.el6.centos.noarch.rpm --2014-01-15 15:42:59--  http://mirror.centos.org/centos/6/os/i386/Packages/yum-3.2.29-40.el6.centos.noarch.rpm Resolving mirror.centos.org... 192.133.139.3 Connecting to mirror.centos.org|192.133.139.3|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 1019540 (996K) [application/x-rpm] Saving to: “yum-3.2.29-40.el6.centos.noarch.rpm.1”  100%[====================================================================================================================&gt;] 1,019,540    649K/s   in 1.5s  2014-01-15 15:43:01 (649 KB/s) - “yum-3.2.29-40.el6.centos.noarch.rpm.1” saved [1019540/1019540]   Trying to install the downloaded package gives the following error:  # rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm Preparing...                ########################################### [100%]     file /usr/lib/python2.6/site-packages/yum/__init__.py from install of yum-3.2.29-40.el6.centos.noarch conflicts with file from package yum-3.2.29-30.el6.centos.noarch [...] file /usr/share/yum-cli/yummain.pyo from install of yum-3.2.29-40.el6.centos.noarch conflicts with file from package yum-3.2.29-30.el6.centos.noarch   There is no directory "yum" in /usr/bin.  When I use the command "rpm -qa | grep yum".  yum-metadata-parser-1.1.2-16.el6.x86_64 yum-plugin-fastestmirror-1.1.30-14.el6.noarch yum-3.2.29-30.el6.centos.noarch   The distro is CentOS 6.3. How can I reinstall yum? Finding a conformal map from the intersection of two disks to the unit disk. I wonder  whether there is a function $f\colon\Bbb R\to\Bbb R$ with the folowing characteristic?   for every two real numbers $\alpha,\beta,\alpha\lt\beta$,  $$\{f(x):x\in(\alpha,\beta)\}=\Bbb R$$   I can't  say such a function does not exist, neither can I construct a example  Thanks a lot! A nasty integral of a rational function I'm having a hard time proving the following $$\int_0^{\infty} \frac{x^8 - 4x^6 + 9x^4 - 5x^2 + 1}{x^{12} - 10 x^{10} + 37x^8 - 42x^6 + 26x^4 - 8x^2 + 1} \, dx = \frac{\pi}{2}.$$  Mathematica has no problem evaluating it while I haven't the slightest idea how to approach it. Of course, I would like to prove it without the use of a computer. Is this an explicit form of a special function I fail to recognize? failed to get D-Bus connection: Operation not permitted I'm trying to list services on my CentOS image running in Docker using  systemctl list-units     but I get this error message:  Failed to get D-Bus connection: Operation not permitted   Any suggestions what the problem might be? Question on how to normalize regression coefficient Not sure if normalize is the correct word to use here, but I will try my best to illustrate what I am trying to ask. The estimator used here is least squares.  Suppose you have $y=\beta_0+\beta_1x_1$, you can center it around the mean by $y=\beta_0'+\beta_1x_1'$ where $\beta_0'=\beta_0+\beta_1\bar x_1$ and $x_1'=x-\bar x$, so that $\beta_0'$ no longer has any influence on estimating $\beta_1$.  By this I mean $\hat\beta_1$ in $y=\beta_1x_1'$ is equivalent to $\hat\beta_1$ in $y=\beta_0+\beta_1x_1$. We have reduced equation for easier least square calculation.  How do you apply this method in general? Now I have the model $y=\beta_1e^{x_1t}+\beta_2e^{x_2t}$, I am trying to reduce it to $y=\beta_1x'$. "have" vs."have got" in American and British English Option clash for package xcolor After running an upgrade from Ubuntu 11.10 (Oneiric Ocelot) to 12.04LTS (Precise Pangolin), a window popped up saying that the upgrade failed and that I should run sudo dpkg --configure -a.  Running that command gave me:  sudo dpkg --configure -a dpkg: error: parsing file '/var/lib/dpkg/status' near line 55497 package 'indicator-displex':  blank line in value of field 'Description   Trying to run apt-get install -f gives me many dependency errors along with that same dpkg error. I have been given the task to rewrite a function as a sum of an even and an odd function. But when I went to analyze the parts of the original function I noticed that one part was neither even nor odd.   The original function was: $g(x) = (x + 1) / (x^2 - 3x + 4$)  After analyzing I realized that when using f(-x) to determine symmetry it produced a 'neither' result. How would I go about writing a function that is neither even nor odd as an even function. (It would have to be an even function as the (x+1) part of the original function is odd and since I need to write it as a sum of even and odd, the denominator would need to be even. Who wrote about an energy free space elevator? Prove that the function : $f(x) = x$ when $x$ is rational and $f(x) = 1 - x$ when $x$ is irrational is continuous at $x = \frac{1}{2}$  To prove the continuity it is necessary to prove that for every $\epsilon$ there exists a $\delta$ such that $|f(x) - f(\frac{1}{2})| &lt; \epsilon$ whenever $|x -c| &lt; \delta$ $- (1)$ Now if we choose $a  € (\frac{1}{2} - \delta, \frac{1}{2} + \delta)$ and also $a $ is rational and choose $\epsilon &lt; |a - \frac{1}{2}|$ then condition in $(1)$ is not satisfied. How to move from here? Implications of parity violation for molecular biology In biology, the concept of parity emerges in the context of chiral molecules, where two molecules exist with the same structure but opposite parity. Interestingly, one enantiomer often strongly predominates over the other in natural biological systems (e.g. D-glucose is ubiquitous, L-glucose is rare in nature).  In physics, it has been established that weak interactions violate parity, which (if I understand correctly) implies a physical difference between left- and right-handed systems.  This suggests to me the following questions: Does parity violation in physics affect the physical or chemical properties of chiral molecules? And does this have any implications for our understanding of biological homochirality? What if the Earth stops in its orbit and instead falls straight towards the Sun? The Earth orbits around the Sun because it has angular momentum. If we stopped the Earth in orbit and then let it fall straight towards the Sun, how long would it take to reach the Sun in seconds?  Details and assumptions  The mass of the sun is 2*10^30 Kg. The mass of the earth is 6*10^24 Kg. The earth is 149,600,000 Km from the Sun. You may treat the Earth and Sun as point masses. In English, words with a 'g' followed by a front vowel (e, i, y) can be pronounced with a soft g or a hard g:   Words with Germanic roots are usually pronounced with a hard g: gear, get, gift, give Words with Latin and Greek roots are usually pronounced with a soft g: gem, general, giraffe, giant   But how should a purely English word (if such thing even exists) with a 'g' followed by a front vowel be pronounced? In other words, if an English speaker saw a new word of unknown origin (eg: a neologism) that starts with gi- or ge-, how would they pronounce it? I am using the 2D Animation preset and so far every new scene I made had the same bright white background. Now my two latest scenes (created with 'copy settings') have a light grey background even though they are set to white. There's also no difference in surface, nodes or strength.  There are apparently exist different background shades with an off-white color but selecting the white one doesn't help either Minecraft's got an "Open to LAN" feature, which can be used to set up a local server when two computers running Minecraft are on the same network. Some young relatives of mine use this to play together whenever they're in the same house, but they'd like to be able to play together from their respective residences.  A server is not optimal because it's a bit complex. I've tried using Tunngle to spoof that the computers are on the same connection to no avail.  How can I convince Minecraft's "Open to LAN" that their two separate computers are on the same network? How many individual lights can an arduino control I want to use a regular Arduino board to control LEDs - what is the most lights I can control individually from the board?  Is there a tutorial on how to hook it up?