Data default values Viva-question – CSKC
Sign In

Search

Solved Problem #JAVA#3875    siteicon   siteicon  

Problem Statement - Data default values Viva-question

Why do we need to initialise local variables when we have default values specified for all primitive data types.

Solution

TC++ #3875

×

Ask AI About This Code

Default Prompt that is passed along with the code is given below, You can write your own prompt if you so desire.



×

Test Java

Java does not allow default values for local variables so that the programmer is forced to use the known values of variables and accidentally processing the incorrectly value is reduced. For static and instance variables they may have to be used by many discrete methods so default values are useful.


Share

Created: 21-Mar-2018 13:53 | Updated: 21-Mar-2018 16:45|