what is mean by String and StringBuffer?
What is mean by Methooverriding and Overloading?

Answer Posted / vijayakumar chinnasamy

String:
1. Is final class.
2. Is immutable class i.e value can't change once it is
assigned.
3. When your text is not going to change ,then you use the
String.
4. is not thread safe


StringBuffer:

1. is final class.
2. is mutable object.
3. When your text is going to change and will be accessed
from multiple threads , then you use StringBuffer
4. is thread safe .

Method Overloading:
1. Morethan one method has same name and either the number
of argument or data type of arguments are differ.
2. Method can be overloaded in same class or its subclass.
3. Return type ,access specifier and throws Exception are
not part of overloading.
4. static method can be overloaded by nonstatic method.

Method Overriding:
1. A method has same name,return type, number of argument
and arguments data types are same in subclass and super class.
2. The subclass (inheriting) method has equal or higher
access specifier than it superclass method.
3. The subclass (inheriting) method's throws exception is
equal or subclass excpetion of superclass method(Inherited
class method).

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain naming conventions for packages?

584


What is hotjava?

566


Why map is used in java?

588


Explain the difference between the public, private, final, protected, and default modifiers?

559


How to convert string to byte array and vice versa?

596






How to make a class or a bean serializable?

547


Why inputstreamreader is used in java?

562


How many types of voids are there?

543


What is a method in coding?

579


Explain creating threads by implementing runnable class?

597


How do you add an element to a hashset in java?

498


What is the difference between the ">>" and " >>>" operators in java?

521


What is sortedmap in java?

559


Can array grow dynamically in java?

534


How do you execute a thread in java?

516