I'm having a bit of a problem with Java, and it's starting to become rather unpleasant.
In general I hate (Like really, *hate*) Java (I prefer C#), but I have to do it at school.
Now can anyone see *any* problem with the code below?
Because it keeps printing "Exception: java.lang.NullPointerException", and I cannot for the life of me figure out why.
Any ideas?
BTW, if it makes any difference, I'm running Java 1.6, Netbeans 6.7, Windows 7.
In general I hate (Like really, *hate*) Java (I prefer C#), but I have to do it at school.
Now can anyone see *any* problem with the code below?
Code:
try
{
int amount = Integer.getInteger("150");
System.out.println("You entered "+amount);
}
catch (Exception e)
{
System.out.println("Exception: "+e.toString());
}
Any ideas?
BTW, if it makes any difference, I'm running Java 1.6, Netbeans 6.7, Windows 7.