- /**
- * Defines what Girls can do: talk.
- *
- * @author TK Rogers
- * @version 7-28-11
- */
- public class Girls {
- // speaker is an
object or instance, in this case an
object of the Girls class.
- public static
Girls speaker = new Girls ( ) ;
// The String girlTalk contains data that's accessible to Girl objects by using the talk method.
- private String girlTalk = "Hello from the Girls class." ;
- // The segment of
code below is called a method,
- // in this case the talk
method.
- public void talk
( ) {
- // Note that it's possible to use the following println ( ) method without knowing any
- // details about the code inside it. This is an example of information hiding.
-
System.out.println ( girlTalk
) ;
- }
- }