# Variables

## Static/class Variables

Single instance which is shared by all the classes. Sort of a global variable bound to the class where it is defined.

Try to use them as final, which makes them into constants.

```java
public class SomeClass {

   public static final String constantValue = "Some text";

}
```

## Instance Variables

Each instance of the class will have their own copy of the variable.

```java
public class SomeClass {

   private String value = "some value";

}
```

## Local Variables

Declared inside methods:

```java
public final void someMethod() {
   final String value = "some value";
}
```

## Parameters

Received by methods:

```java
public final void someMethod(final String value)
```

## More Information

* [Java Variables](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bernardo.gitbook.io/development-docs-java/beans/variables.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
