View Single Post
  #8 (permalink)  
Old 01-25-2008, 02:12 AM
gibsonrocker800's Avatar
gibsonrocker800 gibsonrocker800 is offline
Senior Member
 
Join Date: Nov 2007
Location: New York
Posts: 143
gibsonrocker800 is on a distinguished road
Send a message via AIM to gibsonrocker800
Yeah Welsh you must understand that constructors have the same name as the class. Say the class is Number, the constructor is: public Number(int num)
You have not defined this constructor, so in your main class, you are passing an int to a constructor whose parameter type is void (eh, i'm not sure if you can say that in java, but that's what it is in C++ anyway haha). What i'm saying is. See how everyone said that the default constructor is public Number(), if you want to make it so that you can construct a new object of the Number type whose argument calls for an int value, you must make this constructor. Say for example, we made a constructor in this class: public Number(String value)... if we tried to pass a char into this it wouldn't work, because there is no constructor in the Number class that calls for a char.
__________________
//Haha javac, can't see me now, can ya?
Reply With Quote