Why?


#1

Why would anyone want to use an undefined variable? What is its purpose in a Java project?





#2

There are a number of reasons to declare variables uninitialized. Here is a very simple pseudocode example of one

int a = 5;
int b = 10;
int temp;

temp = a;
a = b;
b = temp;

We used the uninitialized variable temp as a placeholder to swap a and b’s values
temp never really needed a definition


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.