REGISTER FREE to Receive Instant Job

Wednesday, 21 January 2015

Java Exception and String interview questions

1- What is Exception Handling?

Exceptions are those runtime errors which can be handled programmatically in the application. Exception handling adds the features of robustness into the language.

2- What is difference between Checked Exception and Unchecked Exception?

Checked Exception: The classes that extend Throwable class except RuntimeException and Error are known as checked exceptions e.g.IOException,SQLException etc. Checked exceptions are checked at compile-time.
Unchecked Exception: The classes that extend RuntimeException are known as unchecked exceptions e.g. ArithmeticException,NullPointerException etc. Unchecked exceptions are not checked at compile-time.

3- What is the base class for Error and Exception?
Throwable.

4- Commonly used subclasses of Exception

ArithmeticException – represents an invalid arithmetical operation such as divide by zero.
ArrayIndexOutOfBoundsException – represents an attempt to refer non-existent array elements.
NullPointerException – represents an attempt to use a null containing reference variable for referencing object features.
NumberFormatException – represents an attempt to correct non-numeric string into a number.

5- What is finally block?

finally keyword is used to define a block of statements that is executed by the JRE with 100% certainty whether an exception occurs or not.

6- Can finally block be used without catch?

Yes, by try block. finally must be followed by either try or catch

7- What is exception propagation ?

Forwarding the exception object to the invoking method is known as exception propagation.

8-Defining Custom Exception

Custom Exception is represented by direct or indirect subclass of exception that contains data member to store error message and provides a mechanism of displaying the error message.

8-  What is String Handling ?

String Handling provides numbers of methods & classes for represent & manipulate a string. The Java Library provides 4 classes to represent & manipulate a string.
  1. String
  2. StringBuffer
  3. StringBuilder
  4. StringTokenizer

9- What is the meaning of immutable in terms of String?

The simple meaning of immutable is unmodifiable or unchangeable. Once string object has been created, its value can't be changed.

10- What is StringBuffer?

Objects of StringBuffer represents mutable strings. Each StringBuffer object creates an array of default or specified capacity that is used to hold the contents of StringBuffer.

11- Can we access the non-final local variable, inside the local inner class?

No, local variable must be constant if you want to access it in local inner class.

12- Can a class have an interface?


Yes, it is known as nested interface.

16 comments:

  1. Thank you for the blog. Found it interesting and useful. Java is a general purpose, high-level, class-based and object-oriented programming language. And we provide Java training in Chennai at Fita.

    ReplyDelete
    Replies
    1. I have read your blog its very attractive and impressive. I like it your blog.


      JavaEE Training in Chennai JavaEE Training in Chennai

      Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

      Java Online Training Java Online Training Core Java 8 Training in Chennai Java 8 Training in Chennai

      Delete
  2. I agree with your thoughts!!! As the demand of java programming application keeps on increasing, there is massive demand for java professionals in software development industries. Thus, taking training will assist students to be skilled java developers in leading MNCs.
    Java Training in Chennai

    ReplyDelete
  3. Thanks for your informative post on Java application development. This open source platform assists software developers to create stunning mobile application with ease. Further, they can make use of this platform at free of cost. J2EE Training in Chennai | JAVA Course in Chennai

    ReplyDelete
  4. Thanks for your informative blog!!! Your article helped me to understand the future of .net programming language. Keep on updating your with such awesome information. DOT NET Training in Chennai | dot net course Chennai

    ReplyDelete
  5. I agree with your post. Selenium is most used automation tool to test web application and browser. This automation tool offers precise and complete information about a software application or environment. Selenium Training in Chennai

    ReplyDelete
  6. WP EasyCart eCommerce module is a straightforward shopping basket module that introduces into new or existing WordPress online journals and sites. Get a full WordPress eCommerce Shopping Cart framework inside minutes! Offer retail items, advanced downloadable merchandise, blessing cards and that's only the tip of the iceberg! What's more, now with WordPress, the capable components are still simple to administrate!
    Wordpress Cart Shop

    ReplyDelete

  7. The share your really gives us excitement. Thanks for your sharing. If you feel tired at work or study try to participate in our games to bring the most exciting feeling. Thank you!
    hotmail sign in | red ball | 192.168.1.1

    ReplyDelete
  8. You have posted a very detail document. I read all of your article and I really like it, I understand your point of view.
    * Boy names starting with T

    ReplyDelete
  9. I really enjoy simply reading all of your weblogs. Simply wanted to inform you that you have people like me who appreciate your work....
    Thanks..
    Big Data Analytics Training in Chennai | AWS Training in Chennai

    ReplyDelete
  10. The blog or and best that is extremely useful to keep I can share the ideas of the future as this is really what I was looking for, I am very comfortable and pleased to come here. Thank you very much.
    animal jam | five nights at freddy's | hotmail login

    ReplyDelete

Popular Posts

Powered by Blogger.

About Me

My photo

JobsAcid is a 'job search engine' to provide finding a job on the internet easier for the user. It has designed as huge selection of job offerings on the same search engine.