Describe tostring() methods, JAVA Programming

Assignment Help:

Describe toString() Methods ?

Print methods are general in some languages, but most Java programs operate differently. You can use System.out.println() to print any object. Therefore for good results your class should have a toString() method which formats the object's data in a sensible way and returns a string. Otherwise all that's printed is the name of the class that is generally not what you need. For instance, a good toString() method for the Car class might be

public String toString() {
return (this.licensePlate + " is moving at " + this.speed
+ "kph and has a maximum speed of " + this.maxSpeed +"kph.");
}


Related Discussions:- Describe tostring() methods

Describe the ? operator in java langauge, Describe The ? operator in Java l...

Describe The ? operator in Java langauge? The conditional operator just works for assigning a value to a variable, using a value within a method invocation, or in a few other w

Differentiate between onload and onunload, Differentiate between onLoad and...

Differentiate between onLoad and onUnload? Onload executes the particular javascript code when a latest document is loaded into a windows. ONUnload executes he particular javas

Write a short Java application that stores words in an Array, Write a short...

Write a short Java application that stores words in an Array or ArrayList. You get to pick the number of words to store. Generate a random number between 0 (inclusive) and the leng

How many static initializers can there, How many static initializers can yo...

How many static initializers can you have ? As many as you want, but the static initializers and class variable initializers are implemented in textual order and may not refer

Explain what is orm, Object Relational Mapping , its a tool for transaction...

Object Relational Mapping , its a tool for transaction management that requires to be integrated with Spring, Struts etc.Eg : Hibernate, i Batis,JDO etc

Jzebra integration into open erp web client, JZEBRA Integration into (Open ...

JZEBRA Integration into (Open ERP) Web Client Local Spooling/Printing to Local Print Device on ERP Client side Project Description: JZEBRA Integration into Open ERP Web Clien

How to finding an applets size, Finding an Applet's Size When running i...

Finding an Applet's Size When running inside a web browser the size of an applet is set through the height and width attributes and cannot be changed by the applet. Several app

Posting on a wall, Viewing a User's Wall Where your project allows you t...

Viewing a User's Wall Where your project allows you to view a user's profile, your ZHTML must provide the following capabilities: 1. Provide a Wall for that user profile, dis

Which are three elements of event handler, The event handler attribute cons...

The event handler attribute consists of three elements. Write about each of them? 1. The identifier of the event handler. 2. The equal sign. 3. A string consisting of JavaScrip

What is object oriented programming explain with an example, What is Object...

What is Object Oriented Programming explain with an example? In Java everything is an object or a class (or a piece of one or a collection of various). Objects send messages t

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd