Is there an easy way to make a group of variables in a class as public. For example to make a group of variables as static, I can use something like below.
class A {
    static {
        int x;
        int y;
    }
}
Is there a way to do something similar to make the variables as public. Something like this.
public {
        int x;
        int y;
        }
Edit:
I understood that the static block doesn't do what I supposed it will do. What I need is a java version of something like this in C++
 class A {
      public:
          int x;
          int y;
  }
 
     
     
     
     
    