Java support call by reference (pass by reference) ?
Answer Posted / 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 |
Post New Answer View All Answers
What does flagged out mean?
what type of questions asked for barclays technologies pune please send urgent
What is private protected in java?
Define array. Tell me about 2-D array.
What are variable arguments or varargs?
What is the differences between c++ and java? Explain
How many types of string data types are there?
What is compiler and what its output.
Where are register variables stored?
What is boolean false?
write a program that list all permutations of ABCDEF in which A appears before B?
What kind of variables can a class consist?
What is a method signature java?
Name some OOPS Concepts in Java?
What is better - 'bit-shift a value' or 'multiply by 2'?