Java Code

import javax.swing.*;
import java.awt.*;
public class HiWorldWithMethods extends JApplet
{
	// declare instance variables here
	int x = 0;
	int y = 12;
 	public void paint ( Graphics grph )
	{
 		super.paint( grph );
 		String text = "Hello World";    // local variable
 		anotherMethod( grph );
	}
	public void anotherMethod( Graphics g )
	{
	  g.drawString ( text, x, 50 );   // won't work!
	}
}

©2007- by E.S.Boese. All Rights Reserved