Q : What is the difference between Java platform and other platforms?
A : The Java platform differs from most other platforms in that it's a software-only platform that runs on top of other hardware-based platforms.
The Java platform has two components:
1. The Java Virtual Machine (Java VM)
2. The Java Application Programming Interface (Java API)
Q : What is Java Virtual Machine?
A : The Java Virtual Machine is a software that can be ported onto the various hardware-based platforms.
Q : What is the package? Define with an example?
A : A package is a grouping of related types providing access protection and name space management. Note that types refers to classes, interfaces, enumerations, and annotation types. Enumerations and annotation types are special kinds of classes and interfaces, respectively, so types are often referred to in this lesson simply as classes and interfaces.
Package is a directory of related classes and interfaces.
Eg: java.lang.*
Here java is a directory,lang stands for language & it is a sub directory, * indicates collection of related classes & interfaces
Q : What is the difference between the interface and abstract class?
A : An abstract class may contain code in method bodies, which is not allowed in an interface. With abstract classes, you have to inherit your class from it and Java does not allow multiple inheritance. On the other hand, you can implement multiple interfaces in your class.
Q : What is the thread?
A : A thread is an independent path of execution in a system.
Q :What is the multi-threading?
A: Multi-threading means various threads that runs in a system.
Q : What is the synchronization ? why is it important in Java Programming?
A : With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is an possible for one thread to modify a shared object while another thread is in the process of using or updating that object’s value. This often causes dirty data and leads to significant errors.
Q : What is the purpose of Runtime class in Java Programming?
A :The purpose of Runtime class is to provide access to the Java runtime system in Java Programming.
Q :Describe difference between a static and a non-static inner class in Java Programming?
A non-static inner class may have object instances that are associated with instances of the class’s outer class. A static inner class does not have any other object instances.
Q : Name the primitive Java types?
A : The primitive types are,
byte, char, short, int, long, float, double, and boolean.
Q : What is the casting in Java Programming?
A : There are two types of casting, casting between primitive numeric types and casting between object references.
Casting between numeric types is used to convert larger values, such as double values, to smaller values, such as byte values. Casting between object references is used to refer the object by a compatible class, interface, or array type reference.
Q : What are the Encapsulation, Inheritance and Polymorphism?
A : Encapsulation is the mechanism that binds together code and data it manipulates and keeps both safe from outside interference and misuse.
Inheritance is the process by which one object acquires the properties of another object. Polymorphism is the feature that allows one interface to be used for general class actions.
Q : What is the difference between constructor and method?
A : Constructor will be automatically invoked when an object is created where as the method has to be called explicitly.
Q: What is a UNICODE?-
A : A Unicode is used for internal representation of characters and strings and it uses 16 bits to represent each other.
Q : What is a abstract class?
A :A abstract class is a class designed with implementation gaps for subclasses to fill in and is deliberately incomplete.
Q : What is daemon thread ? which the method is used to create the daemon thread?-
A: Daemon thread is a low priority thread which runs intermittently in the back ground doing the garbage collection operation for the java runtime system.
SetDaemon method is used to create a daemon thread.
Q: What are the wrapper classes?
A : The Wrapper classes are classes that allow primitive types to be accessed as objects.
Q : What is the difference between applet and a servlet?
A : Servlets are to servers what applets are to browsers.
Applets must have graphical user interfaces whereas servlets have no graphical user interfaces.
Q :What are the cookies ?
A : Cookies are a mechanism that a servlet uses to have a client hold a small amount of state-information associated with the user.
Q :What is Java Bean?
A : Java Bean is a software component that has been designed to be reusable in a variety of different environments.
Saturday, January 3, 2009
Recent - JAVA Interview Questions & Answers
Posted by Sakthivel at 6:30 PM 0 comments
Labels: computer related questions, free interview questions, J2EE, j2me, java, jsp, latest interview questions and answers, web language tutorials
JMS Interview Questions & Answers
Q : What is JMS?
A : The Java Message Service is a Java API that allows applications to create and send, receive, and read messages. Designed by Sun and several partner companies, the JMS API defines a common set of interfaces and associated semantics that allow the programs written in the Java programming language to communicate with the other messaging implementations.
Q : What’s the difference between queue and topic?
A : A topic is typically used for one to many messaging i.e. it supports publish subscribe model of messaging. While queue is used for the one-to-one messaging i.e. it
supports Point to Point Messaging.
Q : What is an encryption options are there for sending messages through JMS?
A : Encryption is not handled by the JMS specification. It is left to the JMS provider to implement and provide encryption and decryption of messages. These days, Progress Software’s Sonic MQ is a leading the JMS provider and they have a robust encryption mechanism called Quality of Protection. They also provide an SSL-related feature, which is also has build in encryption.
Q :How does the Application server handle the JMS Connection?
• A : Application server is created the server session and stores them in a pool.
• Connection consumer uses the server session to put messages in the session of the JMS.
• Applications written by Application programmers creates the message listener.
• Server session is the one that spawns the JMS session.
Q : What is point-to-point messaging?
A : A point-to-point message passing is the sending application/client establishes a named message queue in the JMS broker/server and sends messages to this queue. The receiving client registers with the broker to receive the messages posted to this queue. There is a one-to-one relationship between the sending and receiving clients.
Q : What is the advantage of persistent message delivery compared to nonpersistent delivery?
A : If the JMS server experiences a failure, for example, a power outage, any message that it is holding in an primary storage potentially could be lost. With persistent storage, the JMS server is logs every message to secondary storage. (The logging occurs on the front end, that is, as part of handling the send operation from the message producing client.) The logged message is removed from secondary storage only after it has been successfully delivered to all the consuming clients.
Q : What is the difference between the Messaging and Mailing?
A: . Messaging is the way of communicating to the remote machines is using the Message Oriented Middlewares. Message Oriented Middlewares don’t use mailing internally for communication. They create their own channels for communication. Java Mailing is the set of APIs that primarily concerns with the sending of Mail messages through the standard mail protocols.
Q : What is a Stream Message ?
A : A Stream messages are a group of java primitives. It contains the some of convenient methods for reading the data. However the Stream Message prevents reading a long value as a short. This is so because the Stream Message also writes the type of information along with the value of the primitive type and enforces a set of strict conversion rules which actually prevents reading of one primitive type as another.
Q : What is the Role of the JMS Provider?
A : The role of the JMS provider is handles the security of the messages, data conversion and the client triggering. The JMS provider specifies the level of encryption and the security level of the message, the best data type for the non-JMS client.
Q What is the text message?
A : The text messages contains String messages (since being widely used, a separate messaging Type has been supported) . It is useful for exchanging textual data and complex character data like XML.
Q What is an object message ?
A : An Object message contains a group of serializeable java object. So it allows exchange of Java objects between applications. Sot both the applications must be Java applications
Q : What is Map message?
A : A Map message is contain the name of the value Pairs. The values can be of type primitives and its wrappers. The name is a string.
Q What is Byte Message ?
A Byte Messages contains a Stream of uninterrupted bytes. Byte Message contains an array of primitive bytes in it is payload. Thus it can be used for transfer of data between two applications in their native format which may not be compatible with other Message types. It is also to useful the where JMS is used purely as a transport between two systems and the message payload is opaque to the JMS client.
Q : What’s the difference between StreamMessage and BytesMessage?
A :The StreamMessage maintains a boundary between the different data types stored because it also stores the type information along with the value of the primitive being stored. BytesMessage stores the primitive data types by converting them to their byte representation. Thus the message is one the contiguous stream of bytes BytesMessage allows the data to be read using any type. Thus even if your payload contains a long value, you can invoke a method of to read a short and it will return you something. It will not give you a semantically correct data but the call will succeed in reading the first two bytes of data. This is strictly prohibited in the StreamMessage. It maintains the type information of the data being stored and enforces strict conversion rules on the data being read.
Q : How JMS is different from RPC?
A : In RPC the method is invoked the waits for the method to finish execution and return to the control back to the invoker. Thus it is completely synchronous in nature. While in the JMS the message sender just sends the message to the destination and continues it is the own processing. The sender does not wait for the receiver to respond. This is asynchronous behavior.
Q : What is main parts of JMS applications?
A :The main parts of JMS applications are:
ConnectionFactory and Destination
Session
Connection
MessageConsumer
MessageProducer
Message
Posted by Sakthivel at 6:12 PM 0 comments
Labels: free interview questions, j2me, JMS, jsp, latest interview questions and answers, script languages, web language tutorials
Wednesday, December 31, 2008
JSP Interview Questions & Answers
Q : What is a JSP and what is it used for?
A : Java Server Pages is a platform independent presentation layer technology that comes with SUN s J2EE platform. JSPs are normal HTML pages are with Java code pieces embedded in them. JSP pages are saved to *.jsp files. A JSP compiler is used to in the background to generate a Servlet from the JSP page.
Q : What is JSP technology?
A : Java Server Page is a standard Java extension that is defined on top of the servlet Extensions. The goal of JSP is the simplified creation and management of dynamic Web pages. JSPs are secure, platform-independent, and the best of all, make use of Java as a server-side scripting language.
Q : How many JSP scripting elements ?
A : There are three JSP scripting language elements:
• Scriptlets
• Declarations
• Expressions
Q : What is the information needed to create a TCP Socket?
A : The Remote System’s IPAddress and Port Number.
The Local Systems IP Address and Port Number.
Q : What is difference between JSP 1.0 model and JSP 2.0 model?
A : The main difference between the JSP 1.0 and JSP 2.0 has feature in that by which we can create more syntax errors due to TLD.
Q :Diffrence betweeen a statis and dynamic include?
Dynamic include means files are included at run time.
If there is any change in source file it will reflected in JSP
Static include means files are included at compile time. After inclusion if there any change in source file it will not reflect that JSP.
Q : What’s the differences between JSP LifeCycle and Servlet LifeCycle?
A : In servlet we can implement init, service and destroy method but in JSP we do not have any implementation for that i.e JSP container is taking care of that implementation . Finally only translation phase is different i.e JSP converted into servlet.
Q : What is the difference between web server and application server?
A : Application server is EJB. It can communicate will both Web and Distributed Architecture. Application server is a Component Architecture
Web server can not communicate with Component Architecture or Distributed Architecture. It consists of Servlets and JSP pages.
Q : How to Upload a textfile from JSP to Servlet ?
A . You must use this tag for Remember form tag must contain the following attribute
Enctype ="multipart/form-data" then only it will validate file upload.
Q : What’s the difference between JSP forward and servlet forward methods?
A : JSP forward forwards the control to another resource available in the same web application on the same container. where as a Servlet forward forwards the control to another resource available in the same web application or different web application on the same container.
Q : How to call EJB from JSP.?
We need to write a JavaBean which implements the code for the EJB client. This is JavaBean can interact with the JSP using useBean JSP action.
Q : What is the difference between jsp include and directive include?
A : <%@ include> : Used to include dynamic content or static content during runtime
Used to include static resources during translation time. :
Q : How does JSP handle runtime exceptions?
A: Using the error Page attribute of page directive and also we need to specify the error page isErrorPage=true if the current page is intended to URL redirecting of a JSP.
Q : What are the implicit objects?
A : Implicit objects are objects that are created by the web container and contain the information related to a particular request, page, or application. They are:
• Request
• session
• response
• pageContext
• application
• out
• exception
• config
• page
Q : What is an Expression?
A : An expression is a tag contains a scripting language expression that is evaluated, converted to a String, and inserted where the expression appears in the JSP file. Because the value of an expression is converted to a String, you can use an expression within text in a JSP file. Like
<%= someexpression %>
<%= (new java.util.Date()).toLocaleString() %> You won’t use the semicolon to end an expression.
Posted by Sakthivel at 6:58 PM 0 comments
Labels: computer related questions, free interview questions, html, java script, jsp, latest interview questions and answers, script languages, web language tutorials, xml
