Simple console print statement demonstration


public class ConsolePrintApplet1 extends java.applet.Applet
{
  public void init ()
  {

    // Put code between this line
    //------------------------------------------
    double x = 5.0;
    double y = 3.0;
    System.out.println ("x * y = " + (x*y));
    System.out.println ("x / y = " + (x/y));

    // and this line.
    //------------------------------------------
  }

  // Paint message in Applet window.
  public void paint (java.awt.Graphics g) {
     g.drawString ("ConsolePrintApplet1",10,20);
  }
}
public class ConsolePrintApp1 extends java.applet.Applet
{
  public static void main (String [] args) {
    // Put code between this line
    //------------------------------------------

    double x = 5.0;
    double y = 3.0;
    System.out.println ("x * y = " + (x*y));
    System.out.println ("x / y = " + (x/y));

    //------------------------------------------
    // and this line.
  }

}

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|