Hitachi Frequently Asked Core Java Interview Questions

Hitachi Most Frequently Asked Latest Core Java Interview Questions Answers

What Is The Significance Of Listiterator?

You can iterate back and forth.

What Is The Final Keyword Denotes?

final keyword denotes that it is the final implementation for that method or variable or class. You can’t override that method/variable/class any more.

What Is Skeleton And Stub? What Is The Purpose Of Those?

Stub is a client side representation of the server, which takes care of communicating with the remote server. Skeleton is the server side representation. But that is no more in use… it is deprecated long before in JDK.

Why Does It Take So Much Time To Access An Applet Having Swing Components The First Time?

Because behind every swing component are many Java objects and resources. This takes time to create them in memory. JDK 1.3 from Sun has some improvements which may lead to faster execution of Swing applications.

What Is The Difference Between Instanceof And Isinstance?

instanceof is used to check to see if an object can be cast into a specified type without throwing a cast class exception. isInstance() Determines if the specified Object is assignment-compatible with the object represented by this Class. This method is the dynamic equivalent of the Java language instanceof operator. The method returns true if the specified Object argument is non-null and can be cast to the reference type represented by this Class object without raising a ClassCastException. It returns false otherwise.

What Does The "final" Keyword Mean In Front Of A Variable? A Method? A Class?

FINAL for a variable: value is constant. FINAL for a method: cannot be overridden. FINAL for a class: cannot be derived.
Hitachi Most Frequently Asked Latest Core Java Interview Questions Answers
Hitachi Most Frequently Asked Latest Core Java Interview Questions Answers

Describe What Happens When An Object Is Created In Java?

Several things happen in a particular order to ensure the object is constructed properly: Memory is allocated from heap to hold all instance variables and implementation-specific data of the object and its superclasses. Implemenation-specific data includes pointers to class and method data. The instance variables of the objects are initialized to their default values. The constructor for the most derived class is invoked. The first thing a constructor does is call the consctructor for its superclasses. This process continues until the constrcutor for java.lang.Object is called, as java.lang.Object is the base class for all objects in java. Before the body of the constructor is executed, all instance variable initializers and initialization blocks are executed. Then the body of the constructor is executed. Thus, the constructor for the base class completes first and constructor for the most derived class completes last.

What Is The Difference Amongst Jvm Spec, Jvm Implementation, Jvm Runtime ?

The JVM spec is the blueprint for the JVM generated and owned by Sun. The JVM implementation is the actual implementation of the spec by a vendor and the JVM runtime is the actual running instance of a JVM implementation.

How Does Java Handle Integer Overflows And Underflows?

It uses those low order bytes of the result that can fit into the size of the type allowed by the operation.

Why Are There No Global Variables In Java?

Global variables are considered bad form for a variety of reasons: Adding state variables breaks referential transparency (you no longer can understand a statement or expression on its own: you need to understand it in the context of the settings of the global variables), State variables lessen the cohesion of a program: you need to know more to understand how something works. A major point of Object-Oriented programming is to break up global state into more easily understood collections of local state, When you add one variable, you limit the use of your program to one instance. What you thought was global, someone else might think of as local: they may want to run two copies of your program at once. For these reasons, Java decided to ban global variables.

Whats The Difference Between Notify() And Notifyall()?

notify() is used to unblock one waiting thread; notifyAll() is used to unblock all of them. Using notify() is preferable (for efficiency) when only one blocked thread can benefit from the change (for example, when freeing a buffer back into a pool). notifyAll() is necessary (for correctness) if multiple threads should resume (for example, when releasing a “writer” lock on a file might permit all “readers” to resume).

How Can My Application Get To Know When A Httpsession Is Removed?

Define a Class HttpSessionNotifier which implements HttpSessionBindingListener and implement the functionality what you need in valueUnbound() method. Create an instance of that class and put that instance in HttpSession.

What Interface Must An Object Implement Before It Can Be Written To A Stream As An Object?

An object must implement the Serializable or Externalizable interface before it can be written to a stream as an object.

What Is Your Platform's Default Character Encoding?

If you are running Java on English Windows platforms, it is probably Cp1252. If you are running Java on English Solaris platforms, it is most likely 8859_1.

What An I/o Filter?

An I/O filter is an object that reads from one stream and writes to another, usually altering the data in some way as it is passed from one stream to another.

What Is The Purpose Of Finalization?

The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected.

Which Class Should You Use To Obtain Design Information About An Object?

The Class class is used to obtain information about an object’s design.

What Is The Purpose Of The System Class?

The purpose of the System class is to provide access to system resources.

Can We Use The Constructor, Instead Of Init(), To Initialize Servlet?

Yes , of course you can use the constructor instead of init(). There’s nothing to stop you. But you shouldn’t. The original reason for init() was that ancient versions of Java couldn’t dynamically invoke constructors with arguments, so there was no way to give the constructur a ServletConfig. That no longer applies, but servlet containers still will only call your no-arg constructor. So you won’t have access to a ServletConfig or Servlet Context.

How Can A Servlet Refresh Automatically If Some New Data Has Entered The Database?

You can use a client-side Refresh or Server Push.

The Code In A Finally Clause Will Never Fail To Execute, Right?

Using System.exit(1); in try block will not allow finally code to execute.

How Many Messaging Models Do Jms Provide For And What Are They?

JMS provide for two messaging models, publish-and-subscribe and point-to-point queuing.

What Information Is Needed To Create A Tcp Socket?

The Local System?s IP Address and Port Number. And the Remote System’s IPAddress and Port Number.

What Class.forname Will Do While Loading Drivers?

It is used to create an instance of a driver and register it with the DriverManager. When you have loaded a driver, it is available for making a connection with a DBMS.

How Many Jsp Scripting Elements Are There And What Are They?

There are three scripting language elements: declarations, scriptlets, expressions.

What Are Stored Procedures? How Is It Useful?

A stored procedure is a set of statements/commands which reside in the database. The stored procedure is pre-compiled and saves the database the effort of parsing and compiling sql statements everytime a query is run. Each database has its own stored procedure language, usually a variant of C with a SQL preproceesor. Newer versions of db’s support writing stored procedures in Java and Perl too. Before the advent of 3-tier/n-tier architecture it was pretty common for stored procs to implement the business logic( A lot of systems still do it). The biggest advantage is of course speed. Also certain kind of data manipulations are not achieved in SQL. Stored procs provide a mechanism to do these manipulations. Stored procs are also useful when you want to do Batch updates/exports/houseKeeping kind of stuff on the db. The overhead of a JDBC Connection may be significant in these cases.

How Do I Include Static Files Within A Jsp Page?

Static resources should always be included using the JSP include directive. This way, the inclusion is performed just once during the translation phase. Do note that you should always supply a relative URL for the file attribute. Although you can also include static resources using the action, this is not advisable as the inclusion is then performed for each and every request.

Post a Comment

Previous Post Next Post