Skip to main content

Posts

How To Use HashTable?

Hashtable maps one KEY with ONE value. like Hashtable numbers = new Hashtable(); numbers.put("1", new Integer(1)); numbers.put("2", new Integer(2)); numbers.put("3", new Integer(3)); numbers.put("4", new Integer(4)); My problem is -- how to map multiple value with singlt KEY numbers.put("1", new Integer(1)); numbers.put("1", new Integer(2)); numbers.put("1", new Integer(3)); numbers.put("2", new Integer(4)); numbers.put("2", new Integer(1)); numbers.put("2", new Integer(2)); numbers.put("3", new Integer(3)); numbers.put("4", new Integer(4)); How to keep the multiple value with singl KEY... if any one has some code

What are the uses of Java Packages?

It helps resolve naming conflicts when different packages have classes with the same names. This also helps you organize files within your project. For example: java.io - package do something related to I/O and java.net - package do something to do with network and so on. If we tend to put all .java files into a single package, as the project gets bigger, then it would become a nightmare to manage all your files. You can create a package as follows with package keyword, which is the first keyword in any Java program followed by import statements. The java.lang package is imported implicitly by default and all the other packages must be explicitly imported. package com.xyz.client ; import java.io.File; import java.net.URL;

Describe, in general, how java's garbage collector works?

The Java runtime environment deletes objects when it determines that they are no longer being used. This process is known as garbage collection. The Java runtime environment supports a garbage collector that periodically frees the memory used by objects that are no longer needed. The Java garbage collector is a mark-sweep garbage collector that scans Java's dynamic memory areas for objects, marking those that are referenced. After all possible paths to objects are investigated, those objects that are not marked (i.e. are not referenced) are known to be garbage and are collected. (A more complete description of our garbage collection algorithm might be "A compacting, mark-sweep collector with some conservative scanning".) The garbage collector runs synchronously when the system runs out of memory, or in response to a request from a Java program. Your Java program can ask the garbage collector to run at any time by calling System.gc(). The garbage collector requires abo...

Spring FAQs

What is Spring? Spring is a framework that resolves common problems in JEE architecture.  It is a very light-weight and open source framework because of it's POJO model. It is called as modular framework, since it comes as diffrent modules(we will discuss about these modules in below sections). We can use all modules to develop application or we can use only one module, whichever we required. Spring is called as non-invasive framework. It will not compell a developer to extend any of it's calss or implement any of it's interfaces, where Struts framework forces a developer to extend its Action class. i.e. Struts is said to be invasive frameowrk. Managing business objects and encouraging practices such as programming interfaces rather than classes is a consistent way of using Spring.  Spring addresses all architectural tiers with basic building block by utilizing IoC.  Unique data access abstraction including abstraction of JDBC framework improves the productivity ...

20 Best Websites To Learn AJAX

Ajax (asynchronous JavaScript and XML) is a technology that allows for for highly-interactive and responsive browser-based applications. By leveraging the XMLHttpRequest object, seamless communication with the server can be achieved for a smooth and dynamic user experience. If you've ever wanted to learn about Ajax , there are many sites out there that'll help you "grok" Ajax and the various technologies surrounding it. Here are 20 top-notch websites that cover the subject of Ajax . 1. Ajax resource center (developerWorks) developerWorks, a resource center for developers and IT professionals by IBM, has a dedicated Ajax resource center that hosts plenty of tutorials on Ajax. developerWorks tutorials are in-depth and lengthy, and you can learn a variety of information and techniques from them such as creating RIA applications with jQuery and Ajax , learning about Ajax security tools , and building an Ajax-based chat system .

How does exception handling work in Java?

1.It separates the working/functional code from the error-handling code by way of try-catch clauses. 2.It allows a clean path for error propagation. If the called method encounters a situation it can't manage, it can throw an exception and let the calling method deal with it. 3.By enlisting the compiler to ensure that "exceptional" situations are anticipated and accounted for, it enforces powerful coding. 4.Exceptions are of two types: Compiler-enforced exceptions, or checked exceptions. Runtime exceptions, or unchecked exceptions. Compiler-enforced (checked) exceptions are instances of the Exception class or one of its subclasses — excluding the RuntimeException branch.