Clarification about the toString method within an ADT class
This is the modified toString function within the Complex ADT class that
i'm trying to implement (My doubt is only regarding this function so I
havent included the private variables declared before and the other
functions) :
class ComplexCart implements Complex{
public String toString(){
if(image == 0) return (real + "");
}
}
Why can't we write the following?
if(imag == 0) return(real);
Why do we need to add the additional "" ?
No comments:
Post a Comment