Write a java program Convert an object into string public St

Write a java program

Convert an object into string
public String toString()
{ return area+”-“ + ln + “ –“ + nb;}
System.out.println(myphone);
-------------------myphone.toString()

Solution

Please find the required program along with its output. Please see the comments against each line to understand the step.

Note: The members of class is identified from the variables used in toString method in the question.

--------------------------------

OUTPUT:

91-890–4699567

Write a java program Convert an object into string public String toString() { return area+”-“ + ln + “ –“ + nb;} System.out.println(myphone); ------------------

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site