import java.lang.*;
import java.util.*;



class Project {

    public static void main(String a[]){
        Hashtable<String,String>language=new Hashtable<String,String>();
Enumeration<String>names;
String str1;
String lang;
    language.put("insert","Load");
    language.put( "select","Dump"); 
    language.put("*","All");
        language.put("from","as");
    language.put( "where","Filter");
    language.put( "Group","Group");
    language.put ("Join","Join");
    language.put("Order By","Order By");
    language.put("Distinct","Distinct");     
    language.put("Count in lines","Limit");
    language.put("set","set");
    language.put( "Describe","Describe");
    language.put( "Group By","CoGroup");
    language.put("delete","Flatten");
    language.put("dual","Sample");
    language.put( "into","as");
    language.put( "count *","count star");
    language.put("Foreach","all");
    language.put("Union","Union");

        String str = "select * from emp ";
        String[] tokens = str.split(" ");
   names=language.keys();
   int i;
String pig="";
        for(i=0;i<tokens.length;i++)
{
    String key= tokens[i];

        for(Map.Entry entry: language.entrySet()){
            if(key.equals(entry.getKey())){
               String val = entry.getValue().toString();

 System.out.println( key +"   "+ val);
pig=pig+val;

break;

}

        }



        tokens = str.split("\\s+");
}


    }

System.out.println(pig);
}

i am getting error at System.out.println(pig); can anyone help me out kindly

Looks like it moight be out of scope, but until you fix your indentation it's too hard to see.

yes, seems like the print statement is placed outside the method, which is illegal and generates a compiler error.

i think that "System.out.println(pig);" in line 63 should be in the line 60, before the left brace.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.