- /**
- * Defines what Boys can do: talk.
- *
- * @author TK Rogers
- * @version 7-28-11
- */
- public class Boys
{
- // speaker
is an object or instance,
- // in
this case an object of the Boys class.
-
public static Boys speaker = new Boys ( )
;
// The String girlTalk contains data that's accessible to Girl objects by using the talk method.
private String guyTalk = "Hello from the Boys class." ;
-
- //
The segment of code below is called a method,
- // in this
case the talk method.
-
public void talk ( ) {
-
System.out.println ( guyTalk
) ;
- }
- }