don't use public attributes, use getters and setters
This can be read everywhere and everybody knows that. But why? What is the reason behind that? Well...
It's because you don't want people to flatten your cat.8-O
Ok here is your code :
public class Cat {
public int size;

And here is your buddy's code :
public static void main(String args) {
Cat myCat = new Cat();
myCat.size = 0;

Here we are. Now the poor cat looks like a pile of pancake. Weight watchers pancakes even.
The goal of writing getters and setters (right names for these actually being accessors and mutators, but who cares) is to protect the cat from the being flattened :
public class Cat {
private int size;
public int getSize() {
return size;
public void setSize(int size) {
if(size > 5)
this.size = size;

The cat cannot be flattened. The size attribute is private and can be changed only via the setter.
This concept seems pretty straightforward. However, it is one of the main reason the 3 tiers architecture is so successful these days :
View <-> Business comps <-> Data
Instead accessing the data directly, you have to use the business components to modify the data, and those business components contain the business rules and prevent some crazy things to happen on the data !

Getters and setters in Eclipse