Wednesday, March 28, 2007

Java Interview Questions- Part 8

what is tunnelling?
Tunnelling is a route to somewhere. For example, RMI tunnelling is a way to make RMI application get through firewall. In CS world, tunnelling means a way to transfer data.
--------------------------------------------------------------------------------
Does the code in finally block get executed if there is an exception and a return statement in a catch block?
If an exception occurs and there is a return statement in catch block, the finally block is still executed. The finally block will not be executed when the System.exit(1) statement is executed earlier or the system shut down earlier or the memory is used up earlier before the thread goes to finally block.
--------------------------------------------------------------------------------
How you restrict a user to cut and paste from the html page?
Using javaScript to lock keyboard keys. It is one of solutions.
--------------------------------------------------------------------------------
Is Java a super set of JavaScript?
No. They are completely different. Some syntax may be similar.
--------------------------------------------------------------------------------
What is a Container in a GUI?
A Container contains and arranges other components (including other containers) through the use of layout managers, which use specific layout policies to determine where components should go as a function of the size of the container.
--------------------------------------------------------------------------------
How the object oriented approach helps us keep complexity of software development under control?
We can discuss such issue from the following aspects: Objects allow procedures to be encapsulated with their data to reduce potential interference. Inheritance allows well-tested procedures to be reused and enables changes to make once and have effect in all relevant places. The well-defined separations of interface and implementation allows constraints to be imposed on inheriting classes while still allowing the flexibility of overriding and overloading.
--------------------------------------------------------------------------------
What is polymorphism?
Polymorphism allows methods to be written that needn't be concerned about the specifics of the objects they will be applied to. That is, the method can be specified at a higher level of abstraction and can be counted on to work even on objects of yet unconceived classes.
--------------------------------------------------------------------------------
What is design by contract?
The design by contract specifies the obligations of a method to any other methods that may use its services and also theirs to it. For example, the preconditions specify what the method required to be true when the method is called. Hence making sure that preconditions are. Similarly, postconditions specify what must be true when the method is finished, thus the called method has the responsibility of satisfying the post conditions. In Java, the exception handling facilities support the use of design by contract, especially in the case of checked exceptions. The assert keyword can be used to make such contracts

3 comments:

Bong Mom said...

Thanks for visiting my Blog. Do you work in Java ?

నా కథలు...... said...

Radhika gaaru i am very thankful to u bcoz this blog is very useful for me in my bright future.Go on posting some more interview questions in java.

Venky said...

Interesting Questions Radhika gaaru. I could know some interesting things. I'm not a java geek, but for those who are attending intws, posting the typical programming Qs would add to the benefit that this blog is already providing !!! Grt work.