Declaration

noun

say it: “dek-luh-RAY-shun” /ˌdɛkləˈreɪʃən/

The line that introduces a new variable, method or class by giving it a type and a name, so the rest of the code can use it.

What is Declaration in Java?

Declaration — A statement that introduces a variable, method, class, or other named item.

class Game {
    void updateScore() {
        int score = 10;
        score = score + 5;
    }
}

In a sentence

  • “The declaration String city; tells Java a text variable called city exists, though it holds nothing yet.”

Level: Novice · More Java terms at this level

Updated

In other subjects