Results 1 to 3 of 3
Thread: Hi, I'm new! I also need help.
- 09-12-2012, 01:47 AM #1
Member
- Join Date
- Sep 2012
- Posts
- 1
- Rep Power
- 0
Hi, I'm new! I also need help.
Hello,
I am new to the boards and to Java. I am currently taking a Java class at the JC and am presented with a problem I am unable to solve. I believe my code is correct. I may need to create a directory somewhere and if so I have not done that but I will provide the errors the code and the file paths for current problem. I am coding on a mac. That shouldn't make a difference but thought I'd throw it in there just in case.
Thanks so much for your help!
file paths: note that everything resides within the same folder
Drawing Kit:
/Users/demuro1/Documents/School/Current Semester/Java:Prog/Homework/Chapter 2/com/programwithjava/basic/DrawingKit.class
RectanglDemo.java:
/Users/demuro1/Documents/School/Current Semester/Java:Prog/Homework/Chapter 2/RectanglDemo.java
error message:
Last login: Sat Sep 8 11:17:58 on ttys000
demuro1-pc:~ demuro1$ cd '/Users/demuro1/Documents/School/Current Semester/Java:Prog/Homework/Chapter 2/'; javac RectanglDemo.java
RectanglDemo.java:11: error: cannot find symbol
Rectangle2DFloat rect = new Rectangle2DFloat(50,100,200,200);
^
symbol: class Rectangle2DFloat
location: class RectanglDemo
RectanglDemo.java:11: error: cannot find symbol
Rectangle2DFloat rect = new Rectangle2DFloat(50,100,200,200);
^
symbol: class Rectangle2DFloat
location: class RectanglDemo
RectanglDemo.java:12: error: cannot find symbol
dk.draw(rect1);
^
symbol: variable rect1
location: class RectanglDemo
RectanglDemo.java:13: error: cannot find symbol
BasicStroke = new BasicStroke(22);
^
symbol: variable BasicStroke
location: class RectanglDemo
RectanglDemo.java:14: error: cannot find symbol
dk.setStroke(stroke);
^
symbol: variable stroke
location: class RectanglDemo
RectanglDemo.java:15: error: cannot find symbol
dk.setPaint(Color = blue);
^
symbol: variable Color
location: class RectanglDemo
RectanglDemo.java:15: error: cannot find symbol
dk.setPaint(Color = blue);
^
symbol: variable blue
location: class RectanglDemo
RectanglDemo.java:16: error: cannot find symbol
line1 = new Line2D.Float(285,175,300,155);
^
symbol: variable line1
location: class RectanglDemo
RectanglDemo.java:17: error: cannot find symbol
dk.draw(line1);
^
symbol: variable line1
location: class RectanglDemo
9 errors
demuro1-pc:Chapter 2 demuro1$
code:
Java Code:import java.awt.*; import java.awt.geom.*; import com.programwithjava.basic.DrawingKit; public class RectanglDemo { public static void main(String[] args) { DrawingKit dk = new DrawingKit("Ellipse"); Rectangle2DFloat rect = new Rectangle2DFloat(50,100,200,200); dk.draw(rect1); BasicStroke = new BasicStroke(22); dk.setStroke(stroke); dk.setPaint(Color = blue); line1 = new Line2D.Float(285,175,300,155); dk.draw(line1); } }
-
Re: Hi, I'm new! I also need help.
I've been doing this for a bit longer than you, so if there's one thing that I want you to take away from this, and one thing that I've learned the hard way, is to get rid of that assumption: If the compiler tells you you're wrong, you can't hold the belief that you're right. Instead believe the compiler. In fact it is telling you where you're wrong -- the class that you're trying to use, Rectangle2DFloat, doesn't exist. Check the API and use the correct class, one that exists in the API. As for the other problem, BasicStroke, your statement is wrong -- you have declared no variable.
Another problem, if you're not using an IDE, then it is your responsibility to compile your code often perhaps after adding each new line of code, and not to add any new code until you've fixed your current compilation errors. If you don't do this, your program will be little more than a rat's nest of errors.Last edited by Fubarable; 09-12-2012 at 02:35 AM.
- 09-12-2012, 05:38 AM #3
Re: Hi, I'm new! I also need help.
Please go through the Forum Rules -- especially the third paragraph.
dbWhy do they call it rush hour when nothing moves? - Robin Williams


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks