First Class which is the main class  public class JavaMethod {     public static void main (String[] args){          JavaMethod javaMethod = new JavaMethod();         javaMethod.makeChoice();      }      public void makeChoice(){         Scanner console = new Scanner(System.in);          System.out.println("Enter S, T or C");         String stc = console.nextLine();          switch (stc){             case "S":                 Student student = new Student();                 student.makeChoice();                 break;             case "T":                 Teacher teacher = new Teacher();                 teacher.makeChoice();                 break;             case "C":                 College college = new College();                 college.makeChoice();                 break;             default:                 System.out.println("Invalid");                 makeChoice();         }     } }   Second class to store values  public class StudentInformation {      String name;     String grade; }   This is my service class where I've the problem. While running the method printStudent(); of this class i get following error:     Exception in thread "main" java.lang.NullPointerException     at STCAssignment.Student.printStudent(Student.java:76)     at STCAssignment.Student.makeChoice(Student.java:31)     at STCAssignment.Student.addStudent(Student.java:66)     at STCAssignment.Student.makeChoice(Student.java:28)     at STCAssignment.JavaMethod.makeChoice(JavaMethod.java:25)     at STCAssignment.JavaMethod.main(JavaMethod.java:12)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:606)     at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)  public class Student {      int i =0;     StudentInformation[] studentInformation = new StudentInformation[0];        int makeChoice(){         Scanner console = new Scanner(System.in);         i = i +1;         studentInformation = new StudentInformation[i];          System.out.println("Do you want to continue(Y/N");         String yesNo = console.nextLine();          if (yesNo.equalsIgnoreCase("Y")){             System.out.println("Add or Print(A/P)");              String addPrint = console.nextLine();              if (addPrint.equalsIgnoreCase("A")){                 addStudent();              } else if (addPrint.equalsIgnoreCase("P")){                 printStudent();              } else {                 System.out.println("Invalid");                 makeChoice();             }          }else if (yesNo.equalsIgnoreCase("N")){              System.exit(0);         } else {             System.out.println("Invalid");             makeChoice();         }          return i;      }      public void addStudent(){         int i = 0;          StudentInformation info = new StudentInformation();         Scanner console = new Scanner(System.in);          System.out.println("Enter Students name");         info.name = console.nextLine();         studentInformation[i]=info;           System.out.println("Enter Students grade");         info.grade = console.nextLine();         studentInformation[i]=info;          i = i + 1;         makeChoice();     }      public void printStudent(){          for (int j =0; j&lt;studentInformation.length; j++){             StudentInformation info = studentInformation[j];              System.out.println("Student name:"+info.name);             System.out.println("Student grade:"+info.grade);         }          makeChoice();     } }   How to solve it?
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?
Are there uncountably many surjections from $\mathbb N$ to $\mathbb N$? Statement: There are uncountably many surjections from $\mathbb N$ to $\mathbb N$.  Is the following proof valid:  The real numbers are uncountable.   There exists a bijection between the set of real numbers and the set of all functions from $\mathbb N$ to $\{0,1\}$.   Given a function, $f$, from $\mathbb N$ to $\{0,1\}$, construct a surjection from $\mathbb N$ to $\mathbb N$, denoted $g$, as follows:  We map the $n$th composite number to $n$, and the nth prime, to $f(n)$.   Clearly this is a surjection since the composite numbers are countable. Clearly different functions $f$ lead to different surjections $g$. Since there are uncountably many $f$s, there are uncountably many surjections $g$. I was wondering. If I have a bilinear symmetric form, it is easy to find its matrix. But, when I have a quadratic form, which is the procedure to do that?  I heard that one possibility is: If $q$ is my quadratic form, then $$f(x,y) = \frac{1}{4}q(x+y) - \frac{1}{4}q(x-y)$$ is the bilinear symmetric form associated, so the method reduces to find the matrix of $f(x,y).$   The point is that seems a little noising... How to find, in practice, the matrix of quadratic form?  Thanks in advance. Best way to do multi-row insert in Oracle? I'm looking for a good way to perform multi-row inserts into an Oracle 9 database.  The following works in MySQL but doesn't seem to be supported in Oracle.  INSERT INTO TMP_DIM_EXCH_RT  (EXCH_WH_KEY,   EXCH_NAT_KEY,   EXCH_DATE, EXCH_RATE,   FROM_CURCY_CD,   TO_CURCY_CD,   EXCH_EFF_DATE,   EXCH_EFF_END_DATE,   EXCH_LAST_UPDATED_DATE)  VALUES     (1, 1, '28-AUG-2008', 109.49, 'USD', 'JPY', '28-AUG-2008', '28-AUG-2008', '28-AUG-2008'),     (2, 1, '28-AUG-2008', .54, 'USD', 'GBP', '28-AUG-2008', '28-AUG-2008', '28-AUG-2008'),     (3, 1, '28-AUG-2008', 1.05, 'USD', 'CAD', '28-AUG-2008', '28-AUG-2008', '28-AUG-2008'),     (4, 1, '28-AUG-2008', .68, 'USD', 'EUR', '28-AUG-2008', '28-AUG-2008', '28-AUG-2008'),     (5, 1, '28-AUG-2008', 1.16, 'USD', 'AUD', '28-AUG-2008', '28-AUG-2008', '28-AUG-2008'),     (6, 1, '28-AUG-2008', 7.81, 'USD', 'HKD', '28-AUG-2008', '28-AUG-2008', '28-AUG-2008'); SSH in shell script with password How to do multiple lines within braces? I'm trying to determine the best way to truncate or drop extra decimal places in SQL without rounding.  For example:  declare @value decimal(18,2)  set @value = 123.456   This will automatically round @value to be 123.46, which is good in most cases.  However, for this project, I don't need that.  Is there a simple way to truncate the decimals I don't need?  I know I can use the left() function and convert back to a decimal.  Are there any other ways? What would make a question popular with high views? I was wondering what might be making my questions less attractive to users?  I get very low views most of the time. What should be done to increase a question's popularity? What is a *.pkinfo file?   Google Search results talk about Package Info files and how they contain map documents and layers, so I don't see how this is different from a .mpk file.    I also have not found anything about how to create a *.pkinfo file. What are good reasons to prohibit inheritance in Java, for example by using final classes or classes using a single, private parameterless constructor? What are good reasons of making a method final? Typesetting linguistic rewrite rule I'm trying to (more or less) replicate this phonological rewrite rule:    I'm using the package , and what I manage to accomplish is this:  \documentclass{article} \usepackage{phonrule} \begin{document}  \phonc     {\phonfeat{$-$cnt\\ +hi}}     {[$\alpha$grv]}     {\oneof{%         \phonfeat{$-$cnt\\ $\alpha$grv}\phold\\         \phold\phonfeat{$-$cnt\\ $\alpha$vce}%     }}  \end{document}     My main problem here is what appears after the "when" slash:  (1) The package only provides a left curly bracket - how can I add a right one as well?  (2) The two options within the curly brackets are not well aligned. I think comparing the two pictures themselves says it better than what I could do with words. Disclaimer Yes, I am fully aware that what I am asking about is totally stupid and that anyone who would wish to try such a thing in production code should be fired and/or shot.  I'm mainly looking to see if can be done. Now that that's out of the way, is there any way to access private class members in C++ from outside the class?  For example, is there any way to do this with pointer offsets? (Naive and otherwise non-production-ready techniques welcome) Update As noted in the comments, I asked this question because I wanted to write a blog post on over-encapsulation (and how it affects TDD).  I wanted to see if there was a way to say &quot;using private variables isn't a 100% reliable way to enforce encapsulation, even in C++.&quot;  At the end, I decided to focus more on how to solve the problem rather than why it's a problem, so I didn't feature some of the stuff brought up here as prominently as I had planned, but I still left a link. At any rate, if anyone's interested in how it came out, here it is:   (I suggest reading it before you decide that I'm crazy). Decorating Python class methods - how do I pass the instance to the decorator? How to get rid of navigation symbols in beamer? I am a EE grad. student who has had one undergraduate course in real analysis (which was pretty much the only pure math course that I have ever done). I would like to do a self study of some basic functional analysis so that I can be better prepared to take a graduate course in that material in my university. I plan to do that next fall so I do have some time to work through a book fully. Could some one recommend some good books to start working on this?   Thanks in advance Prove that the additive groups $\mathbb{R}$ and $\mathbb{Q}$ are not isomorphic. Is there a better (or other) way(s) to prove the following statement? Also, the same argument works for multiplicative groups $\mathbb{R}-\{0\}$ and $\mathbb{Q}-\{0\}$, right?       Problem Prove that the additive groups $\mathbb{R}$ and $\mathbb{Q}$ are not isomorphic.   Solution By cantor's diagonal argument, there is no possible bijection between $\mathbb{Q}$ and $\mathbb{R}$. Since an isomorphism needs to be a bijection, there is no possible isomorphism between the additive groups $\mathbb{R}$ and $\mathbb{Q}$.    Thanks What equipment and settings do I use for panning shots of moving objects? This is something I've been curious about since starting this whole 'meta' thing a couple years back.     Let's say a user posts a feature request.   Under what circumstances is the feature-request read by staff? If staff decline to do anything (I'd guess it's some sort of triage), under what circumstances is the feature-request reevaluated by staff?     Let's say a user posts a bug.    Under what circumstances is the bug tested? What generally determines whether a verified bug is actionable? (And/or what are the criterion for deciding what to do?)     For both of the above, would it be possible to see a general-but-relatively-detailed flow for what happens to these questions? Which close reason should I use for questions that do not demonstrate research effort? I regularily encounter questions on StackOverflow which are asked only because of the sole fact that the poster haven't made the effort to google for and the docs of a particular function/class/framework/whatever. My question is, to which category of the five proposed one should I vote when I vote to close the question? Is it: off-topic, not constructive, not a real question, exact dupe or too localized? I tend to be all for 'not a real question' - am I quite right? I'm trying to make a logo that will be on the header of a website. What I'd like to achieve, and the reason I'm using Blender, is the projected shadows on the background looking perfectly real (as opposed to doing a drop-shadow in Photoshop).  The only thing is, the background has to be transparent because the website might use different background colors / gradients that make it impossible to match with the exported 3D background.  I made this dummy file (not the real logo... duh!):    If I use the file as is, the grey borders of the image will be impossible to match with the website's background color.  Here what I want:    So obviously, I tried masking the plane, which made the shadows disappear. I tried having a plane set to glass, which didn't work either.  And I looked around for a similar question, but didn't find one.   I am not trying to render , or a . I've seen  which has a very difficult solution to this problem, and  that is very similar but in Blender Internal.  is similar too but has never been solved. I'm only a beginner at Compositor, and I'm trying to learn more any chance I get, so any solution in Compositor is welcome if detailed enough. Although if there's a simpler or faster way, it's welcome too!  .blend file: The difference between two periodic functions converges to zero, is this two functions identical?