Computer Science

Why do you need to declare variables? Explain.

Values & Data Types Java

1 Like

Answer

Declaring a variable tells Java how much memory it should reserve for storing the variable. Declaring a variable also helps in preventing errors as the compiler can check and flag illegal operations at compile time itself.

Answered By

3 Likes


Related Questions