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 are order of precedence and associativity, and how are they used?
Which eclipse is best for java?
How do you use, call, and access a static method in Java?
What is the difference between this() and super()?
what is main difference between architecture,framework and design pattren
what r advatages of websphere? & how to deploy?
What part of memory - Stack or Heap - is cleaned in the garbage collection process?
What do you understand by the term singleton?
Is set ordered in java?
what is the use of private constructor in core java?
3 Answers OnMobile, Satyam, Yash Technologies,
how a marker interface gets its functionality and when we implements a marker interface how it got invoked
What is stored procedure. How do you create stored procedure ?