- /**
- * Demonstrates
inheritance and interfaces
- *
- * @author TK Rogers
- * @version 02-17-09
- */
-
- import java.awt.*;
//Abstract Window Toolkit (awt) contains graphic
elements
- import
javax.swing.*;
public class InheritanceInterfaceDemo extends JApplet {
- //
Field
- Student bob =
new Student ( ) ;
-
-
public void init ( ) {
- }
public void paint (Graphics g) {
-
g.setColor (Color.red) ;
-
g.drawString ("Bob's GPA = " + bob.gpa ( ),100,100) ;
-
-
g.setColor (Color.blue) ;
-
g.drawString ("Bob's weight = " + bob.getWeight ( ), 100 , 120) ;
- }
- }