package javaapplication6;
public class JavaApplication6
{
public static void main(String[] args)
{
String s = null;
s += "ASDF";
System.out.println(s);
}
}
The single fact that, just to run the goddamn program, I have to create a folder named javaapplication6 with a file name JavaApplication6.java (both case sensitive), compile it and call it with "java -cp . javaapplication6.JavaApplication" makes me want to punch the language creators in the face.
No matter what people tell me about it, to me Java is bad design decision after bad design decision. I've used some decent software written in it (tomcat, weka) and the greatest memory I have is the complete pain the setup was.
I have no idea.. but it SHOULD throw an exception the moment you try to += anything to a null value. I doubt it does, but I've never had a reason to learn Java.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
dandymcgee wrote:I have no idea.. but it SHOULD throw an exception the moment you try to += anything to a null value. I doubt it does, but I've never had a reason to learn Java.
That is exactly what I thought. I can get past the fact that it allows it to happen... but I cannot get past what the actual result is.
<tpw_rules> LightDark: java is a consequence of inverse moore's law: every 18 months, the average program will be twice as slow. therefore, computers always run at the same percevied speed. java's invention was a monumental step
bbguimaraes wrote:Well, I just tried it in javascript and it seems it inherited other things besides its name...
Yeah.. but JavaScript breaks literally every existing language rule and paradigm. It's both extraordinarily flexible and ridiculously illogical at the same time.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
That is absolutely fucking bizarre... I mean, obviously any JIT language has to be pulling some behind-the-scenes bullshit to even implement the concept of a "null reference" (a reference is implemented as an autodereferenced pointer, so a "NULL" reference is technically impossible).
and have it print out something sensible in all cases, including where x is null. There is no value of x other than null where that line ought to fail (all objects have a toString() method, and primitives have their own conversions), unless exceptions are thrown in x.toString(). So instead of making it cause a catastrophic program failure, it just converts it to a string value signifying its value: "null".
I still think it's less insane than PHP's false == "no" stuff.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.