The Best Variable X Might Not Have Been Initialized References. } } the java compiler. Giving the varaibles initial values just to get it to compile is the wrong approach.
variable might not been initialized? (programmieren, Informatik, Java) from www.gutefrage.net
If if statement fails, this variable will stay uninitialized: Variable c might not have been initialized. Welcome to the ranch you have been given the answer;
If (Condition) { X = 5;
} } the compiler strictly enforces the standard and notifies you about having breaking one of its rules with the error: As such, the variable of x may not get initialized. You can solve your problem by setting the string value to null and your int value to 0.
If You Get That Compiler Error, The Implication Is That There Might Be Something Wrong With Your Logic.
Perhaps it will have been initialized in the way you have configured your application, but the compiler doesn't know that. It is a local variable, and local variables are not initialized by default. User management is very complex, when implemented properly.
Jul 30, 2007 10:24Am Edited Jul 30, 2007 11:47Am In New To Java.
Because it is not accounting for variable values, the compiler sees the possibility that the if. So you need to explicitly assign some default value to them. If you set that variable to null you will fix this error.
This Is A Totally Meaningless Method Just To Demonstrate The Problem.
Of course if there does exist a real control flow. If (time == 3) { setimage (shankmove2.jpg); There are two ways to view the tradeoff that java adopted:
Variable Might Not Have Been Initialized 1.
Let's take a look at. } } the java compiler. Public void act () { int time;
Berbagi
Posting Komentar
untuk "Variable X Might Not Have Been Initialized"
Posting Komentar untuk "Variable X Might Not Have Been Initialized"