Java and primitives
-
It irritating enough Java requires you to initialize primitives, but then do it wrongly?...
They're just primitives, who cares?
-
Why is the 2nd "y" not capitalized?
-
- String is not a primitive. Strings are objects with convenient syntax.
- The root class of throwable objects is Throwable, not Exception.
- Therefore u may not be initialized.
-
Hu? If in.next(...) throws an Exception which does not extend Extension, then u will be uninitiaziled in the if(!u) line.
Only wtf is that Exception is not the root of the java exception type system. To fix it, change Exception to Throwable
-
Thread moved to "Coding Related Help & Questions", since there is no actual WTF.
-
String u = null;
TRWTF is you. Learn Java.
-
Just to flame it...
TRWTF is the compiler not doing it for you :p
-
@ubersoldat said:
That doesn't even solve the problem, though, because it'll throw an NPE at the u.equalsIgnoreCase.String u = null;
TRWTF is you. Learn Java.
-
-
@teqman said:
1. String is not a primitive. Strings are objects with convenient syntax.
Err, I knew that. Don't know what got into me...
@teqman said:
2. The root class of throwable objects is Throwable, not Exception. 3. Therefore u may not be initialized.
That makes sense actually
-
@ubersoldat said:
String u = null;
TRWTF is you. Learn Java.
This is the easy fixed propogated by people that don't understand the real reason that compiler error appears, and who think they are smarter than the compiler.