Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with constructor test

 
Nancy Bradley
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My assignment is to write a program that calculates area and perimeter of a rectangle and an applet that test it.
When I try to compile the applet I get these error messages:
- cannot resolve symbol
variable RectangleTest (this is not a variable)
- cannot resolve symbol
class add
input.add ActionListener(this);
- cannot resolve symbol
class add ( I declare these variables, I do not understand
package c the problem)
c.add x;
- cannot resolve symbol
class add
package c
c.add y;
- cannot resolve symbol
package c
c.add rsults;
- RectangleTest should be declare abstract; it does not define actionPerformed(java.awt.event.ActionEvent) in RectangleTest public class RectangleTest extends JApplet implements ActionListener {
I appreciate your help
Thanks in advance
Nancy Bradley

 
Ben Buchli
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
>>cannot resolve symbol variable RectangleTest
this is an object and you have to declare it in the following way:
RectangleTest rectangleTest = new RectangleTest();
>>cannot resolve symbol class add
here you have a syntax problem (I believe)
correct: c.add(<whatever component> ) ;
>>RectangleTest should be declare abstract; it does not define actionPerformed(java.awt.event.ActionEvent) in RectangleTest public class RectangleTest extends JApplet implements ActionListener {
you have to declare a method actionPerformed( ActionEvent e ). you cant define your own name for this method, as you did with getInformation().
hope that helps.
[ March 28, 2004: Message edited by: Ben Buchli ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic