Skip to main content

Posts

Showing posts from June, 2012

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;