helloMessage variable is declared as a local variable: : Variables « Language « Java Tutorial






public class MainClass
{
    public static void main(String[] args)
    {
        String helloMessage;
        helloMessage = "Hello, World!";
        System.out.println(helloMessage);
    }
}








1.9.Variables
1.9.1.Variables
1.9.2.Variable Dynamic Initialization
1.9.3.Demonstrate lifetime of a variable
1.9.4.shows the proper way to declare a class variable named helloMessage
1.9.5.You don't have to place class variable declarations at the beginning of a class.
1.9.6.helloMessage variable is declared as a local variable: