I am trying to create a custom class Student, which contains 2 fields, Name and Marks. I read on the internet that I need Getters &amp; Setters to do so. So, I wrote the following code but it is giving me a NullPointerException. import java.util.*;  class Student {     public String name;     public int marks;     public int getMarks()     {         return this.marks;     }     public void setMarks(int marks)     {         this.marks = marks;     }     public String getName()     {         return this.name;     }     public void setName(String name)     {         this.name = name;     } } public class getterSetter {     public static void main(String[] ab)     {         Scanner s = new Scanner(System.in);         int n = s.nextInt();         int x;         Student[] student = new Student[n];         String[] inputs = new String[n];         s.nextLine();         for(int i = 0; i &lt; n; i++)         {             String xx = s.nextLine();             inputs[i] = xx;         }         for(int i = 0; i &lt; n; i++)         {             String[] words = inputs[i].split(&quot;\\s+&quot;);             student[i].setName(words[0]);             student[i].setMarks(Integer.parseInt(words[1]) + Integer.parseInt(words[2]) + Integer.parseInt(words[3]));         }         for(int i = 0; i &lt; n; i++)         {             System.out.println(student[i].getName());             System.out.println(student[i].getMarks());         }     } }  The console screen is : java getterSetter 3 abc 10 10 10 def 10 10 10 ghi 10 10 10 Exception in thread &quot;main&quot; java.lang.NullPointerException         at getterSetter.main(getterSetter.java:58)
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?
Can I open Microsoft Word and Excel files with Ubuntu? SF Short Story: alien apes invade during nuclear war Rendered image doesn't show what Rendered Viewport shows... (pictures below) What are Extension Tubes? What are Extension Tubes? How do I stop sharing call history between two iPhones? My husband and I both just upgraded to iOS 8.3.  Now I notice that if I have a missed call it shows up on his notice screen and all my calls show up in his recent call history (and vice versa).  Both phones don't ring and they don't need to be near each other or connected by Wi-Fi.  We do share an iTunes account.  How do I stop sharing call history between the two phones? Infinitely differentiable function with given zero set? Placing point over pixel with maximum value falling in grid overlay using QGIS Show rigorously that the sum of integrals of $f$ and of its inverse is $bf(b)-af(a)$ How does a Support Vector Machine (SVM) work? Transposing rows and columns I have a file with the lines like below.  title1:A1 title2:A2 title3:A3 title4:A4 title5:A5  title1:B1 title2:B2 title3:B3 title4:B4 title5:B5  title1:C1 title2:C2 title3:C3 title4:C4 title5:C5  title1:D1 title2:D2 title3:D3 title4:D4 title5:D5  How can I achieve this?   title1    title2     title3    title4 A1         A2         A3         A4 B1         B2         B3         B4 C1         C2         C3         C4 D1         D2         D3         D4 Fast way to find period-n points of a tent map? I need to find a period-3 orbit for a tent map defined by $$T(x)=\begin{cases}2x &amp; 0\le x\le0.5 \\[2ex] 2-2x &amp;0.5 &lt; x \le 1 \end{cases}$$  So, what is a fast and efficient way of finding it? I only know how to do it by guessing-and-checking. For example, I picked a random point, $x = \frac{2}{7}$ and found that $$T\left(\frac{2}{7}\right)=\frac{4}{7}\\[4ex]T\left(\frac{4}{7}\right)=\frac{6}{7}\\[4ex]T\left(\frac{6}{7}\right)=\frac{2}{7}$$ which is a period-3 orbit. Is there any better way of finding a period-3 orbit , more specifically, a period-3 point? What is the difference between sector and cluster? I have gone through wikipedia and other sites and here's the information I have obtained.  Sector: Smallest Addressable Unit (mostly 512 bytes) Cluster: Smallest Allocation Unit (equals to 1 or more sectors and the number of clusters depends on the file system).  Let's say in the below example:  sector =512 bytes and a cluster =8 sectors=4096 bytes. Now, I am having a hard time figuring out, when I am trying to create a file what does the file system do? Does it consider 4096 bytes as the smallest write/read unit or 512 bytes?  If the answer is 4096 bytes: When the manufacturer of the disk drives has provided 512 bytes as the smallest addressable unit, why does the file system consider cluster as the smallest unit? I mean, what are the advantages in doing so? How add 14 days on end date I have End Date column and I want to add 14 Days on it auto when created, can I do it by workflow? Can I do it via jQuery. If yes how? if no how I can do it? What does the phrase "begging the question" really mean? And does it even matter if I use it correctly? Almost everyone just uses it as a synonym for "posing the question" these days. Can polymorphing monsters spam their ability to effectively give themselves a massive health pool? Some creatures have an ability that lets them polymorph, such as the Couatl's Change Shape action. I am wondering if this ability could be used again whenever the form is dropped to give the creature a massive effective health pool.  For example, if the Couatl used their action to Change Shape and become a Veteran, then was hit for enough damage to kill the polymorphed form, could it then re-use the Change Shape ability to transform into a fully healed Veteran once more? Travelling with two different passports I was just wondering if you have two passports (a Chinese one and an Australian one), and you booked your airline ticket with the Chinese one, will you have to show both of your passports or just one?  The thing is, on my Chinese passport, it has my birth name, but then when I became an Australian citizen, I legally removed my Chinese name and replaced it with my English name. So I don't know whether I should just show the passport officials the one that I booked the airline ticket with. Upgrade OpenSSH 7.4 to later on RHEL I have a Red Hat Enterprise Linux server (7.5 x86_64). I have OpenSSH version 7.4. I was asked to upgrade it to a later version for security reasons: Nessus states that . However the Red Hat software and downloads does not have the latest package RPM.  I found some clues on where to get the latest package for OpenSSH. I found , however, I do not know on how to upgrade it and trust this website. I do not want the SSH and other configuration to be modified by the ugrade.  I did find links but however they are not useful, for example .  I would like to know how to upgrade OpenSSH without using yum. Will grammar errors become correct after enough people use them for enough time? Why use apparently meaningless do-while and if-else statements in macros? How can I unlock my phone? I locked it using Android Device Manager, but it claims I entered a wrong password I have an Samsung Galaxy S3 Neo.  Bus 002 Device 042: ID 04e8:6860 Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II], GT-I9300 Phone [Galaxy S III], GT-P7500 [Galaxy Tab 10.1]   The keyboard &amp; language setting is português.  I today installed Android Device Manager and to test it's functionality I locked the phone with the password: "abcd" (4 letters were required).  After entering the password and confirming with the "OK" button of my keyboard, the phone showed me that the password is wrong. "Senha incorreta".  I reset the password after some tries to "123456" and the phone reloaded the lock screen. Again the password showed up to be wrong. I also tried the alphabetic password: "abcdefg" - same error.  I changed the language of my Google account from German to Portuguese and reset the password to "123456" again and I tried to really reboot my phone and unlock the SIM card again. But anyways I can not get through my lock of the Android Device Manager.  I tried to enter the password 35 times wrong with hope to get a chance to authenticate with my Google Account login.  I also tried to connect the phone with adb but it does not show up in this state with:  adb devices   So what can I do to get access to my phone again?