Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is argument in java?

1007


What are filterstreams?

1066


Does hashset allow duplicates in java?

1109


How is java created?

934


What is the use of predicate in java 8?

947


What is entry set in java?

1115


What does java stand for?

1110


What is data string?

957


In a container there are 5 components. I want to display the all the components names, how will you do that one?

1034


How do you execute a thread in java?

950


What does next mean in java?

961


What technique can be employed to compare two strings?

1090


Why main method is static in java?

1165


What is the synonym of string?

1084


What is return in java?

959