Java - Interview Questions and Answers for 'Subex Limited' | Search Java Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com
Share

Search Java Interview Questions


 2098 questions in repository.
 There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Label / Company      Label / Company / Text

   



Interview Questions and Answers for 'Subex Limited' - 2 question(s) found - Order By Newest

Advanced level question. Frequently asked in High end product companies. Frequently asked in Cognizant ( Based on 2 feedbacks )
  Q1. Why is String immutable in Java ?Core Java
Anonymous
Ans. 1. String Pool - When a string is created and if it exists in the pool, the reference of the existing string will be returned instead of creating a new object. If string is not immutable, changing the string with one reference will lead to the wrong value for the other references.

Example -

String str1 = "String1";
String str2 = "String1"; // It doesn't create a new String and rather reuses the string literal from pool

// Now both str1 and str2 pointing to same string object in pool, changing str1 will change it for str2 too

2. To Cache its Hashcode - If string is not immutable, One can change its hashcode and hence it's not fit to be cached.

3. Security - String is widely used as parameter for many java classes, e.g. network connection, opening files, etc. Making it mutable might possess threats due to interception by the other code segment.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   oops   string   string class   immutable   advanced     Barclays  Jungo  Cloudera  Allston  Man Group  Prokarma  Optimus  Gamesys  ABS  TransPerfect  Fidelity  Deloitte  Zalando  Cognizant (CTS)  Zeta Interactive  SuccessFactors   EchoStar  InterGlobe Technologies  HCL Technologies  Intuit  JP Morgan  Optimus Information  Faichi Solutions  Blip  Adobe  Subex Limited  Remo Software  Allstate  IBM  Bizmatics  Bytecode Cyber Security  Calsoft Systems  IDS Infotech      expert        frequent

Try 4 Question(s) Test


Related Questions

  Why Char array is preferred over String for storing password?
  What is an Immutable Object ?
  What is an immutable class ?
  How to implement an immutable class ?
  Does Declaring an object "final" makes it immutable ?
 How does making string as immutable helps with securing information ? How does String Pool pose a security threat ?
 How is string object immutable if we can concat a string to it ?
  What are stateless objects ? How are they different from immutable objects ? Which of these two is thread safe ?
  What are advantages of stateless and / or immutable objects ?


Usually asked to entry level software developers.
  Q2. Write a program to swap two variables without using thirdCore Java2017-01-19 15:38:34

Ans. public static void main(String[] args) {
   int num1 = 1;   
   int num2 = 2;
   num1 = num1^num2;
   num2 = num1^num2;
   num1 = num1^num2;
   System.out.print("num1 = " + num1 +", num2 = "+num2);
}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     code  coding     Deloitte  Colgate Palmolive  Tech Mahindra  SAP  Broadcom  Tata Consultancy (TCS)  Wipro  Gemalto  Time op  Nse Tech  Client Network Services  Monte Carlo  BrainMobi Technologies  Nokia  Minted LLC  Societe Generale  MetricStream  Sapient Global  HighRadius  Mindtree  Robert Bosch  Cypress Semiconductor  Tesco  NTT Data  Tejora Technologies  Saggezza  Elegant Microweb  AMD  Advanced Micro Devices  Tricon Infotech  Odessa Technologies  Aditi  Max Secure Software India  NetSuite  Volante Technologies  Subex Limited  Plintron Global Technology Solutions      basic        frequent


Related Questions

  What are the steps to be performed while coding Junit with Mocking framework ?
  What is a Sequence File?
 What different level of logging you use while coding ?




Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus
 

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked:
         

X Close this

1 person from Mountain View are looking for questions for 'Subex Limited'. Connect with them to better prepare for your interview.
X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   


Questions Asked: