This is where i am getting error  Student[] student = new Student[10];  System.out.println(" Test : " + student[2].RollNo);   But i do not get error when  Student student = new Student();  System.out.println(" Test : " + student.RollNo);   Error only shows up when i am creating array of objects.
What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
Is there any performance reason to declare method parameters final in Java?  As in:  public void foo(int bar) { ... }   Versus:  public void foo(final int bar) { ... }   Assuming that bar is only read and never modified in foo(). What really causes light/photons to appear slower in media? I know that if we solve the Maxwell equation, we will end up with the phase velocity of light being related to the permeability and the permittivity of the material. But this is not what I'm interested in - I want to go deeper than that. We know that the real speed of light is actually not changing, the decrease in speed is just apparent. Material is mostly empty, the light will still travel with $c$ in the spacing. The rare atoms will disturb the light in some way. So I am interested in how the atoms affect the light. Photon absorption-emission theory Some textbooks that I read explain it in a way kind of like this: In a material the photons are absorbed by atom and then re-emitted a short time later, then they travel a short distance to the next atom and get absorbed&amp;emitted again and so on. How quickly the atoms in a material can absorb and re-emit the photon and how dense the atoms decides the apparent speed of light in that material. So the light appears slower because it has a smaller “drift speed”. Interference theory But recently I realize an alternative explanation: Atoms respond to the light by radiating electromagnetic wave. This “new light” interferes with the “old light” in some way that results in delayed light (advanced in phase), this can easily be shown by using simple phasor diagram. Consequently effectively the light covers a smaller phase each second, which gives the impression of a lower phase velocity. However the group velocity is changing in a complicated way. I think that the first explanation does not explain the change in phase velocity of light. if we consider light travelling into a slab of negative refractive index non-dispersive material, let’s say the light is directed perpendicular to the slab. The phase velocity’s direction will be flipped, but group velocity’s direction in the material will not change. Only the second explanation can explain the flipped phase velocity direction. I guess that the velocity that we get in the first explanation is actually belongs to the group velocity. It makes sense to me that the front most of the photon stream determines the first information that the light delivers. So the question is What really cause the phase velocity of light to be decreased?  &quot;drift velocity&quot; of photons (they aren't the same photons, they are re-emitted all the time) phase difference between absorbed and emitted light something else  And also, I still don't really understand detailed explanation of the absorption-emission process for small light's wavelength (for large lambda compare to the atoms spacing, the photons will be absorbed by the phonons). The dispersion relation that we know is continuous and also some material is non-dispersive, therefore the absorption process must occur in all frequency for a certain range. So definitely it doesn't involve the atomic transition, otherwise it will be quantized. My guess is that the relevant absorption process gets smooth out by the dipole moment. What makes the spectrum continuous? EDIT: link for dispersion relation: How does MySQL store data How to replace one char with another in all filenames of the current directories? Can't Remove Cortana from Windows 10 How to password protect grub menu entry? Is there a way I can password protect grub menu entry- e.g. if I dual boot with Windows 7 can I set it so that a password is needed to boot into Win 7?   Secondly I would also like to protect grub menu entries being changed if possible.  thanks How can I stop Nautilus from dereferencing symlinks? I use symbolic links to tidy my home folder. This works well in the terminal, since the links create the illusion of normal folders:    In Nautilus, however, the links behave more like , immediately teleporting me to their target:    This is particularly troubling when¹ I later want to navigate "up" to the parent folder, as it strands me somewhere outside of the tree I've carefully tidied.  How can I make Nautilus show symbolic links as normal folders, like the terminal does?  Details   Nautilus did not dereference symlinks in Ubuntu 12.10:   Maybe this new behavior is just a bug? I'm not sure how to tell. Here's what I know:   It's not on the . I've skimmed the  and didn't see anything related. The Nautilus mailing list archive . I received no response from about 120 idlers when posing the question on the GNOME IRC channel. A change was made in Nautilus 3.6 to .  ¹ This is an example. A workaround for this particular scenario does not constitute an answer to my question. Since people seem to be interested in discussing it, though:   Using the Back button is not a suitable workaround; it does not always take me to the parent folder. You can navigate up by pressing Alt+Up. The desired behavior in this example is for "up" to navigate to the parent folder of the symbolic link. The current behavior is to navigate to the parent folder of the target of the symbolic link. Is it good English to say "They have just left", when talking about a single person (perhaps someone you don't know the gender of)?  (I am a native English speaker, I'm looking for the view held by lexicographers). I once heard the late John Ciardi (NPR's "A Word in Your Ear") try to explain that the 1920s idiom, "copacetic" (meaning completely satisfactory), entered into the African-American vocabulary in Harlem from the days when Jews and African Americans lived there together.  He argued that copacetic has the same meaning as the Israeli idiom "kol b'seder" which literally means "all is in order."  The problem with that, said my Harlem-raised father-in-law, is that the Jews in Harlem spoke Yiddish and kol b'seder was not used in Yiddish.  The dictionary I've got is not helpful. Can someone come up with a better explanation? I am considering attacks on Two-Key Triple-DES Encryption assuming $2^{32}$ known plaintext/ciphertext pairs (that's a mere 32 of ciphertext) by the method devised by Paul C. van Oorschot and Michael J. Wiener:  (in ), or another published method not requiring significantly more DES computations. As a synthetic information for decision makers, I am looking for an independent estimate of how much time this is expected to require, assuming all the RAM ever built by mankind to that day (of April 2012) was put to full use. Note: I'm purposely not asking when the attack could become feasible using all the RAM ever built by mankind, because estimates on the amount of RAM mankind will build, and when, are less falsifiable. Update: I am not considering cost; neither of RAM, power, logic including DES engines (as long as the number of DES operations remains within $2^{90}$). I am willing to assume that the amount of RAM used, and its effective speed, are the only factors to account for in determining the expected duration of the attack. This is similar to the hypothesis made by the authors of the linked paper, that their attack is limited by the amount (or cost) of RAM used, with all other factors of secondary importance. Update: sadly, nobody dared answer the question and the bounty period is over. Thus  is a first order answer to criticize. Integer squares of the form $x^4+x^3+x^2+x+1$ I want to solve ${y^2}=x^4+x^3+x^2+x+1$ in $\mathbb{Z}$.    I can find four solutions. Is there another solution? I know that there are six solutions. $$(-1, \pm 1)\;,\;(0, \pm 1).$$  My try: \begin{align}   &amp; x^4+x^3+x^2+x+1=0\quad \Rightarrow \underbrace{\left( x+\frac{1}{x} \right)^2}_{t^2}+\underbrace{\left( x+\frac{1}{x} \right)}_{t}-1=0\,\Rightarrow t\notin \mathbb{Z} \\   &amp; x^4+x^3+x^2+x+1={\pm 1}^2\quad\Rightarrow \,x=-1\,\,,\,x=0.\\  \end{align}   Thanks. How do I distinguish between a command, utility, or builtin for getting documentation? Sort file by group of lines If I have a file with contents similar to:  FirstSection     Unique first line in first section     Unique second line in first section  SecondSection     Unique first line in second section     Unique second line in second section  ...  NthSection     Unique first line in Nth section     Unique second line in Nth section   Is it possible to use unix commands (e.g. sort, awk) to sort the file alphabetically by the first non-indented line in each three line group, whilst keeping the indented lines under their existing group? Why are image thumbnails cropped proportionally (not per dimensions)? For some reason WordPress is ignoring my thumbnail sizes and keeping thumbnails cropped proportionately instead of specific dimensions. Here is what I have in functions.php:  add_image_size( 'main-thumbnail', 728, 410, true );   and in content.php:  &lt;div class="thumbnail"&gt;     &lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;        &lt;?php the_post_thumbnail( 'main-thumbnail' ); ?&gt;     &lt;/a&gt; &lt;/div&gt;   I added these two things and regenerated my images with the  plugin, but it doesn't seem to matter. The images don't change.  For some reason WordPress isn't recognizing the hard crop and is keeping the images proportional, so some of my images are way taller than 410 pixels. Why is this? 'longtable' caption without incrementing 'table'? For reasons both complex and confusing, I would like to caption a longtable without incrementing the table counter in the process.  I want to have two consecutive longtable environments to be captioned with identical table numbers; i.e. one longtable captioned "Table x.y: Data Set (Part A)" and one captioned "Table x.y: Data Set (Part B)", with x.y being identical for both tables.  Apparently however, even \caption*{} command bumps table. I am a bit at a loss here.  Note: I know that the xtab package would enable me to have one long table with switches of headers and captions mid-table. However I got a (different) problem with that package, akin to  but sadly not solved by egreg's answer there; so this question should be considered longtable-only as xtab, supertabular etc. don't float my boat right now. :-( Check for internet connection with Swift Can only search social network messages in the Dash after 13.10 upgrade I accidentally committed an unwanted file (filename.orig while resolving a merge) to my repository several commits ago, without me noticing it until now. I want to completely delete the file from the repository history.   Is it possible to rewrite the change history such that filename.orig was never added to the repository in the first place? Bijection from $\mathbb R$ to $\mathbb {R^N}$ How does one create an explicit bijection from the reals to the set of all sequences of reals? I know how to make a .  I have an idea but I am not sure if it will work. I will post it as my own answer because I don't want to anchor your answers and I want to see what other possible ways of doing this are. What cd/dvd burning software should I use? I have tried countless cd/dvd burning software on ubuntu 12.04 and none of them work for me,  any ideas guys?   I've tried tovidgui, bombono dvd,and mestelix, they are all so very confusing is there any program like dvdflick that is just straight to the point?