Declaring variables and constants, in its simplest form, means that you provide a statement that creates the named memory space.
The exact format varies depending on the language you are using.
Visual Basic, Java, Java Server Pages, and C++ are known as strongly typed languages. That means you must define what the data type is at the same time you declare the variable. Also, you tend to see scope as part of the declaration:
Visual Basic Java, JSP, C++ Dim FirstName as String
Public JobTitle as String
Private StartDate as Date
Public String JobTitle;
Private Date StartDate;
One additional thing you can do with .Net, Java, JSP, and C++ is initialize the value of the variable when it is declared
Visual Basic Java, JSP, C++ Dim FirstName as String = "Joe"
Public JobTitle as String = "Computer Programmer"
String FirstName = "Joe";
Public String JobTitle = "Computer Programmer";
These are handled very differently
Visual Basic, ASP, VBScript Java, C++ Const PI As Double = 3.1415926 Final Double PI = 3.1415926
For Visual Basic, use the TypeName function:
ThisVariableType = TypeName(FirstName)
For Java, use the instanceof comparison operator:
variableName instanceof dataType
firstName instanceof String