Getters/Setters are used to expose access to private member variables.

Here's an example of a getter/setter for foo in your class above:
Code:
public int getFoo()
{
  return this.foo;
}
public void setFoo(int newfoo)
{
  this.foo = newfoo;
}
The primary use of getters and setters is data validation.

A Java bean is well more than a simple struct-style element. It is really meant to allow you to write a piece of code once, and run it everywhere (applets, desktop apps, JSP, etc). Basically let's say you have a class that deals with outputting customer data. You might have this class written once but be using it on your secured site via JSP, in a desktop Java app, or in a Java applet served from the web.

The FAQ for Java Beans is here: http://java.sun.com/products/javabea...q.general.html