1.How to import all missing packages at once in java program eclipse:
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
- 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
- package com.javacheckvaluehashmap;
- public class HashmapExample{
- public static void main(String[] args) {
- //create an Hashmap object
- HashMap<String, String> hashmap = new HashMap();
- //Add key values pairs to hashmap
- hashmap.put("1","One");
- hashmap.put("2","Two");
- hashmap.put("3","Three");
- hashmap.put("4","Four");
- hashmap.put("5","Five");
- hashmap.put("6","Six");
- boolean isExists = hashmap.containsValue("Six");
- System.out.println("The value Six exists in HashMap ? : " + isExists);
- if(!hashmap.isEmpty()){
- Iterator it=hashmap.entrySet().iterator();
- while(it.hasNext()){
- Map.Entry obj=(Entry) it.next();
- System.out.print(obj.getKey()+" ");
- System.out.println(obj.getValue());
- }
- }
- }
- }
Bagikan
Simple Way to Import all Missing Packages at Once : Eclipse shortcut
4/
5
Oleh
Kris Kimcil