Basic HTML version of Foils prepared Aug 14 1997

Foil 3 Our first example: HelloBean!

From JavaBeans Examples UC Web applications Certificate -- Aug 11,14 97. by Nancy McCracken


To a standard hello world Java class, we add a (read/write) property by defining get and set functions in the correct pattern.
import java.awt.*
public class HelloBean extends java.applet.Applet
implements java.io.Serializable
{ String sname = "World";
public void setName (String newname)
{ sname = newname; }
public String getName ( )
{ return sname; }
Enables saving as Object
Class variable for value of property
Get and set methods define a property called Name with a value of type String



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Thu Jan 8 1998