Results 1 to 2 of 2
- 03-24-2011, 12:51 AM #1
Member
- Join Date
- Mar 2011
- Posts
- 44
- Rep Power
- 0
estPrintable.java:14: cannot find symbol
I have the following error:
TestPrintable.java:14: cannot find symbol
symbol : constructor Shape(java.lang.String,int)
location: class Shape
Printable s =new Shape("james", 50);
^
1 error
With the following classes:
public class Person implements Printable{
String name;
double weight;
public Person(String n, double w){
name = n;
weight = w;
}
public double getWeight(){
return weight;
}
public double getValue(){
return weight;
}
public String toString(){
return name + "weight" + getWeight();
}
public void print(){
}
}
public class Shape implements Printable{
String color;
double density;
double volume;
public Shape(String c, double d, double v){
color=c;
density=d;
volume=v;
}
public double getWeight(){
return density * volume;
}
public double getValue(){
return getWeight();
}
public String toString(){
return color + "weight" + getWeight();
}
public void print(){
}
}
public interface Printable{
public void print();
}
public class TestPrintable{
public static void printALL(Printable[]param){
for (int i=0; i<param.length; i++){
param[i].print();
}
}
public static void main (String[]args){
Printable s =new Shape("james", 50);
Printable p =new Person("james", 50);
Printable[]param={s,p};
printALL(param);
}
}
Please let me know what I have to do to fix up this 1 error. Thank You.
- 03-24-2011, 12:53 AM #2
Similar Threads
-
java:92: cannot find symbol error
By noviceNewbie in forum AWT / SwingReplies: 3Last Post: 12-18-2010, 02:46 AM -
FileRead.java:79: cannot find symbol
By xx__rose in forum New To JavaReplies: 1Last Post: 05-09-2010, 04:06 AM -
java:34:cannot find symbol
By MissyMadi in forum New To JavaReplies: 5Last Post: 11-09-2008, 06:53 PM -
cannot find symbol symbol :constructor Error. Please help! =(
By KalEl in forum New To JavaReplies: 9Last Post: 10-18-2008, 08:26 PM -
cannot find symbol symbol : class Item location: package platypos.services.order
By officialhopsof in forum New To JavaReplies: 3Last Post: 05-01-2008, 08:30 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks