---
title: "Static modifier"
author: "fantasyday"
date: "2009-06-30T16:12:51Z"
tags: []
slug: "static-modifier"
draft: false
lastmod: "2009-06-30T16:12:51Z"
id: 417709
url: "https://fantasyday.iteye.com/blog/417709"
---

public class Static {  
    static int x = 0 ;  
    public static void main(String\[] args) {  
        Static a = new Static();  
        Static b = new Static();  
        System.out.println(b.x);  
        a.x = 1;  
        System.out.println(b.x);  
    }  
}

 

result:

0

1

 

The following warning is ignored anyway...

The static field Static.x should be accessed in a static way