GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Placement Papers  >  Manhattan Associates  >  Java
Go To First  |  Previous Question  |  Next Question 
 Java  |  Question 3 of 17    Print  
By default, Strings to functions are passed using the method

(a) Call by Value
(b) Call by Reference
(c) Strings cannot be passed to function

(b)

String is a class defined in java.lang and in java all classes are passed by reference.




  
Total Answers and Comments: 2 Last Update: July 06, 2005   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
May 09, 2005 07:47:58   #1  
Hari        

RE: By default, Strings to functions are passed using the method(a) Call by Value (b) Call by Reference...
By default all primitives and Strings are passed by Value only
 
Is this answer useful? Yes | No
July 06, 2005 11:37:50   #2  
Manish Mishra        

RE: By default, Strings to functions are passed using the method(a) Call by Value (b) Call by Reference...
Wrong answer

In Java everything. I mean EVERYTHING is pass by value. References are PASSED BY VALUE. And for god's sake it has got nothing do with java.lang.

try this

public void someMethod(){
Vector someVector new Vector();
someOtherMethod(someVector);
System.out.println(someVector.toString());
}

public void someOtherMethod(Vector someVector){
Vector anotherVector new Vector();
anotherVector.add( Hello );
someVector anotherVector;
}

run the above and draw little boxes and u will get it.




 
Is this answer useful? Yes | No

 Related Questions

Which of the following 2 methods executes faster ?class Trial { String _member; void method1() { for(int i=0;i<2048;i++) { _member += "test"; } } void method2() { String temp; for(int i=0;i<2048;i++) { temp += "test"; } _member = temp; } } (a) method1() (b) method2() (c) Both method1() and method2() takes same time for execution
(b)Accessing method variables requires less overhead than accessing class variables. 

By default, Strings to functions are passed using the method(a) Call by Value (b) Call by Reference (c) Strings cannot be passed to function
(b)String is a class defined in java.lang and in java all classes are passed by reference. 

How many String objects are created by the following statements ?String str = " a+b=10 "; trim(str) str.replace(+,-);(a) 1 (b) 2 (c) 3 (d) 4
(c)Strings are immutable. So, for each String operation, one new object is generated. 

Latest Answer : protected void finalize() method is called by the garbage collector just before it is about to reclaim the memory space acquired by the object. ...

Latest Answer : Static Methods over loading is of no use for example the below code will produce a output of B.m1 C.m1 C.m1 if we remove static in those functions we will get an ouput of  B.m1 C.m1 B.m1 class C{   static ...


 Sponsored Links

 
Related Articles

Service Oriented Java Business Integration Review

Service Oriented Java Business Integration Review Introduction If you ve read through the texts which give you an introduction to SOA or Web Services you will often find them to be quite frustrating and the reason for this is because they spend too much time referencing business processes which are
 

jQuery Reference

jQuery Reference Guide by Jonathan Chaffer and Karl Swedberg A Comprehensive Exploration of the Popular JavaScript Library jQuery Reference Guide packtpub com jquery reference guide Open Source book Anatomy of a jQuery Script He s got a brand new start Now he s a happy guy Categ
 

Microsoft AJAX Library - Anonymous Functions

Anonymous Functions Anonymous functions can be created adhoc and used instead of a named function Although this can hinder readability when the function is more complex you can do this if you don t intend to reuse a function s code In the following example we pass such an anonymous function to Displ
 

Microsoft AJAX Library - Functions as Variables

Functions as Variables In JavaScript functions are first class objects This means that a function is regarded as a data type whose values can be saved in local variables passed as parameters and so on For example when defining a function you can assign it to a variable and then call the function thr
 

Microsoft AJAX Library - JavaScript Functions

JavaScript Functions A simple fact that was highlighted in the previous chapter but that is often overlooked is key to understanding how objects in JavaScript work code that doesn t belong to a function is executed when it s read by the JavaScript interpreter while code that belongs to a function is
 

ERPAdvantages for Management Functions

ERP Advantages for Management Functions ERP management systems provide a technology platform in which organizations can integrate and coordinate their main internal business processes They use this to fight against the problem of the organizational inefficiency brought on by the use of different sys
 

C++ Static Functions

C Static Functions Static member functions have a class scope and they do not have access to the this pointer of the class When a member is declared as static a static member of class it has only one data for the entire class even though there are many objects created for the class The main usage of
 

C++ Pure Virtual Function and Base Class

C Pure Virtual Function and Virtual Base Class In this C tutorial you will learn about pure virtual function declaration of pure virtual function and virtual base class virtual base class and how to implement a virtual base class explained with examples mosgoogle center What is Pure Virtual Function
 

C++ Virtual Functions

C Virtual Functions What are Virtual Functions Virtual as the name implies is something that exists in effect but not in reality The concept of virtual function is the same as a function but it does not really exist although it appears in needed places in a program The object oriented programming la
 

C++ Inline Functions

C Inline Functions In this C tutorial you will learn about Inline function what is inline function reason for the need of inline function what happens when an inline function is written general format of inline function explained with example mosgoogle center What is Inline Function Inline functions
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape