“final” modifier

Reference: Learn Java Tutorial 1.27- The Final Modifier

public class StartingPoint {
	//final static variables (denoted by all uppercase letters):
	final static String DATABASE_NAME = "BAM1234IRULE"; /**final static variables; want to setup for actual class itself; because working with static variable -> for whole class*/
	final static double GRAVITY = 9.81; /**constant, never going to change*/

	public static void main(String args[]) { /**This is what compiler looks for*/

		//final variables:		
		final int number = 21; /**Because this is "final", cannot reassign this variable later in the program*/
		/** "number = 200;" <- cannot happen because the 'number' variable was "final"*/




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s