Results 1 to 3 of 3

Thread: New to Java ...

  1. #1
    tkelley1620 is offline Member
    Join Date
    May 2010
    Location
    Pittsburgh, PA
    Posts
    10
    Rep Power
    0

    Default New to Java ...

    Ok I am new to this forum and am just starting out in Java... I have very little programming experinece at all.

    I am taking a class in Java and need some help. I dont want anyone to do my homework for me but I am stuck I keep getting errors...

    here is my code...
    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */

    package kelley1;
    import java.awt.Rectangle;


    /**
    *
    * @author Thomas P, Kelley
    */
    public class RectangleTester {
    public static void main (String[]args){
    Rectangle myShape1 = new Rectangle();
    double height = myShape1.getHeight();
    double width = myShape1.getWidth();
    System.out.Println("height:= "myShape1.getHeight);
    System.out.println("width:= "myShape1.getWidth);
    System.out.println("Area:" width * height);

    }
    }

  2. #2
    Sno's Avatar
    Sno
    Sno is offline Senior Member
    Join Date
    Apr 2010
    Posts
    196
    Rep Power
    4

    Default

    Java Code:
    System.out.Println("height:= " + myShape1.getHeight());
    System.out.println("width:= " + myShape1.getWidth());
    System.out.println("Area:" + (width * height));
    or
    Java Code:
    System.out.Println("height:= "+ height);
    System.out.println("width:= " + width);
    System.out.println("Area:" + (width * height));
    but you're not going to get anywhere, since you don't have a width or height value set
    :rolleyes: ~ Sno ~ :rolleyes:
    '-~ B.S. Computer Science ~-'

  3. #3
    tkelley1620 is offline Member
    Join Date
    May 2010
    Location
    Pittsburgh, PA
    Posts
    10
    Rep Power
    0

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •