> For the complete documentation index, see [llms.txt](https://heunnajo.gitbook.io/java/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://heunnajo.gitbook.io/java/class-variable-and-instance-variable.md).

# Class Variable and Instance Variable

When make "Card" class, the **width and height is same and common**. The pattern and number are different.&#x20;

```java
class Card {
    String pattern;
    int number;
    
    static int width = 100;
    static int height = 250;
}
```

* **Class Variable(static variable, sharing variable)**

**Common properties all Instances have.** ex) width, height

```java
Card.width = 200;
Card.height = 300;

Card c = new Card();
//가능은 하지만 권장하지 않는다
//c.width = 200;
//c.height = 300;
```

* **Instance Variable**

**Individual properties.** ex) pattern, number

```java
Card c = new Card();

c.pattern = "HEART";
c.number = 5;
```
