Java support call by reference (pass by reference) ?
Answer / sarju001
yes java support call by reference only using StringBuffer
class.
Here, is an example of call by reference
public class PassByReference
{
public static void passref(StringBuffer s)
{
s = s.insert(8, "j2ee & ");
System.out.println(s);
}
public static void main(String[] args)
{
StringBuffer str = new StringBuffer("Welcome java
program");
System.out.println(str);
passref(str);
System.out.println(str);
}
}
output :-
Welcome java program
Welcome j2ee & java program
Welcome j2ee & java program
Is This Answer Correct ? | 9 Yes | 0 No |
what is the difference between applet and swing and gui application in java . What we do with the collections set and list interface
2 Answers CTS, Phoenix Technologies,
Accenture NJ mostly ask question on Collection like 1)How to sort Objcts and how treeset sort them 2)Explain mechanism of Hashcode finding in Java 3)Name some of the Sorted collection.
What is a condition in java?
which one is performance wise advantageious from List,Set,Map?
what is the use of Clonable,and serializable interface?
where to use join method and explain with real time senario?and programatical explenation also..
Explain the difference between association, aggregation and inheritance relationships.
Which package is used for pattern matching with regular expressions?
if two references are having same hash codes,is that means those are refering to same object?
Explain different types of wrapper classes in java?
How does serialization work
there are some duplicate values in ArrayList, how U'll get that array with out duplicate?