I saw this sample code at Oracle Certification website and someone here can explain me the concept of static {} ?  public class Sequence {  Sequence() {     System.out.print("c "); }  {     System.out.print("y "); }  public static void main(String[] args) {     new Sequence().go(); }  void go() {     System.out.print("g "); }  static {     System.out.print("* "); }  }
My question is about one particular usage of static keyword. It is possible to use static keyword to cover a code block within a class which does not belong to any function. For example following code compiles:  public class Test {     private static final int a;         static {         a = 5;         doSomething(a);     }     private static int doSomething(int x) {         return (x+5);     } }   If you remove the static keyword it complains because the variable a is final. However it is possible to remove both final and static keywords and make it compile.   It is confusing for me in both ways. How am I supposed to have a code section that does not belong to any method? How is it possible to invoke it? In general, what is the purpose of this usage? Or better, where can I find documentation about this?
Prove that $A = B = C = D$ $A, B, C, D$ are sets, where $A \not = \emptyset$ and $B \not = \emptyset$. Equation $(A \times B) \cup (B \times A) = C \times D$ is true.  Prove that $A = B = C = D$.  I tried to find $A, B, C, D$ separately, but that didn't get me anywhere. Any ideas how to solve it? I started thinking about the number of associative (binary) operations on a set with $n$ elements today.  Looking online I found  which indicates only $113$ of the possible $19,683$ operations on a three-element set satisfy association.  So, $50\%$ of binary operations on a two-element set satisfy association, and less than $0.6\%$ of all binary operations on a three element set satisfy association.  For an $n$-element set, where $n$ denotes a natural number, is the ratio $R_{n}=A_{n}/B_{n}$, of the number of associative binary operations $A_{n}$ to the number of all binary operations $B_{n}$, in general small?  I don't mean the following questions as equivalent, but since they seem more concretely answerable in principle, does   $$ \lim_{n \to +\infty} \frac{A_{n}}{B_{n}} = 0 ? $$       Also, is $F : n \to R_{n}$ a monotonically decreasing function?  Some Background of the Question: In his Linear Algebra Problem Book 1995 on p. 6 Paul Halmos writes "The commonly accepted attitudes toward the commutative law and the associative law are different.  Many real life operations fail to commute; the mathematical community has learned to live with that fact and even to enjoy it.  Violations of the associative law, on the other hand, are usually considered by specialists only."  For all I know, Halmos might only have written that to motivate the study of Linear Algebra and doesn't quite literally mean what he appears to say.  But, if he means what he appears to say, and if $F : n \to R_{n}$ is monotonically decreasing, or $R_{n}$ is generally small, I think there's something amiss with what Halmos says, since non-associative operations seem so common that one may as well enjoy them. Why gravity is an attractive force? Why gravity is an attractive force?     One may say that it is because of space time curvature but General Relativity is built on this law: $\displaystyle G \frac{m_1 \times m_2}{r^2}$ (To be more precise, it is  from it's potentiel form known as  that can be written like this: $\nabla \cdot g = - 4\pi Gp  $). So GR can't explain why gravity is attractive. General Relativity only explains how gravity occurs in terms of space time.    Another may stick with the Quantum theory stating that gravitons are responsible for the force of gravity, but why a massless particle with spin 2 will exchange positive momentum? What does an icon on the tag mean, for example the "rg" before the sql-server tag as pictured below? Prove $\gcd(a,b,c)=\gcd(\gcd(a,b),c)$ for $0\ne a,b,c\in \Bbb{Z}$. I tried solving it with sets but I sense there are some details I am missing. I would truly appreciate your reference. Search for text files where two different words exist (any order, any line) I'm looking for a way to search files where two word instances exist in the same file.  I've been using the following to perform my searches up to this point:  find . -exec grep -l "FIND ME" {} \;   The problem I'm running into is that if there isn't exactly one space that between "FIND" and "ME", the search result does not yield the file.  How do I adapt the former search string where both words "FIND" and "ME exist in a file as opposed to "FIND ME"?  I'm using AIX. A continuation of .  I'm fighting a page-limit in a single-column layout and I need to put a Figure and a Table side-by-side and provide them with independent captions. However, the style guide for the publishers (LNCS) wants Figure captions below and Table captions above (probably something to do with ).   =======================================================  If I adapt @lockstep's floatrow example from  accordingly to have a Table caption above ...  \documentclass{article}  \usepackage{floatrow} % Table float box with bottom caption, box width adjusted to content  %% ********************************** %% just adding \captop to original example %% ********************************** \newfloatcommand{capbtabbox}{table}[\captop][\FBwidth]  \usepackage{blindtext}   \begin{document}  \blindtext  \begin{figure} \begin{floatrow} \ffigbox{%   \rule{3cm}{3cm}% }{%   \caption{A figure}% } \capbtabbox{%   \begin{tabular}{cc} \hline   Author &amp; Title \\ \hline   Knuth &amp; The \TeX book \\   Lamport &amp; \LaTeX \\ \hline   Knuth &amp; The \TeX book \\   Lamport &amp; \LaTeX \\ \hline   Knuth &amp; The \TeX book \\   Lamport &amp; \LaTeX \\ \hline   \end{tabular} }{%   \caption{A table}% } \end{floatrow} \end{figure}  \end{document}   =======================================================  The problem becomes clear ...    =======================================================  The floatrow doesn't correctly line up the Table and Caption. I reluctantly tried to use vspace to solve the problem, but it didn't work out.  Any suggestions on how to get these two to align? I'm happy to accept any alignment that ensures that the Table and Figure fit within the same "box".  (A similar-ish question was , but specific for subfig and with a very localised problem it seems.) This seems to be a chicken-egg problem. The most common task using sudo is installing and removing software.  sudo apt-get purge &lt;appname&gt;   But sudo itself can be removed.  sudo apt-get purge sudo # Do not run this command on production computers!   This is where the fun comes  ubuntu@ubuntu:~$ sudo bash: /usr/bin/sudo: No such file or directory   Although it's obvious that no person in his right mind will purge sudo (other than me), someone can be fooled to run this command (not directly, in its hex mode, or whatever it's called) or a person could SSH in disguised as tech guru and do the mess.  So is there a way of reinstalling sudo? Hyperref: Changing the linkcolor locally in the TOC I found that the link-color for TOC text is identical to the link-color for Figures and Tables. When I change the color to black in the TOC also the color for Figures/Tables citation etc. is changed.  Is there a way to separately set the colors inside the TOC and outside? Why am I getting no power when I pedal? Yesterday when I was biking my mountain bike on level paved path, I would pedal but get no power to the wheel.  To use a car analogy, it was as if I had the clutch in and was apply gas.  It seemed to happen most often after I coasted and then went back to pedalling.  I would pedal and realize that no power was going to the wheel.  The chain was definitely on the sprockets and moving. I could change gears no problem while I had no power.  Sometimes stopping the bike and starting again would work, or just trying again.  Needless to say, I'm taking it in as I'm not mechanically inclined, but I'm hoping to learn something.  Perhaps a link to a site that explains the problem?  So my questions.   What is going on?  I have heard of something called the "freehub".  I really don't know how bikes work though, so I'm hoping for an explanation of how one can pedal and give power to the wheel and then stop pedalling and the wheel just keeps moving (without the pedals moving).   If you are on a ride, is there any emergency adjustment to make?   For what it's worth, it's an old bike.  Circa 1993 Performance Mtn Bike.  So it's not too surprising that it's falling apart.  I haven't used it a whole lot, and have tried to wash and oil it, but I probably haven't taken the care that a biking aficionado would.  Also, besides losing power after coasting, one time I was pedaling and suddenly the pedals weren't powering the wheel.  I almost went over the handlebars!  So, I definitely want to get it fixed.  I'd just like to know a little bit about what is going on.  Thanks,  Dave.  Bonus question:  If there is enough info to make a diagnosis and you have ideas on costs to fix, perhaps you could comment on whether it's worth fixing.  Like I said, it's circa 1993 and cost about $450 then.  No shocks or anything.  Just 21 speed Mtn. Bike. I just wanted to ask whether there is any command which would work on common shells (bash, dash, kornshell)? It is supposed to check if the line variable contains any part of the path.  if [[ $line =~ "$PWD"$ ]] ;then Is there any intuition or meaning regarding Cauchy-Riemann equations? Why aren't my turtles breeding? What happened to the "very low quality" flag reason? Possible Duplicate:          I see a  to receive a "very low quality" flag by me.  It's just a link pointing elsewhere basically saying, "try this." I generally do this for answers I see that are like this and have been successful every time so far.  I save "not a real answer" flag for other cases such as someone asking another question in an answer or "thanks" answers.  I want to flag it as "VLQ" but I don't see that as an option*.  In fact, I don't see it as an option anymore on any site throughout the Stack Exchange network.  * This was not possible before when I initially posted this. Michael's observation on the needed downvote seems to be the reason it didn't show up.  Did it just get phased out as being unnecessary?  Should I be using "NARA" as the flag reason for this case now?  I'm not sure if the "NARA" explanation really covers this case well: (emphasis mine)     This was posted as an answer, but it does not answer the question. It should possibly be an edit, a comment, another question, or deleted altogether.   These sorts of answers can answer the question in general.  The site linked to might very well completely answer the question.  (in this particular case, maybe not however)  It's just that the answerer really should do something to improve the answer.  It's not like it's a "This question is a duplicate of this [onsite question] post" or some other general spam.  Those cases are clearly "NARA"/spam.  There was a  regarding the necessity of this flag reason.  Answers point out that it is needed and I agree.  There hasn't been anything mentioned (that I am aware of) in terms of removing it by the team.  Was this officially removed now in favor of other flagging reasons?  Or is this just a bug and it was "accidentally" removed? Why can't I have a non-integral static const member in a class? I noticed C++ will not compile the following:  class No_Good {   static double const d = 1.0; };   However it will happily allow a variation where the double is changed to an int, unsigned, or any integral type:  class Happy_Times {   static unsigned const u = 1; };   My solution was to alter it to read:  class Now_Good {   static double d() { return 1.0; } };   and figure that the compiler will be smart enough to inline where necessary... but it left me curious.  Why would the C++ designer(s) allow me to static const an int or unsigned, but not a double?  Edit: I am using visual studio 7.1 (.net 2003) on Windows XP.  Edit2:  Question has been answered, but for completion, the error I was seeing:  error C2864: 'd' : only const static integral data members can be initialized inside a class or struct Why an abstract class implementing an interface can miss the declaration/implementation of one of the interface's methods? A curious thing happens in Java when you use an abstract class to implement an interface: some of the interface's methods can be completely missing (i.e. neither an abstract declaration or an actual implementation is present), but the compiler does not complain.  For example, given the interface:  public interface IAnything {   void m1();   void m2();   void m3(); }   the following abstract class gets merrily compiled without a warning or an error:  public abstract class AbstractThing implements IAnything {   public void m1() {}   public void m3() {} }   Can you explain why? How to make a circular array using offset object as center? We know that the there is an Object Offset option for Array modifier, but when trying to make a circular array with that offset object as the center of the array circle, it always doesn't behave quite like what's expected. So how to make a nice and controllable circular array?  P.S.: There is an old  about moving the object's origin. I wonder if there is any way to do this without changing the location of the origin. :) Are there sets $A$ and $B$ such that $A \in B$ and $B \in A$? I think that the question is clear from the title:     Are there sets $A$ and $B$ such that $A \in B$ and $B \in A$?   My feeling is that the definition of any two such sets will be circular (we can't define $B$ till we define $A$ and we can't define $A$ till we define $B$), and hence will be excluded by some axiom.  On the other hand, I can't see an inherent contradiction, though I wouldn't be surprised if some form of Russell's paradox pops up, pushed behind one more set of braces. Finite ring has only zero divisors and units Use the new helpcenter for the question/answer ban message Related:    The helpcenter has . It still links to the  for further details. Besides that, the question ban message .  Now that we have the helpcenter, could the following changes be implemented?   Link to the help center instead of the meta post Remove the link to the meta post from the help center, and instead incorporate its contents into the helpcenter itself