» » Simple Way to Import all Missing Packages at Once : Eclipse shortcut

1.How to import all missing packages at once in java program eclipse:

  • While writing a java program or copied some line to eclipse then we need to import corresponding java packages.
  • Instead of checking one by one there is a short cut in eclipse to import corresponding packages at once
  • There is a short cut key to import all missing packages at once
  • "CTL+SHIFT+O" then one popup will come with all corresponding packages so we need to select corresponding missing package name then it automatically come. one by one it will automatically ask and we need to select.
  • Lets see an example program.

1.Copy This program and paste in eclipse and remove all packages.
2.Then it will show some errors on classes 
3. select CTL+SHIFT+O
4.Select missing packages


  1. package com.javacheckvaluehashmap;
  2.  
  3.  
  4. public class HashmapExample{
  5.  
  6. public static void main(String[] args) {
  7.   
  8. //create an Hashmap object
  9. HashMap<String, String> hashmap = new HashMap();
  10.        
  11. //Add key values pairs to hashmap
  12.         
  13. hashmap.put("1","One");
  14. hashmap.put("2","Two");
  15. hashmap.put("3","Three");
  16. hashmap.put("4","Four");
  17. hashmap.put("5","Five");
  18. hashmap.put("6","Six");       
  19.         
  20.        
  21. boolean isExists = hashmap.containsValue("Six");
  22. System.out.println("The value Six exists in HashMap ? : " + isExists);
  23.     
  24.  
  25. if(!hashmap.isEmpty()){
  26.  
  27. Iterator it=hashmap.entrySet().iterator();
  28.              
  29. while(it.hasNext()){

  30. Map.Entry obj=(Entry) it.next();
  31. System.out.print(obj.getKey()+" ");
  32. System.out.println(obj.getValue());
  33.              
  34. }           
  35. }   
  36.  
  37. }
  38.  
  39. }
     


eclipse short cut import all missing packages at once





import all missing packages once java program



Instance Of Java

We will help you in learning.Please leave your comments and suggestions in comment section. if you any doubts please use search box provided right side. Search there for answers thank you.
«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply

Select Menu