Core java - Interview Questions and Answers for 'Barclays' | Search Java Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com
Share

Search Interview Questions


 2802 questions in repository.
 There are more than 200 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Barclay


   




Core java - Interview Questions and Answers for 'Barclays' - 4 question(s) found - Order By Newest

Advanced level question. Frequently asked in High end product companies. Frequently asked in Cognizant and Deloitte ( Based on 2 feedback )
  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  Nakisa      expert        frequent

Try 4 Question(s) Test


Frequently asked at HCL Technologies ( Based on 3 feedback )
  Q2. Difference between Checked and Unchecked exceptions ?Core Java
Anonymous
Ans. Checked exceptions are the exceptions for which compiler throws an errors if they are not checked whereas unchecked exceptions are caught during run time only and hence can't be checked.

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

   Like      Discuss      Correct / Improve     java   exceptions   checked exceptions   unchecked exceptions   exception handling   basic interview question     Verilogue  F5 Network  Pegasystems  PegaSystems  SAP  Ciber  Conde Nast  Pramati Technologies  IBM  JP Morgan  HCL Technologies  Tata Consultancy (TCS)  Cognizant (CTS)  Cogent Infotech  MarketAxess  defense group  NETS INTERNATIONAL  Accenture  Integra Micro  ColdLight Solutions  Endeavor  Deloitte  Infosys  Jean Martin  Symantec  Ancestry  Overstock.com  Adobe  Ultimo  CRIF  Sapeins  Flexera  Sofi  Morgan Stanley  Barclays      basic        frequent

Try 1 Question(s) Test


Must know at all levels. Among Top 10 frequently asked questions in Java. Very frequently asked to fresh graduates or less experienced professionals.
  Q3. What is Inheritance ?Core Java

Ans. Its a facility for code reuse and independent extension wherein a derived class inherits the properties of parent class.

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

   Like      Discuss      Correct / Improve     inheritance  oops concepts  java concepts  code reuse  code re-use   classes  derived classes     Maverick Software  Infosys  HCL Technologies  Tata Consultancy (TCS)  Cognizant (CTS)  Myntra  Capital One  Barclays  Accenture  Infoview Technologies  Wipro  Paragyte      basic        frequent


 Q4. What will be the output of following code

public class BuggyBread {
   static class A {
      A() {
         f();
      }

      public void f() {
         System.out.println("A ctor");
      }
   }

   static class B extends A {
      B() {
         f();
      }

      public void f() {
         System.out.println("B ctor");
      }
   }

   public static void main(String[] args) {
      B b = new B();
      b.f();
      A a = new A();
      a.f();
   }
}
Core Java2017-01-10 13:08:58

Ans. B ctor
B ctor
B ctor
A ctor
A ctor

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

   Like      Discuss      Correct / Improve          Barclays




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

Barclay: I had 5 rounds of interview for a ... Anonymous

X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   


Questions Asked: