Java variables definition exists in { } curly braces…

One of the biggest challenges facing “newbies’ to the language of Java and Android programming is understanding the structure of the Java language itself when it comes to variables being defined with curly braces “{ }” of code. Member variables can have the same name throughout the program however, their definition only pertains to the definition within specific curly braces of the respective part of the code…

private void startStory(String name) {
Intent intent = new Intent (this, StoryActivity.class);
intent.putExtra(“name”, name);
startActivity(intent);
}

So in this part of code, the variable name may pass data and have a specific definition within this set of curly braces “{ }” however name can take on a whole new definition within another set of curly braces “{ }” and function entirely differently elsewhere in the Java program.

From a linguistic point of view, the only parallel that a Java “newbie” can make to this type of Java structure is the context of a word and how it is used to convey a message which is subject to vernacular nuances and other elements of common language.

Leave a Comment

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s