1600 PMP mock questions 1400 CAPM mock questions 800 SCJP 6 mock questions 600 OCAJP 7 mock questions 590 OCPJP 7 mock questions 556 SCWCD 5 mock questions 500 OCEJWCD 6 mock questions pdfDownload (java,struts, hibernet etc)
 

Recent Questions

  • How to retrieve a key and Value from a map ? view answer
  • Why can an interface supertype call methods that belong to Object class? view answer
  • Q. What is difference between shallow copy and deep copy ? view answer
  • Q.Why to override equals() and hashCode()? and How i can implement both equals() and hashCode() for Set ? view answer
  • Q.How to sort list of objects ( User Defined) using comparator? in Descending Order. view answer
  • Q. How to sort list of objects ( User Defined) using comparator? view answer
  • What is the difference between int and Interger? view answer
  • Singleton Double-checked locking in Java? view answer
  • What are the parameters to follow Creating and Destroying Objects in Java? view answer
  • Q.What are the different scopes for Java variables? view answer
  • Q.What method must be implemented by all threads? view answer
  • Q.Can an unreachable object become reachable again? view answer
  • Q.What are the steps in the JDBC connection? view answer
  • Q.How are this() and super() used with constructors? view answer
  • Q.What is the difference between static and non-static variables? view answer
  • Q.What is the purpose of finalization? view answer
  • Q.Does garbage collection guarantee that a program will not run out of memory? view answer
  • Q.What is synchronization and why is it important? view answer
  • Q.What is daemon thread and which method is used to create the daemon thread? view answer
  • Q.What are synchronized methods and synchronized statements? view answer
  • Q.If I write System.exit (0); at the end of the try block, will the finally block still execute? view answer
  • Q.If I write return at the end of the try block, will the finally block still execute? view answer
  • Q.Is it necessary that each try block must be followed by a catch block? view answer
  • Q.What is the basic difference between the 2 approaches to exception handling. 1> try catch block and 2> specifying the candidate exceptions in the throws clause? When should you use which approach? view answer
  • Q.What are the different ways to handle exceptions? view answer
  • Q.What is the difference between error and an exception? view answer
  • Q: What is wrapper class? Explain with example? view answer
  • Q.What is serialization? Explain with example? view answer
  • Q.What one should take care of while serializing the object? view answer
  • Q. When you serialize an object, what happens to the object references included in the object? view answer
  • Q.What happens to the static fields of a class during serialization? view answer
  • Q. Objects are passed by value or by reference? view answer
  • Q. Primitive data types are passed by reference or pass by value? view answer
  • Q. What type of parameter passing does Java support? view answer
  • Q.Can a top level class be private or protected? view answer
  • Q.What is the default value of an object reference declared as an instance variable? view answer
  • Q.What is the difference between declaring a variable and defining a variable? view answer
  • Q. What are different types of inner classes? view answer
  • Q. What is Overriding? view answer
  • Q.What are Checked and UnChecked Exception? view answer
  • Q. What is final? view answer
  • Q.What is static in java? view answer
  • What is an abstract class? view answer
  • Q. What are the modifiers in Java ? view answer
  • Q.Difference between HashMap and HashTable? view answer
  • Q.Difference between Vector and ArrayList? view answer
  • Q.Difference between ArrayList and LinkedList? view answer
  • Q.What are pass by reference and passby value in Java? view answer
  • Q. When we go for Abstract and Interface in Java? view answer
  • Q.What is the difference between interface and abstract class? view answer
  • Q.What are the Garbage collection algorithms in Java? view answer
  • Q.What is garbage collection and the purpose of garbage collection in Java? view answer
  • Q. What is the difference between an Interface and an Abstract class? view answer

!!! Java Frequently Asked Questions !!!

How to retrieve a key and Value from a map ?

!!!Answer!!!- From Technical Expert

Map<String, Object> map = new HashMap<String, Object>();

for (String key : map.keySet()) {
Object value = map.get(key);
// ...
}

OR

class Test{

public static void main(String[] args) {
Map map = new HashMap();
map.put("man", "john");
map.put("woman", "jane");
System.out.println("Key for john is: " +
getKey(map, "john"));
}

private static String getKey(Map map, String value) {
for (Iterator i = map.keySet().iterator(); i.hasNext() {
String key = (String)i.next();
if (map.get(key).equals(value)) {
return key;
}
}
return "No value found";
}
}

Answered By : name Replied Date : Jul 25 2008
Answer : ??????????


Answered By : n Replied Date : Jan 22 2012
Answer : n


Answered By : aaaa Replied Date : Oct 11 2008
Answer : if u dint have answers why did u create questions and wasting time of people who r in search of answers


Answered By : satya Replied Date : Oct 21 2008
Answer : import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;

class Test {

public static void main(String[] args) {

// put value
Map map = new HashMap();
map.put("man", "nick");
map.put("woman", "jane");


//retrive value

Iterator itr = map .keySet().iterator();
while(itr.hasNext()){
String key = (String)itr.next();
String value = (String)map .get(key);
System.out.println("key "+key+" value "+value);


}

}


Answered By : satya Replied Date : Oct 21 2008
Answer : import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class MapKeyValue {

public static void main(String[] args) {
Map map = new HashMap();
map.put("man", "nick");
map.put("woman", "jane");
Iterator iter = map.entrySet().iterator();
while(iter.hasNext()){
Map.Entry entry = (Map.Entry) iter.next();
String key = entry.getKey().toString();
String value = entry.getValue().toString();
System.out.println("Key: "+key+" *Value: "+value);
}


}

}


Answered By : null Replied Date : Dec 28 2013
Answer :


Answered By : null Replied Date : Oct 31 2013
Answer :


Answered By : null Replied Date : Oct 23 2013
Answer :


Answered By : null Replied Date : Feb 7 2014
Answer :


Answered By : genius Replied Date : Feb 12 2014
Answer : dont wate students time this type of stupid websites


Answered By : genius Replied Date : Feb 12 2014
Answer : dont waste students time by this type of stupid websites


Answered By : null Replied Date : Mar 24 2014
Answer :


Answered By : null Replied Date : Apr 5 2014
Answer :


Answered By : null Replied Date : Apr 28 2014
Answer :


Answered By : null Replied Date : Jun 10 2014
Answer :


Answered By : null Replied Date : Aug 4 2014
Answer :


Answered By : null Replied Date : Oct 2 2014
Answer :


Answered By : null Replied Date : Nov 9 2014
Answer :


Answered By : null Replied Date : Nov 28 2014
Answer :


Answered By : null Replied Date : Jul 4 2015
Answer :


Answered By : null Replied Date : Jan 3 2016
Answer :


Answered By : null Replied Date : Apr 10 2016
Answer :


Answered By : null Replied Date : Apr 18 2016
Answer :


Answered By : null Replied Date : Jan 1 2017
Answer :


Answered By : null Replied Date : Jun 20 2017
Answer :


Answered By : null Replied Date : Jul 15 2017
Answer :


Answered By : null Replied Date : Aug 1 2017
Answer :


 

You can also contribute to this answer:

Your Name:
Answer:

 
Ask Question and get answer from Expert.
View Answers List from Expert.

Reviews and Comments


PMP, CAPM, PMI is a registered certification mark of the Project Management Institute, Inc

Copyright © www.techfaq360.com 2016


About US | Contact US | Privacy Policy | Terms and Conditions  | Website disclaimer  | Cancellation and Refund Policy  | Shipping & Delivery Policy