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

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.

Edited 2 Years Ago by hannahaddad

This article has been dead for over six months. Start a new discussion instead.