Is there a way in java to do something similar to this:

class Rectangle
{
   public:
      int x;
      string y;

   private:
      int a;
      string b;
}

Or do you always have to specify public/private for each property?

No..You cannot use the shortcut method. :)
You need to specify the access specifier for each member variable separately with patience..

But it will be nice if oracle make changes like what you have said..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.