Labels

.NET Job Questions About Java Absract class Abstract class Abstract Class and Interface Aggregation ajax aop apache ofbiz Apache ofbiz tutrial Association authentication autocad basics batch Binary Tree bootstrap loader in java build Builder design pattern C++ Job Questions caching CallableStatement in java certifications Chain of responsibility Design pattern charts check parentheses in a string Classes classloader in java classloading concept code quality collage level java program Composition concurrency Concurrency Tutorial Converting InputStream to String Core Java core java concept core java interview questions Core Java Interview Questions Core Java Questions core java tutorial CyclicBarrier in Java data structures database Database Job Questions datetime in c# DB Db2 SQL Replication deserialization in java Design Patterns designpatterns Downloads dtd Eclipse ejb example/sample code exception handling in core java file handling injava File I/O vs Memory-Mapped Filter first program in spring flex Garbage Collection Generics concept in java grails groovy and grails Guice Heap hibernate Hibernate Interview Questions how-to IBM DB2 IBM DB2 Tutorial ide immutable Interceptor Interface interview Interview Questions for Advanced JAVA investment bank j2ee java JAVA Code Examples Java 7 java changes java class loading JAVA Classes and Objects Java Classloader concept Java classloading concept java cloning concept java collection Java collection interview questions Java Collections java concurrency Java CountDownLatch java definiton Java design pattern Java EE 5 Java EE 6 Java Exceptions Java file Java Garbage Collection Java generics Java Glossary java hot concept java immutable concept Java Interface Java interview Question java interview question 2012 java interview question answer Java Interview Questions Java Interview Questions and Answers java interview topic java investment bank Java Job Questions java multithreading java multithreading concept java new features Java Packages java proxy object java questions Java Serialization Java serialization concept java serialization interview question java session concept java string Java Swings Questions java synchronization java threading Java Threads Questions java tutorial java util; java collections; java questions java volatile java volatile interview question Java Wrapper Classes java.java1.5 java.lang.ClassCastException JavaNotes javascript JAX-WS jdbc JDBC JDBC Database connection jdk 1.5 features JDK 1.5 new features Concurrent HashMap JMS interview question JMS tutorial job JSESSIONID concept JSESSIONID interview Question JSF jsp JSP Interview Question JSP taglib JSTL with JSP Junit Junit Concept Junit interview question.Best Practices to write JUnit test cases in Java JVM Linux - Unix tutorial Marker Interfaces MD5 encryption and decryption messaging MNC software java interview question musix NCR java interview question Networking Job Questions news Object Serialization Objects ojdbc14.jar OOP Oracle Oracle SQL Query for two timestamp difference orm own JavaScript function call in Apache ofbiz Packages Palm Apps patterns pdf persistence Portal Portlet Spring Integration Prime number test in java programs Rails Reboot remote computers REST Ruby Sample application schema SCJP security Senior java developer interviews servlet3 servlets session tracking singleton design pattern Spring Spring 2.5 Framework spring ebook Spring framework concept spring MVC spring pdf Spring Security Spring Security interview questions SQL SQL performance SQL Query to create xml file Sql Query tuning ssis and ssrs StAX and XML string concept string immutable string in java strings struts Struts2 Struts2 integration synchronization works in java Technical Interview testing tips Tomcat top Tutorial Volatile in deep Volatile working concept web Web Developer Job Questions web services weblogic Weblogic Application Server websphere what is JSESSIONID xml XML parsing in java XML with Java xslt


Showing posts with label j2ee. Show all posts
Showing posts with label j2ee. Show all posts

Sunday, 21 July 2013

Portlets in spring

Hi,

The article will shows you to integrate spring framework with portal frameworks (e.g. Liferay).No matter for which portal (Liferay or JBoss or Weblogic) you are integrating the spring and which IDE you are using but it should have following components.

  • portlet.xml  in WEB-INF folder.
  • Web.xml
  • Required libs (described in snap below)
  • springContextConfig.xml in WEB-INF 
  • jdbc.properties


Step-1
 We need to edit Web.xml for ViewRenderServlet Class loading
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
    xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

    <display-name>portletMvcDemo</display-name>

    <servlet>
        <servlet-name>ViewRendererServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>ViewRendererServlet</servlet-name>
        <url-pattern>/WEB-INF/servlet/view</url-pattern>
    </servlet-mapping>

    <!-- optional for basic config -->
    <jsp-config>
        <!-- if you are using liferay as portlet server and want to take advantage
            of liferay taglib -->
        <taglib>
            <taglib-uri>http://java.sun.com/portlet_2_0</taglib-uri>
            <taglib-location>/WEB-INF/tld/liferay-portlet.tld</taglib-location>
        </taglib>
        <!--if you want to use jstl taglib -->
        <taglib>
            <taglib-uri>http://java.sun.com/jstl/core_rt</taglib-uri>
            <taglib-location>/WEB-INF/tld/c-rt.tld</taglib-location>
        </taglib>
    </jsp-config>
</web-app>

ViewRendererServlet is a bridge servlet, mainly for the Portlet MVC support.
For usage with Portlets, this Servlet is necessary to force the portlet container to convert the PortletRequest to a ServletRequest, which it has to do when including a resource via the PortletRequestDispatcher. This allows for reuse of the entire Servlet-based View support even in a Portlet environment.
The actual mapping of the bridge servlet is configurable in the DispatcherPortlet, via a "viewRendererUrl" property. The default is "/WEB-INF/servlet/view", which is just available for internal resource dispatching.

Step -2
We need to add DispatcherPortlet in Portlet.xml file
DispatcherPortlet is central dispatcher for use within the Portlet MVC framework, e.g. for web UI controllers. Dispatches to registered handlers for processing a portlet request.

We need to also add SpringContext configuration file in init parameter of portlet.xml, which will load context of spring beans.


<?xml version="1.0"?>

<portlet-app
    version="2.0"
    xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
>
    <portlet>
        <portlet-name>eis</portlet-name>
        <display-name>Eis</display-name>
            <!-- this will invoke spring dispatcher portlet -->
            <portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>
        <init-param>
            <!-- Spring context configuration load -->
            <name>contextConfigLocation</name>
            <value>
                /WEB-INF/springContextConfig.xml
            </value>
        </init-param>
        <expiration-cache>0</expiration-cache>
        <supports>
            <mime-type>text/html</mime-type>
            <portlet-mode>VIEW</portlet-mode>
            <portlet-mode>EDIT</portlet-mode>
            <portlet-mode>HELP</portlet-mode>
        </supports>
        <resource-bundle>content/Language</resource-bundle>
        <portlet-info>
            <title>Eis</title>
            <short-title>Eis</short-title>
            <keywords>Eis</keywords>
        </portlet-info>
        <security-role-ref>
            <role-name>administrator</role-name>
        </security-role-ref>
        <security-role-ref>
            <role-name>guest</role-name>
        </security-role-ref>
        <security-role-ref>
            <role-name>power-user</role-name>
        </security-role-ref>
        <security-role-ref>
            <role-name>user</role-name>
        </security-role-ref>
    </portlet>
</portlet-app>


Step-3
Now turn for the configuring Spring Context file. Three main parts to configure, rest of all is spring and service layer stuff.
First part is setting PortletModeHandlerMapping for Diffrent portlet modes(VIEW,EDIT,HELP). we need to create handler (Spring MVC abstract controller class) for handling VIEW mode of portlet.

Second part is creating ParameterMappingInterceptor to forward a request parameter from the ActionRequest to the RenderRequest

Third part is configuring PortletModeParameterHandlerMapping, assigning interceptor to it

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
 xsi:schemaLocation="
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">



 <!-- ########## Hibernate configuration############### -->
 <bean
  class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  <property name="location">
   <value>/WEB-INF/jdbc.properties</value>
  </property>
 </bean>

 <bean id="dataSource"
  class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  <property name="driverClassName" value="${jdbc.default.driverClassName}" />
  <property name="url" value="${jdbc.default.url}" />
  <property name="username" value="${jdbc.default.username}" />
  <property name="password" value="${jdbc.default.password}" />
 </bean>

 <!-- ADD PERSISTENCE SUPPORT HERE (jpa, hibernate, etc) -->
 <bean id="sessionFactory"
  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  <property name="dataSource" ref="dataSource" />
  <property name="mappingResources">
   <list>
    <!--<value>/model/employee.hbm.xml</value> -->
   </list>
  </property>
  <property name="hibernateProperties">
   <value>hibernate.dialect=org.hibernate.dialect.MySQLDialect</value>
  </property>
 </bean>

 <!-- Transaction Manager -->
 <bean id="txManager"
  class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  <property name="sessionFactory" ref="sessionFactory" />
 </bean>

 <!-- ########## services ############### -->
 <!--
 <bean id="emplyoeeService" class="com.hardik4u.practice.eis.service.EmployeeServiceImpl" >
  <property name="employeeDAO" ref="employeeDAO" />
 </bean>
 -->
 <!-- ########## DAO ############### -->
 <!--
 <bean id="employeeDAO" class="com.hardik4u.practice.eis.dao.EmployeeDAOHib" >
  <property name="sessionFactory" ref="sessionFactory" />
 </bean>
 -->
 <!-- ########## Controller ############### -->

 <bean id="viewHandler" class="com.hardik4u.practice.eis.handler.ViewHandler" />
 <!--<bean id="employeeController" class="com.hardik4u.practice.eis.controller.EmployeeController">
  <property name="commandClass"
   value="com.hardik4u.practice.eis.command.EmployeeCommand" />
  <property name="commandName" value="employeeCommand" />
  <property name="emplyoeeService" ref="emplyoeeService" />
 </bean>
 -->
 <!-- ##########Portlet Controller Configurations############### -->

 <bean id="parameterMappingInterceptor"
  class="org.springframework.web.portlet.handler.ParameterMappingInterceptor" />

 <bean id="portletModeHandlerMapping"
  class="org.springframework.web.portlet.handler.PortletModeHandlerMapping">
  <property name="portletModeMap">
   <map>
    <entry key="view" value-ref="viewHandler" />
   </map>
  </property>
 </bean>

 <bean
  class="org.springframework.web.portlet.handler.PortletModeParameterHandlerMapping">
  <property name="order" value="1" />
  <property name="interceptors">
   <list>
    <ref bean="parameterMappingInterceptor" />
   </list>
  </property>

  <property name="portletModeParameterMap">
   <map>
    <entry key="view"> <!-- 'view' portlet mode -->
     <map>
      <!--<entry key="addpage" value-ref="employeeController"/>
      <entry key="list" value-ref="employeeController"/>
      <entry key="editpage" value-ref="employeeController"/>
      <entry key="save" value-ref="employeeController"/>
      <entry key="delete" value-ref="employeeController"/> -->
     </map>
    </entry>
   </map>
  </property>
 </bean>

 <bean id="viewResolver"
  class="org.springframework.web.servlet.view.UrlBasedViewResolver">
  <property name="prefix" value="/html/jsp/" />
  <property name="suffix" value=".jsp" />
  <property name="viewClass">
   <value>org.springframework.web.servlet.view.JstlView</value>
  </property>
 </bean>

</beans>
Step-4

Creating viewHandler class for handling view mode first time (com.hardik4u.practice.eis.handler.ViewHandler)
package com.hardik4u.practice.eis.handler;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;

import org.springframework.web.portlet.ModelAndView;
import org.springframework.web.portlet.mvc.AbstractController;

public class ViewHandler extends AbstractController{
   
    public ModelAndView handleRenderRequestInternal(RenderRequest request, RenderResponse response) throws Exception {
        ModelAndView mav = new ModelAndView("view");
        System.out.println("INside View Handler>>>>>>>>");
        mav.addObject("message", "Check it out!");

        return mav;
    }
   
    @Override
    protected void handleActionRequestInternal(ActionRequest request,
            ActionResponse response) throws Exception {
        // TODO Auto-generated method stub
        super.handleActionRequestInternal(request, response);
    }
}
 
Here configuration part is almost complete only you need to set up /WEB-INF/jdbc.properties and need to copy required lib in /WEB-INF/lib folder.

required lib files snap as below.



Your configuration part is done. now you can create Spring controller and manage it via portletModeParameterMap in context configuration files.

Please let me know in case if any suggestion. All suggestions are acceptable.

Sunday, 14 July 2013

The J2EE Architect’s Handbook


The J2EE Architect's HandbookGet a free pdf copy of “The J2EE Architect’s Handbook: How to be a successful technical architect for J2EE applications”, by Derek C. Ashmore.  This book is written for technical architects and senior developers tasked with designing and leading the development of J2EE java applications.

Description
Design J2EE applications so that they are robust, extensible, and easy to maintain, Apply commonly used design patterns effectively, Identify and address application architectural issues before they hinder the development team, Document and communicate the application design so that the development team’s work is targeted, Avoid common mistakes that derail project budgets and timelines, Guide the development team through the design and construction process, Setup effective procedures and guidelines that increase stability and decrease bug reports, Effectively estimate needed resources and timelines.

Contents

Project Development Team and Project Life Cycle
Defining the Project
Scope Definition and Estimation
Designing External Application Interfaces
A Layered Approach to J2EE Design
Creating the Object Model
Creating the Data Model
Network Architecture
Planning Construction
Building Value Objects
Building XML Access Objects
Building Database Access Objects
Building Business Objects
Building Deployment Layer Objects
Building the Presentation Layer
Building Architectural Components
Application Architecture Strategies
Functional Testing Guidelines
Performance Tuning and Load Testing
Postimplementation Activities

                                                  

The J2EE Architect’s Handbook


The J2EE Architect's HandbookGet a free pdf copy of “The J2EE Architect’s Handbook: How to be a successful technical architect for J2EE applications”, by Derek C. Ashmore.  This book is written for technical architects and senior developers tasked with designing and leading the development of J2EE java applications.

Description
Design J2EE applications so that they are robust, extensible, and easy to maintain, Apply commonly used design patterns effectively, Identify and address application architectural issues before they hinder the development team, Document and communicate the application design so that the development team’s work is targeted, Avoid common mistakes that derail project budgets and timelines, Guide the development team through the design and construction process, Setup effective procedures and guidelines that increase stability and decrease bug reports, Effectively estimate needed resources and timelines.

Contents

Project Development Team and Project Life Cycle
Defining the Project
Scope Definition and Estimation
Designing External Application Interfaces
A Layered Approach to J2EE Design
Creating the Object Model
Creating the Data Model
Network Architecture
Planning Construction
Building Value Objects
Building XML Access Objects
Building Database Access Objects
Building Business Objects
Building Deployment Layer Objects
Building the Presentation Layer
Building Architectural Components
Application Architecture Strategies
Functional Testing Guidelines
Performance Tuning and Load Testing
Postimplementation Activities

                                                    

Tuesday, 2 July 2013

5. Garbage Collection questions

Q: Explain garbage collection? Or
Q: How you can force the garbage collection? Or
Q: What is the purpose of garbage collection in Java, and when is it used? Or
Q: What is Garbage Collection and how to call it explicitly? Or
Q: Explain Garbage collection mechanism in Java?
Garbage collection is one of the most important features of Java. The purpose of garbage collection is to identify and discard objects that are no longer needed by a program so that their resources can be reclaimed and reused. A Java object is subject to garbage collection when it becomes unreachable to the program in which it is used. Garbage collection is also called automatic memory management as JVM automatically removes the unused variables/objects (value is null) from the memory. Every class inherits finalize() method from java.lang.Object, the finalize() method is called by garbage collector when it determines no more references to the object exists. In Java, it is good idea to explicitly assign null into a variable when no more in use. In Java on calling System.gc() and Runtime.gc(), JVM tries to recycle the unused objects, but there is no guarantee when all the objects will garbage collected. Garbage collection is an automatic process and can’t be forced. There is no guarantee that Garbage collection will start immediately upon request of System.gc().

Q: What kind of thread is the Garbage collector thread?
It is a daemon thread.
Q: Can an object’s finalize() method be invoked while it is reachable?
An object’s finalize() method cannot be invoked by the garbage collector while the object is still reachable. However, an object’s finalize() method may be invoked by other objects.

Q: Does garbage collection guarantee that a program will not run out of memory?
Garbage collection does not guarantee that a program will not run out of memory. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection.

Q: What is the purpose of finalization?
The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup, before the object gets garbage collected. For example, closing an opened database Connection.

Q: If an object is garbage collected, can it become reachable again?
Once an object is garbage collected, It can no longer become reachable again.

4. Abstract Classes and Interfaces


Q: What is the difference between Abstract class and Interface OrQ: When should you use an abstract class, when an interface, when both? OrQ: What is similarities/difference between an Abstract class and Interface? OrQ: What is the difference between interface and an abstract class?
1. Abstract class is a class which contain one or more abstract methods, which has to be implemented by sub classes. An abstract class can contain no abstract methods also i.e. abstract class may contain concrete methods. A Java Interface can contain only method declarations and public static final constants and doesn’t contain their implementation. The classes which implement the Interface must provide the method definition for all the methods present.
2. Abstract class definition begins with the keyword “abstract” keyword followed by Class definition. An Interface definition begins with the keyword “interface”.
3. Abstract classes are useful in a situation when some general methods should be implemented and specialization behavior should be implemented by subclasses. Interfaces are useful in a situation when all its properties need to be implemented by subclasses
4. All variables in an Interface are by default - public static final while an abstract class can have instance variables.
5. An interface is also used in situations when a class needs to extend an other class apart from the abstract class. In such situations its not possible to have multiple inheritance of classes. An interface on the other hand can be used when it is required to implement one or more interfaces. Abstract class does not support Multiple Inheritance whereas an Interface supports multiple Inheritance.
6. An Interface can only have public members whereas an abstract class can contain private as well as protected members.
7. A class implementing an interface must implement all of the methods defined in the interface, while a class extending an abstract class need not implement any of the methods defined in the abstract class.
8. The problem with an interface is, if you want to add a new feature (method) in its contract, then you MUST implement those method in all of the classes which implement that interface. However, in the case of an abstract class, the method can be simply implemented in the abstract class and the same can be called by its subclass
9. Interfaces are slow as it requires extra indirection to to find corresponding method in in the actual class. Abstract classes are fast
10.Interfaces are often used to describe the peripheral abilities of a class, and not its central identity, E.g. an Automobile class mightimplement the Recyclable interface, which could apply to many otherwise totally unrelated objects.
Note: There is no difference between a fully abstract class (all methods declared as abstract and all fields are public static final) and an interface.
Note: If the various objects are all of-a-kind, and share a common state and behavior, then tend towards a common base class. If all theyshare is a set of method signatures, then tend towards an interface.
Similarities:Neither Abstract classes nor Interface can be instantiated.

Q: What does it mean that a method or class is abstract?
An abstract class cannot be instantiated. Only its subclasses can be instantiated. A class that has one or more abstract methods must be declared abstract. A subclass that does not provide an implementation for its inherited abstract methods must also be declared abstract. You indicate that a class is abstract with the abstract keyword like this:
public abstract class AbstractClass
Abstract classes may contain abstract methods. A method declared abstract is not actually implemented in the class. It exists only to be overridden in subclasses. Abstract methods may only be included in abstract classes. However, an abstract class is not required to have any abstract methods, though most of them do. Each subclass of an abstract class must override the abstract methods of its superclassesor itself be declared abstract. Only the method’s prototype is provided in the class definition. Also, a final method can not be abstract and vice versa. Methods specified in an interface are implicitly abstract.. It has no body. For example,
public abstract float getInfo()

Q: What must a class do to implement an interface?
The class must provide all of the methods in the interface and identify the interface in its implements clause.

Q: What is an abstract method?
An abstract method is a method whose implementation is deferred to a subclass.

Q: What is a marker interface & What is a cloneable interface and how many methods does it contain?
Interfaces with empty bodies are called marker interfaces having certain property or behavior. Examples:java.lang.Cloneable,java.io.Serializable,java.util.EventListener.

Q: What is interface? How to support multiple inhertance in Java?
An Interface are implicitly abstract and public. An interface body can contain constant declarations, method prototype declarations, nested class declarations, and nested interface d Interfaces provide support for multiple inheritance in Java. A class that implements the interfaces is bound to implement all the methods defined in Interface.Example of Interface:public interface sampleInterface {public void functionOne();
public long CONSTANT_ONE = 1000;}

Q: What is an abstract class? OrQ: Can you make an instance of an abstract class?
Abstract classes can contain abstract and concrete methods. Abstract classes cannot be instantiated directly i.e. we cannot call the constructor of an abstract class directly nor we can create an instance of an abstract class by using “Class.forName().newInstance()” (Here we get java.lang.InstantiationException). However, if we create an instance of a class that extends an Abstract class, compiler will initialize both the classes. Here compiler will implicitly call the constructor of the Abstract class. Any class that contain an abstract method must be declared “abstract” and abstract methods can have definitions only in child classes. By overriding and customizing the abstract methods in more than one subclass makes “Polymorphism” and through Inheritance we define body to the abstract methods. Basically an abstract class serves as a template. Abstract class must be extended/subclassed for it to be implemented. A class may be declared abstract even if it has no abstract methods. This prevents it from being instantiated. Abstract class is a class that provides some general functionality but leaves specific implementation to its inheriting classes.
Example of Abstract class:
abstract class AbstractClassExample{
protected String name;public String getname() {return name;}public abstract void function();}
Example: Vehicle is an abstract class and Bus Truck, car etc are specific implementations
No! You cannot make an instance of an abstract class. An abstract class has to be sub-classed.If you have an abstract class and you want to use a method which has been implemented, you mayneed to subclass that abstract class, instantiate your subclass and then call that method.

Q: What is meant by “Abstract Interface”?
Firstly, an interface is abstract. That means you cannot have any implementation in an interface.All the methods declared in an interface are abstract methods or signatures of the methods.

Q: How to define an Interface?
In Java Interface defines the methods but does not implement them. Interface can include constants.A class that implements the interfaces is bound to implement all the methods defined in Interface.Example of Interface:
public interface SampleInterface {public void functionOne();
public long CONSTANT_ONE = 1000;}

Q: Can Abstract Class have constructors? Can interfaces have constructors?
Abstract class’s can have a constructor, but you cannot access it through the object, since you cannot instantiate abstract class. To access the constructor create a sub class and extend the abstract class which is having the constructor. Interfaces cannot have constructors.
Examplepublic abstract class AbstractExample {public AbstractExample(){System.out.println(”In AbstractExample()”);}}
public class Test extends AbstractExample{public static void main(String args[]){Test obj=new Test();}}

Q: If interface & abstract class have same methods and those methods contain no implementation, which one would you prefer?
Obviously one should ideally go for an interface, as we can only extend one class. Implementing an interface for a class is very much effective rather than extending an abstract class because we can extend some other useful class for this subclass

3. Java Classes and Objects

Q: What restrictions are placed on method overloading?
Two methods may not have the same name and argument list but different return types.

Q: What is the difference between String and StringBuffer?
String objects are immutable whereas StringBuffer objects are not. StringBuffer unlike Strings support growable and modifiable strings.

Q: Can a private method of a superclass be declared within a subclass?
Sure. A private field or method or inner class belongs to its declared class and hides from its subclasses.There is no way for private stuff to have a runtime overloading or overriding (polymorphism) features.

Q: What is the default value of an object reference declared as an instance variable?
null unless we define it explicitly.

Q: What is the difference between a constructor and a method? Or
Q: How can a subclass call a method or a constructor defined in a superclass?
A constructor is a member function of a class that is used to create objects of that class, invoked using the new operator. It has the same name as the class and has no return type. They are only called once, whereas member functions can be called many times. A method is an ordinary member function of a class. It has its own name, a return type (which may be void), and is invoked using the dot operator. Constructor will be automatically invoked when an object is created whereas method has to be called explicitly.
super.method(); is used to call a super class method from a sub class. To call a constructor of the super class, we use the super(); statement as the first line of the subclass’s constructor.

Q: Can a top-level class be private or protected?
No. A top-level class cannot be private or protected. It can have either “public” or no modifier. If it does not have a modifier it is supposed to have a default access. If a top level class is declared as private/protected the compiler will complain that the “modifier private is not allowed here”.

Q: Why Java does not support multiple inheritance?
Java does support multiple inheritance via interface implementation.

Q: Where and how can you use a private constructor?
Private constructor can be used if you do not want any other class to instantiate the class. This concept is generally used in Singleton Design Pattern. The instantiation of such classes is done from a static public method.

Q: How are this() and super() used with constructors?
this() is used to invoke a constructor of the same class. super() is used to invoke a superclass constructor.

Q: What is Method Overriding? What restrictions are placed on method overriding?
When a class defines a method using the same name, return type, and argument list as that of a method in its superclass, the method in the subclass is said to override the method present in the Superclass. When the method is invoked for an object of theclass, it is the new definition of the method that is called, and not the method definition from superclass.Restrictions placed on method overriding• Overridden methods must have the same name, argument list, and return type.• The overriding method may not limit the access of the method it overrides. Methods may be overridden to be more public, not more private.• The overriding method may not throw any exceptions that may not be thrown by the overridden method.

Q: What are the Object and Class classes used for? Which class should you use to obtain design information about an object? or
Q: Differentiate between a Class and an Object?
The Object class is the highest-level class in the Java class hierarchy. The Class class is used to represent the classes and interfaces that are loaded by a Java program. The Class class is used to obtain information about an object’s design. A Class is only a definition or prototype of real life object. Whereas an object is an instance or living representation of real life object. Every object belongs to a class and every class contains one or more related objects.

Q: What is a singleton class? Or
Q: What is singleton pattern?

This design pattern is used by an application to ensure that at any time there is only one instance of a class created. You can achieve this by having the private constructor in the class and having a getter method which returns an object of the class and creates one for the first time if its null.

Q: What is method overloading and method overriding? Or
Q: What is difference between overloading and overriding?

Method overloading: When 2 or more methods in a class have the same method names with different arguments, it is said to be method overloading. Overloading does not block inheritance from the superclass. Overloaded methods must have different method signatures
Method overriding : When a method in a class has the same method name with same arguments as that of the superclass,it is said to be method overriding. Overriding blocks inheritance from the superclass. Overridden methods must have same signature.
Basically overloading and overriding are different aspects of polymorphism.
static/early binding polymorphism: overloadingdynamic/late binding polymorphism: overriding
Q: If a class is declared without any access modifiers, where may the class be accessed?
A class that is declared without any access modifiers is said to have package or default access. This means that the class can only be accessed by other classes and interfaces that are defined within the same package.

Q: Does a class inherit the constructors of its superclass?
A class does not inherit constructors from any of its super classes.

Q: Can an object’s finalize() method be invoked while it is reachable?
An object’s finalize() method cannot be invoked by the garbage collector while the object is still reachable. However, an object’s finalize() method may be invoked by other objects.

Q: What is the purpose of the Runtime class?
The purpose of the Runtime class is to provide access to the Java runtime system.
It returns the runtime information like memory availability.
* Runtime.freeMemory() –> Returns JVM Free Memory* Runtime.maxMemory() –> Returns the maximum amount of memory that the JVM will attempt to use. It also helps to run the garbage collector* Runtime.gc()

Q: What is the purpose of the System class?
The purpose of the System class is to provide access to system resources.

Q: Can an unreachable object become reachable again?
An unreachable object may become reachable again. This can happen when the object’s finalize() method is invoked and the object performs an operation which causes it to become accessible to reachable object.

Q: What is a bean? Where can it be used?
A Bean is a reusable and self-contained software component. Beans created using java take advantage of all the security and platform independent features of java. Bean can be plugged into any software application. Bean is a simple class which has set and get methods. It could be used within a JSP using JSP tags to use them.

Q: What is the functionality of instanceOf() ?
instanceOf opertaor is used to check whether an object can be cast to a specific type without throwing ClassCastException.

Q: What would happen if you say this = null?
It will come up with Error Message. “The left-hand side of an assignment must be a variable”.

Q: I want to create two instances of a class ,But when trying for creating third instance it should not allow me to create . What i have to do for making this?
One way of doing this would be:
public class test1
{
static int cntr=0;
test1()
{ cntr++;
if(cntr>2)
throw new NullPointerException();//u can define a new exception // for this
}
public static void main(String args[])
{
test1 t1= new test1();
System.out.println(”hello 1″);
test1 t2= new test1();
System.out.println(”hello 2″);
test1 t3= new test1();
}
}

Q: What is the difference between an object and an instance?
An Object May not have a class definition. eg int a[] where a is an array.
An Instance should have a class definition.
eg MyClass my=new MyClass();
my is an instance.

Q: What is heap in Java?
It is a memory area which stores all the objects created by an executing program.

Q: Why default constructor of base class will be called first in java?
A subclass inherits all the methods and fields (eligible one) from the base class, so base class is constructed in the process of creation of subclass object (subclass is also an object of superclass). Hence before initializing the default value of sub class the super class should be initialized using the default constructor.

Q: What are the other ways to create an object other than creating as new object?
We can create object in different ways;
1.new operator
2.class.forName: Classname obj = Class.forName(”Fully Qualified class Name”).newInstance();
3.newInstance
4.object.clone

Q: What is the difference between instance, object, reference and a class?
Class: A class is a user defined data type with set of data members & member functions
Object: An Object is an instance of a class
Reference: A reference is just like a pointer pointing to an object
Instance: This represents the values of data members of a class at a particular time

2. Java packages interview questions

Q: Do I need to import java.lang package any time? Why? Or
Which package is always imported by default?

No. It is by default loaded internally by the JVM. The java.lang package is always imported by default.

Q: Can I import same package/class twice? Will the JVM load the package twice at runtime?
One can import the same package or same class multiple times. Neither compiler nor JVM complains anything about it. And the JVM will internally load the class only once no matter how many times you import the same class.

Q: Does importing a package imports the sub packages as well? E.g. Does importing com.bob.* also import com.bob.code.*?
No you will have to import the sub packages explicitly. Importing com.bob.* will import classes in the package bob only. It will not import any class in any of its sub package’s.

Q: What is a Java package and how is it used? Or
Q: Explain the usage of Java packages.

A Java package is a naming context for classes and interfaces. A package is used to create a separate name space for groups of classes and interfaces. Packages are also used to organize related classes and interfaces into a single API unit and to control accessibility to these classes and interfaces.For example: The Java API is grouped into libraries of related classes and interfaces; these libraries are known as package.

Q: Are the imports checked for validity at compile time? e.g. will the code containing an import such as java.lang.BOB compile?
Yes the imports are checked for the semantic validity at compile time. The code containing above line of import will not compile. It will throw an error saying, cannot resolve symbol.
If you think that an important java interview question is missing or some answers are wrong in the site

1. Glossary of Terms:

A
abstract
A Java(TM) programming language keyword used in a class definition to specify that a class is not to be instantiated, but rather inherited by other classes. An abstract class can have abstract methods that are not implemented in the abstract class, but in subclasses.
abstract class
A class that contains one or more abstract methods, and therefore can never be instantiated. Abstract classes are defined so that other classes can extend them and make them concrete by implementing the abstract methods.
abstract method
A method that has no implementation.
actual parameter list
The arguments specified in a particular method call. See also formal parameter list.
API
Application Programming Interface. The specification of how a programmer writing an application accesses the behavior and state of classes and objects.
applet
A program written in the Java(TM) programming language to run within a web browser compatible with the Java platform, such as HotJava(TM) or Netscape Navigator(TM).
argument
A data item specified in a method call. An argument can be a literal value, a variable, or an expression.
array
A collection of data items, all of the same type, in which each item's position is uniquely designated by an integer.
ASCII
American Standard Code for Information Interchange. A standard assignment of 7-bit numeric codes to characters. See also Unicode.
atomic
Refers to an operation that is never interrupted or left in an incomplete state under any circumstance.

B
Bean
A reusable software component. Beans can be combined to create an application.
binary operator
An operator that has two arguments.
bit
The smallest unit of information in a computer, with a value of either 0 or 1.
bitwise operator
An operator that manipulates two values comparing each bit of one value to the corresponding bit of the other value.
block
In the Java(TM) programming language, any code between matching braces. Example: { x = 1; }.
boolean
Refers to an expression or variable that can have only a true or false value. The Java(TM) programming language provides the boolean type and the literal values true and false.
.
break
A Java(TM) programming language keyword used to resume program execution at the statement immediately following the current statement. If followed by a label, the program resumes execution at the labeled statement.
byte
A sequence of eight bits. The Java(TM) programming language provides a corresponding byte type.
bytecode
Machine-independent code generated by the Java(TM) compiler and executed by the Java interpreter.

C
case
A Java(TM) programming language keyword that defines a group of statements to begin executing if a value specified matches the value defined by a preceding "switch" keyword.
casting
Explicit conversion from one data type to another.
catch
A Java(TM) programming language keyword used to declare a block of statements to be executed in the event that a Java exception, or run time error, occurs in a preceding "try" block.
char
A Java(TM) programming language keyword used to declare a variable of type character.
class
In the Java(TM) programming language, a type that defines the implementation of a particular kind of object. A class definition defines instance and class variables and methods, as well as specifying the interfaces the class implements and the immediate superclass of the class. If the superclass is not explicitly specified, the superclass will implicitly be Object.
class method
A method that is invoked without reference to a particular object. Class methods affect the class as a whole, not a particular instance of the class. Also called a static method. See also instance method.
classpath
A classpath is an environmental variable which tells the Java(TM) virtual machine* and Java technology-based applications (for example, the tools located in the JDK(TM) 1.1.X\bin directory) where to find the class libraries, including user-defined class libraries.
class variable
A data item associated with a particular class as a whole--not with particular instances of the class. Class variables are defined in class definitions. Also called a static field. See also instance variable.
client
In the client/server model of communcations, the client is a process that remotely accesses resources of a compute server, such as compute power and large memory capacity.
comment
In a program, explanatory text that is ignored by the compiler. In programs written in the Java(TM) programming language, comments are delimited using // or /*...*/.
compilation unit
The smallest unit of source code that can be compiled. In the current implementation of the Java(TM) platform, the compilation unit is a file.
compiler
A program to translate source code into code to be executed by a computer. The Java(TM) compiler translates source code written in the Java programming language into bytecode for the Java virtual machine*. See also interpreter.
compositing
The process of superimposing one image on another to create a single image.
constructor
A pseudo-method that creates an object. In the Java(TM) programming language, constructors are instance methods with the same name as their class. Constructors are invoked using the new keyword.
const
This is a reserved Java(TM) programming language keyword. However, it is not used by current versions of the Java programming language.
continue
A Java(TM) programming language keyword used to resume program execution at the end of the current loop. If followed by a label, "continue" resumes execution where the label occurs.
core class
A public class (or interface) that is a standard member of the Java(TM) Platform. The intent is that the core classes for the Java platform, at minimum, are available on all operating systems where the Java platform runs. A program written entirely in the Java programming language relies only on core classes, meaning it can run anywhere. See also, 100% Pure Java(TM).
Core Packages
The required set of APIs in a Java platform edition which must be supported in any and all compatible implementations.

D
declaration
A statement that establishes an identifier and associates attributes with it, without necessarily reserving its storage (for data) or providing the implementation (for methods). See also definition.
default
A Java(TM) programming language keyword optionally used after all "case" conditions in a "switch" statement. If all "case" conditions are not matched by the value of the "switch" variable, the "default" keyword will be executed.
definition
A declaration that reserves storage (for data) or provides implementation (for methods). See also declaration.
deprecation
Refers to a class, interface, constructor, method or field that is no longer recommended, and may cease to exist in a future version.
derived from
Class X is "derived from" class Y if class X extends class Y. See also subclass, superclass.
distributed
Running in more than one address space.
do
A Java(TM) programming language keyword used to declare a loop that will iterate a block of statements. The loop`s exit condition can be specified with the "while" keyword.
double
A Java(TM) programming language keyword used to define a variable of type double.
double precision
In the Java(TM) programming language specification, describes a floating point number that holds 64 bits of data. See also single precision.

E
else
A Java(TM) programming language keyword used to execute a block of statements in the case that the test condition with the "if" keyword evaluates to false.
EmbeddedJava(TM) Technology
The availability of Sun's Java 2 Platform, Micro Edition technology under a restrictive license agreement that allows a licensee to leverage certain Java technologies to create and deploy a closed-box application that exposes no APIs.
encapsulation
The localization of knowledge within a module. Because objects encapsulate data and implementation, the user of an object can view the object as a black box that provides services. Instance variables and methods can be added, deleted, or changed, but as long as the services provided by the object remain the same, code that uses the object can continue to use it without being rewritten. See also instance variable, instance method.
exception
An event during program execution that prevents the program from continuing normally; generally, an error. The Java(TM) programming language supports exceptions with the try, catch, and throw keywords. See also exception handler.
exception handler
A block of code that reacts to a specific type of exception. If the exception is for an error that the program can recover from, the program can resume executing after the exception handler has executed.
executable content
An application that runs from within an HTML file. See also applet.
extends
Class X extends class Y to add functionality, either by adding fields or methods to class Y, or by overriding methods of class Y. An interface extends another interface by adding methods. Class X is said to be a subclass of class Y. See also derived from.

F
field
A data member of a class. Unless specified otherwise, a field is not static.
final
A Java(TM) programming language keyword. You define an entity once and cannot change it or derive from it later. More specifically: a final class cannot be subclassed, a final method cannot be overridden and a final variable cannot change from its initialized value.
finally
A Java(TM) programming language keyword that executes a block of statements regardless of whether a Java Exception, or run time error, occurred in a block defined previously by the "try" keyword.
float
A Java(TM) programming language keyword used to define a floating point number variable.
for
A Java(TM) programming language keyword used to declare a loop that reiterates statements. The programmer can specify the statements to be executed, exit conditions, and initialization variables for the loop.
FTP
The basic Internet File Transfer Protocol. FTP, which is based on TCP/IP, enables the fetching and storing of files between hosts on the Internet. See also TCP/IP.
formal parameter list
The parameters specified in the definition of a particular method. See also actual parameter list.

G
garbage collection
The automatic detection and freeing of memory that is no longer in use. The Java(TM) runtime system performs garbage collection so that programmers never explicitly free objects.
goto
This is a reserved Java(TM) programming language keyword. However, it is not used by current versions of the Java programming language.

H
hexadecimal
The numbering system that uses 16 as its base. The marks 0-9 and a-f (or equivalently A-F) represent the digits 0 through 15. In programs written in the Java(TM) programming language, hexadecimal numbers must be preceded with 0x. See also octal.
hierarchy
A classification of relationships in which each item except the top one (known as the root) is a specialized form of the item above it. Each item can have one or more items below it in the hierarchy. In the Java(TM) class hierarchy, the root is the Object class.
HotJava(TM) Browser
An easily customizable Web browser developed by Sun Microsystems, which is written in the Java(TM) programming language.
HTML
HyperText Markup Language. This is a file format, based on SGML, for hypertext documents on the Internet. It is very simple and allows for the embedding of images, sounds, video streams, form fields and simple text formatting. References to other objects are embedded using URLs.
HTTP
HyperText Transfer Protocol. The Internet protocol, based on TCP/IP, used to fetch hypertext objects from remote hosts. See also TCP/IP.

I
IDL
Interface Definition Language. APIs written in the Java(TM) programming language that provide standards-based interoperability and connectivity with CORBA (Common Object Request Broker Architecture).
identifier
The name of an item in a program written in the Java(TM) programming language.
if
A Java(TM) programming language keyword used to conduct a conditional test and execute a block of statements if the test evaluates to true.
implements
A Java(TM) programming language keyword optionally included in the class declaration to specify any interfaces that are implemented by the current class.
import
A Java(TM) programming language keyword used at the beginning of a source file that can specify classes or entire packages to be referred to later without including their package names in the reference.
inheritance
The concept of classes automatically containing the variables and methods defined in their supertypes. See also superclass, subclass.
instance
An object of a particular class. In programs written in the Java(TM) programming language, an instance of a class is created using the new operator followed by the class name.
instance method
Any method that is invoked with respect to an instance of a class. Also called simply a method. See also class method.
instance variable
Any item of data that is associated with a particular object. Each instance of a class has its own copy of the instance variables defined in the class. Also called a field. See also class variable.
instanceof
A two-argument Java(TM) programming language keyword that tests whether the run-time type of its first argument is assignment compatible with its second argument.
int
A Java(TM) programming language keyword used to define a variable of type integer.
interface
A Java(TM) programming language keyword used to define a collection of method definitions and constant values. It can later be implemented by classes that define this interface with the "implements" keyword.
Internet
An enormous network consisting of literally millions of hosts from many organizations and countries around the world. It is physically put together from many smaller networks and data travels by a common set of protocols.
IP
Internet Protocol. The basic protocol of the Internet. It enables the unreliable delivery of individual packets from one host to another. It makes no guarantees about whether or not the packet will be delivered, how long it will take, or if multiple packets will arrive in the order they were sent. Protocols built on top of this add the notions of connection and reliability. See also TCP/IP.
interpreter
A module that alternately decodes and executes every statement in some body of code. The Java(TM) interpreter decodes and executes bytecode for the Java virtual machine*. See also compiler, runtime system.

J
JAE
Java(TM) Application Environment. The source code release of the Java Development Kit (JDK(TM)) software.
JAR Files (.jar)
Java ARchive. A file format used for aggregating many files into one.
JAR file format
JAR (Java Archive) is a platform-independent file format that aggregates many files into one. Multiple applets written in the Java(TM) programming language, and their requisite components (.class files, images, sounds and other resource files) can be bundled in a JAR file and subsequently downloaded to a browser in a single HTTP transaction. It also supports file compression and digital signatures.
Java(TM)
Sun's trademark for a set of technologies for creating and safely running software programs in both stand-alone and networked environments.
Java Application Environment (JAE)
The source code release of the Java Development Kit (JDK(TM)) software.
JavaBeans(TM)
A portable, platform-independent reusable component model.
Java Blend(TM)
A product that enables developers to simplify database application development by mapping database records to objects in the Java(TM) programming language (Java objects) and Java objects to databases.
Java Card(TM) API
An ISO 7816-4 compliant application environment focused on smart cards.
JavaCheck(TM)
A tool for checking compliance of applications and applets to a specification.
JavaChip(TM)
Sun's processor, which executes bytecode for the Java(TM) virtual machine* natively. With a JavaChip processor, bytecode bypasses the virtual machine or just-in-time compiler stage to go directly to the processor.
Java(TM) Compatibility Kit (JCK)
A test suite, a set of tools, and other requirements used to certify a Java platform implementation conformant both to the applicable Java platform specifications and to Java Software reference implementations.
Java Database Connectivity (JDBC(TM))
An industry standard for database-independent connectivity between the Java(TM) platform and a wide range of databases. The JDBC(TM) provides a call-level API for SQL-based database access.
Java Developer Connection(SM)
A service designed for individual developers, providing online training, product discounts, feature articles, bug information, and early access capabilities.
Java Development Kit (JDK(TM))
A software development environment for writing applets and applications in the Java programming language.
Java(TM) Electronic Commerce Framework
A structured architecture for the development of electronic commerce applications in the Java(TM) programming language.
Java(TM) Enterprise API
This API makes it easy to create large-scale commercial and database applications that can share multimedia data with other applications within an organization or across the Internet. Four APIs have been designed within the Java(TM) Enterprise API family.
Java(TM) Foundation Classes (JFC)
An extension that adds graphical user interface class libraries to the Abstract Windowing Toolkit (AWT).
Java(TM) Interface Definition Language (IDL)
APIs written in the Java programming language that provide standards-based interoperability and connectivity with CORBA (Common Object Request Broker Architecture).
Java(TM) Media APIs
A set of APIs that support the integration of audio and video clips, 2D fonts, graphics, and images as well as 3D models and telephony.
Java(TM) Media Framework
The core framework supports clocks for synchronizing between different media (e.g., audio and video output). The standard extension framework allows users to do full audio and video streaming.
Java Naming and Directory Interface(TM) (JNDI)
A set of APIs that assists with the interfacing to multiple naming and directory services.
JavaOS(TM)
An Java(TM) technology-based operating system that is optimized to run on a variety of computing and consumer platforms. The JavaOS(TM) operating environment provides a runtime specifically tuned to run applications written in the Java programming language directly on hardware platforms without requiring a host operating system.
JavaPlan(TM)
An object-oriented design and diagramming tool written in the Java(TM) programming language.
Java(TM) Platform
Consists of a language for writing programs ("the Java(TM) programming language"); a set of APIs, class libraries, and other programs used in developing, compiling, and error-checking programs; and a virtual machine which loads and executes the class files. In addition, the Java platform is subject to a set of compatibility requirements to ensure consistent and compatible implementations. Implementations that meet the compatibility requirements may qualify for Sun's targeted compatibility brands. The Java(TM) 2 platform is the current generation of the Java platform.
Java(TM) Platform Editions
A Java platform "edition" is a definitive and agreed-upon version of the Java platform that provides the functionality needed over a broad market segment. An edition is comprised of two kinds of API sets: (i) "core packages," which are essential to all implementations of a given platform edition, and (ii) "optional packages," which are available for a given platform edition and which may be supported in a compatible implementation. There are 3 distinct editions of the Java Platform: * Java 2 Platform, Enterprise Edition:The edition of the Java platform that is targeted at enterprises to enable development, deployment, and management of multi-tier server-centric applications. * Java 2 Platform, Standard Edition:The edition of the Java platform that enables development, deployment, and management of cross-platform, general-purpose applications. * Java 2 Platform, Micro Edition:The edition of the Java platform that is targeted at small, standalone or connectable consumer and embedded devices to enable development, deployment, and management of applications that can scale from smart cards through mobile devices and set-top boxes to conventional computing devices.
Java(TM) Remote Method Invocation (RMI)
A distributed object model for Java(TM) program to Java program, in which the methods of remote objects written in the Java programming language can be invoked from other Java virtual machines*, possibly on different hosts.
Java(TM) Runtime Environment (JRE)
A subset of the Java Development Kit (JDK(TM)) for end-users and developers who want to redistribute the runtime environment alone. The Java runtime environment consists of the Java virtual machine*, the Java core classes, and supporting files.
JavaSafe(TM)
A tool for tracking and managing source file changes, written in the Java(TM) programming language.
JavaScript(TM)
A Web scripting language that is used in both browsers and Web servers. Like all scripting languages, it is used primarily to tie other components together or to accept user input.
Java Studio(TM)
The first program that allows you to easily create Java(TM) technology-based applications and applets without having to know the Java programming language.
Java(TM) Technologies
A set of technologies that enable the creation and safe running of software programs in both stand-alone and networked environments.
Java(TM) virtual machine (JVM)*
Sun's specification for or implementation of a software "execution engine" that safely and compatibly executes the byte codes in Java class files on a microprocessor (whether in a computer or in another electronic device). * Java HotSpot(TM) performance engine - Sun's ultra-high-performance engine for implementing the Java runtime environment which features an adaptive compiler that dynamically optimizes the performance of running applications. * KJava(TM) virtual machine - Sun's small-footprint, highly optimized foundation of a runtime environment within the Java 2 Platform, Micro Edition. Derived from the Java virtual machine, it is targeted at small connected devices and can scale from 30KB to approximately 128KB, depending on the target device's functionality. * Java Card(TM) virtual machine - Sun's ultra-small-footprint, highly-optimized foundation of a runtime environment within the Java 2 Platform, Micro Edition. Derived from the Java virtual machine, it is targeted at smart cards and other severely memory-constrained devices and can run in devices with memory as small as 24K of ROM, 16K of EEPROM, and 512 bytes of RAM.
Java Web Server(TM)
The easy-to-use, extensible, easy-to-administer, secure, platform-independent solution to speed and simplify the deployment and management of your Internet and Intranet Web sites. It provides immediate productivity for robust, full-featured, Java technology-based server applications.
Java Workshop(TM)
A complete set of tools integrated into a single environment for managing programming with Java technology. The Java Workshop software uses a highly modular structure that enables you to easily plug new tools into the overall structure.
Java(TM) wallet
A user interface, built on the Java(TM) Electronic Commerce Framework, which allows for online purchases, value transfers, and administrative functions.
JavaSpaces(TM)
A technology that provides distributed persistence and data exchange mechanisms for code in the Java(TM) programming language.
JavaSoft(TM)
A former business unit of Sun Microsystems, Inc., currently known as Sun Microsystems, Inc., Java Software division.
JDBC(TM)
Java(TM) Database Connectivity. An industry standard for database-independent connectivity between the Java platform and a wide range of databases. The JDBC interface provides a call-level API for SQL-based database access.
JDK(TM)
Java(TM) Development Kit software. A software development environment for writing applets and application in the Java programming language.
JFC
Java(TM) Foundation Class. An extension that adds graphical user interface class libraries to the Abstract Windowing Toolkit (AWT).
Jini(TM) Technology
Sun's Jini technology includes a set of APIs that may be incorporated an optional package for any Java 2 platform edition. This set of APIs enables transparent networking of devices and services and eliminates the need for system or network administration intervention by a user. The Jini technology is currently an optional package available on all Java 2 platform editions.
JMAPI
Java(TM) Management API. A collection of Java programming language classes and interfaces that allow developers to build system, network, and service management applications.
JNDI
Java Naming and Directory Interface(TM). A set of APIs that assist with the interfacing to multiple naming and directory services.
JPEG
Joint Photographic Experts Group. An image file compression standard established by this group. It achieves tremendous compression at the cost of introducing distortions into the image which are almost always imperceptible.
JRE
Java(TM) runtime environment. A subset of the Java Developer Kit for end-users and developers who want to redistribute the runtime environment. The Java runtime environment consists of the Java virtual machine*, the Java core classes, and supporting files.
Just-in-time (JIT) Compiler
A compiler that converts all of the bytecode into native machine code just as a Java(TM) program is run. This results in run-time speed improvements over code that is interpreted by a Java virtual machine*.
JVM
Java(TM) Virtual Machine*. The part of the Java Runtime Environment responsible for interpreting bytecodes.

K
keyword
The Java(TM) programming language sets aside words as keywords - these words are reserved by the language itself and therefore are not available as names for variables or methods.

L
linker
A module that builds an executable, complete program from component machine code modules. The Java(TM) linker creates a runnable program from compiled classes. See also compiler, interpreter, runtime system.
literal
The basic representation of any integer, floating point, or character value. For example, 3.0 is a double-precision floating point literal, and "a" is a character literal.
local variable
A data item known within a block, but inaccessible to code outside the block. For example, any variable defined within a method is a local variable and can't be used outside the method.
long
A Java(TM) programming language keyword used to define a variable of type long.
M
member
A field or method of a class. Unless specified otherwise, a member is not static.
method
A function defined in a class. See also instance method, class method. Unless specified otherwise, a method is not static.
Mosaic
A program that provides a simple GUI that enables easy access to the data stored on the Internet. These data may be simple files or hypertext documents. Mosaic was written by a team at NCSA.
multithreaded
Describes a program that is designed to have parts of its code execute concurrently. See also thread.

N
native
A Java(TM) programming language keyword that is used in method declarations to specify that the method is not implemented in the same Java source file, but rather in another language
new
A Java(TM) programming language keyword used to create an instance of a class.
null
A Java(TM) programming language keyword used to specify an undefined value for reference variables.

O
object
The principal building blocks of object-oriented programs. Each object is a programming unit consisting of data (instance variables) and functionality (instance methods). See also class.
object-oriented design
A software design method that models the characteristics of abstract or real objects using classes and objects.
octal
The numbering system using 8 as its base, using the numerals 0-7 as its digits. In programs written in the Java(TM) programming language, octal numbers must be preceded with 0. See also hexadecimal.
Optional Packages
The set or sets of APIs in a Java platform edition which are available with and may be supported in a compatible implementation. Over time, optional packages may become required in an edition as the marketplace requires them.
overloading
Using one identifier to refer to multiple items in the same scope. In the Java(TM) programming language, you can overload methods but not variables or operators.
overriding
Providing a different implementation of a method in a subclass of the class that originally defined the method.

P
package
A group of types. Packages are declared with the package keyword.
peer
In networking, any functional unit in the same layer as another entity.
PersonalJava(TM)
A Java runtime environment for network-connectable applications on personal consumer devices for home, office, and mobile use.
pixel
The smallest addressable picture element on a display screen or printed page.
POSIX
Portable Operating System for UNIX(TM). A standard that defines the language interface between the UNIX operating system and application programs through a minimal set of supported functions.
private
A Java(TM) programming language keyword used in a method or variable declaration. It signifies that the method or variable can only be accessed by other elements of its class.
process
A virtual address space containing one or more threads.
property
Characteristics of an object that users can set, such as the color of a window.
Profiles
A Profile is a collection of Java APIs that complements one or more Java 2 Platform Editions by adding domain-specific capabilities. Profiles may also include other defined Profiles. A profile implementation requires a Java 2 Platform Edition to create a complete development and deployment environment in a targeted vertical market. Each profile is subject to an associated set of compatibility requirements. Profiles may be usable on one or more editions. Some examples of profiles within the Java 2 Platform, Micro Edition are:* PersonalJava(TM) - for non-PC products that need to display web-compatible Java-based content* Java Card(TM) - for secure smart cards and other severely memory-constrained devices.
protected
A Java(TM) programming language keyword used in a method or variable declaration. It signifies that the method or variable can only be accessed by elements residing in its class, subclasses, or classes in the same package.
public
A Java(TM) programming language keyword used in a method or variable declaration. It signifies that the method or variable can be accessed by elements residing in other classes.

R
reference
A data element whose value is an address.
return
A Java(TM) programming language keyword used to finish the execution of a method. It can be followed by a value required by the method definition.
.
RMI
See Java Remote Method Invocation.
root
In a hierarchy of items, the one item from which all other items are descended. The root item has nothing above it in the hierarchy. See also hierarchy, class, package.
RPC
Remote Procedure Call. Executing what looks like a normal procedure call (or method invocation) by sending network packets to some remote host.
runtime system
The software environment in which programs compiled for the Java(TM) virtual machine* can run. The runtime system includes all the code necessary to load programs written in the Java programming language, dynamically link native methods, manage memory, handle exceptions, and an implementation of the Java virtual machine, which may be a Java interpreter.

S
Sandbox
Comprises a number of cooperating system components, ranging from security managers that execute as part of the application, to security measures designed into the Java(TM) virtual machine* and the language itself. The sandbox ensures that an untrusted, and possibly malicious, application cannot gain access to system resources.
scope
A characteristic of an identifier that determines where the identifier can be used. Most identifiers in the Java(TM) programming environment have either class or local scope. Instance and class variables and methods have class scope; they can be used outside the class and its subclasses only by prefixing them with an instance of the class or (for class variables and methods) with the class name. All other variables are declared within methods and have local scope; they can be used only within the enclosing block.
Secure Socket Layer (SSL)
A protocol that allows communication between a Web browser and a server to be encrypted for privacy.
servlet
A server-side program that gives Java(TM) technology-enabled servers additional functionality.
short
A Java(TM) programming language keyword used to define a variable of type short.
single precision
In the Java(TM) language specification, describes a floating point number with 32 bits of data. See also double precision.
.
static
A Java(TM) programming language keyword used to define a variable as a class variable. Classes maintain one copy of class variables regardless of how many instances exist of that class. "static" can also be used to define a method as a class method. Class methods are invoked by the class instead of a specific instance, and can only operate on class variables.
static field
Another name for class variable.
static method
Another name for class method.
subarray
An array that is inside another array.
subclass
A class that is derived from a particular class, perhaps with one or more classes in between. See also superclass, supertype.
subtype
If type X extends or implements type Y, then X is a subtype of Y. See also supertype.
superclass
A class from which a particular class is derived, perhaps with one or more classes in between. See also subclass, subtype.
super
A Java(TM) programming language keyword used to access members of a class inherited by the class in which it appears.
supertype
The supertypes of a type are all the interfaces and classes that are extended or implemented by that type. See also subtype, superclass.
switch
A Java(TM) programming language keyword used to evaluate a variable that can later be matched with a value specified by the "case" keyword in order to execute a group of statements.
Swing Set
The code name for a collection of graphical user interface (GUI) components that runs uniformly on any native platform which supports the Java(TM) virtual machine*. Because they are written entirely in the Java programming language, these components may provide functionality above and beyond that provided by native-platform equivalents. (Contrast with AWT.)
synchronized
A keyword in the Java programming language that, when applied to a method or code block, guarantees that at most one thread at a time executes that code.

T
TCP/IP
Transmission Control Protocol based on IP. This is an Internet protocol that provides for the reliable delivery of streams of data from one host to another. See also IP.
Thin Client
A system that runs a very light operating system with no local system administration and executes applications delivered over the network.
this
A Java(TM) programming language keyword that can be used to represent an instance of the class in which it appears. "this" can be used to access class variables and methods.
thread
The basic unit of program execution. A process can have several threads running concurrently, each performing a different job, such as waiting for events or performing a time-consuming job that the program doesn't need to complete before going on. When a thread has finished its job, the thread is suspended or destroyed. See also process.
throw
A Java(TM) programming language keyword that allows the user to throw an exception or any class that implements the "throwable" interface.
throws
A Java(TM) programming language keyword used in method declarations that specify which exceptions are not handled within the method but rather passed to the next higher level of the program.
transient
A keyword in the Java programming language that indicates that a field is not part of the serialized form of an object. When an object is serialized, the values of its transient fields are not included in the serial representation, while the values of its non-transient fields are included.
try
A Java(TM) programming language keyword that defines a block of statements that may throw a Java language exception. If an exception is thrown, an optional "catch" block can handle specific exceptions thrown within the "try" block. Also, an optional "finally" block will be executed regardless of whether an exception is thrown or not.
type
A class or interface.

U
Unicode
A 16-bit character set defined by ISO 10646. See also ASCII. All source code in the Java(TM) programming environment is written in Unicode.
URL
Uniform Resource Locator. A standard for writing a text reference to an arbitrary piece of data in the WWW. A URL looks like "protocol://host/localinfo" where protocol specifies a protocol to use to fetch the object (like HTTP or FTP), host specifies the Internet name of the host on which to find it, and localinfo is a string (often a file name) passed to the protocol handler on the remote host.
variable
An item of data named by an identifier. Each variable has a type, such as int or Object, and a scope. See also class variable, instance variable, local variable.
virtual machine
An abstract specification for a computing device that can be implemented in different ways, in software or hardware. You compile to the instruction set of a virtual machine much like you'd compile to the instruction set of a microprocessor. The Java(TM) virtual machine* consists of a bytecode instruction set, a set of registers, a stack, a garbage-collected heap, and an area for storing methods.
void
A Java(TM) programming language keyword used in method declarations to specify that the method does not return any value. "void" can also be used as a nonfunctional statement.
volatile
A Java(TM) programming language keyword used in variable declarations that specifies that the variable is modified asynchronously by concurrently running threads.

W
wait
A UNIX® command which will wait for all background processes to complete, and report their termination status.
while
A Java(TM) programming language keyword used to declare a loop that iterates a block of statements. The loop`s exit condition is specified as part of the while statement.
world readable files
Files on a file system that can be viewed (read) by any user. For example: files residing on web servers can only be viewed by Internet users if their permissions have been set to world readable.
wrapper
An object that encapsulates and delegates to another object to alter its interface or behavior in some way.

LinkWithin

Related Posts Plugin for WordPress, Blogger...