0% found this document useful (0 votes)
35 views1 page

Types of Variables: Instance Variable: Class Variables

This document discusses different types of variables in programming. It defines instance variables as non-static fields unique to each class instance, and class variables as static fields that have a single copy shared across all instances of a class. Local variables are declared within a method, and parameters refer to the arguments passed to a method or constructor. The document also covers naming conventions, recommending variable names start with a letter, avoid special characters, use underscores to separate words for constants, and not use keywords or reserved words.

Uploaded by

Utkarsh Thakkar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views1 page

Types of Variables: Instance Variable: Class Variables

This document discusses different types of variables in programming. It defines instance variables as non-static fields unique to each class instance, and class variables as static fields that have a single copy shared across all instances of a class. Local variables are declared within a method, and parameters refer to the arguments passed to a method or constructor. The document also covers naming conventions, recommending variable names start with a letter, avoid special characters, use underscores to separate words for constants, and not use keywords or reserved words.

Uploaded by

Utkarsh Thakkar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Types of Variables

Instance Variable: Non-static fields are also known as instance variables because their values are unique to each instance of a class. Class Variables: A class variable is any field declared with the static modifier; this tells the compiler that there is exactly one copy of this variable in existence; regardless of how many times the class has been instantiated. Local Variables: Variables between the opening and closing braces of a method. Parameters: The Arguments of a method or a constructor.

Naming Conventions
By convention it should start with the letter. Avoid $ and _ characters in the names. Whitespaces are not allowed. Keyword or any reserved word should not be used. For constants separate the words with the _.

You might also like