i want to over ride the to string method in my VO class

i want to over ride the to string method in my VO class

please give me the code for that
LVL 9
Manikandan ThiagarajanSenior consultantAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

objectsCommented:
public class VO extends Whatever {

    ...

    @Override
    public String toString() {
        return ....;   // return string
    }
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CEHJCommented:
0
Arabia_vnCommented:
Really don't understand your problem. You override it as it should be
class EVO
{
@Override
public String toString()
    {
        return ....;   // return string
        // if you want to use default toString method simply call super.toString()
    }
}
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Manikandan ThiagarajanSenior consultantAuthor Commented:
how could i call that to  string method

could you please give me a example
0
objectsCommented:
String s = myVO.toString();

or it will get called implicitly when you do

String s = "My VO: "+myVO;
0
Arabia_vnCommented:
If you want to use it, simply initialize your class and call that method
VO myclass = new VO(//your constructor here);
String s = myclass.toString();
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.