Menu

Java Learning series | Day - 3
📰

Java Learning series | Day - 3

DEV Community: java·Ajay·2 days ago
#U0Ji1leb
#devtojava#devto#dev#static#name
Reading 0:00
15s threshold

What is variable ?

It is Container used to store the value with a unique name.

Java is statically typed , so every variable must be declared a specific data type before it can be used. Syntax

String name = "Ajay"; int age = 20;

Enter fullscreen mode

Exit fullscreen mode

here,

Right side of assignment operator (=) is value,

left side of assignment operator (=) is variable,

Here the Value(Ajay) is stored in the variable (name),

In memory the value is only converted into bit and stored, not an variable, varaible is an identication of the value were we stored in the memory.

Rule of creating a variable?

Variable are Case Sensitive (age and Age are differect).

Variable name should not start with digits,It must begin with a valid identifier-start character, such as a letter, _, or $.

No reserved keyword are used as variable name.

Variable name cannot contain space.

Variable name should be meaningful name.

Type of variables

Local variables

Local varibales are created only inside the methods ,…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.