Ask Question

The programmer must initialize variables when they are declared

+3
Answers (1)
  1. 22 July, 17:06
    0
    Answer: When you declare a variable, you should also initialize it. Two types of variable initialization exist: explicit and implicit. Variables are explicitly initialized if they are assigned a value in the declaration statement. Implicit initialization occurs when variables are assigned a value during processing.

    Explanation:

    For example, in jа vascript

    var PaintAmount = 50; - declare and initialize

    function setup () {

    creatCanvas (200, 200);

    }

    function draw () {

    ellipse (PaintAmount, PaintAmount) - use the variable PaintAmount

    }

    or rather in Java,

    package random;

    public class something () {

    Public static void Main (String []args) {

    string name; / / this is declaring the variable with the example type

    string name = new string; / /this initializes the declared variable

    }

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “The programmer must initialize variables when they are declared ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers