Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


hossain aboutalebi
INTERPRETER
2 Answer(s)      2 years and 8 months ago
Posted in : Java Magazine


how to write a simple interpreter in java that can execute simple commandes like adding two integers and sysout a result and calling java classes and executing the methodes in that class .


Advertisement
View Answers

August 14, 2012 at 4:16 PM


Well although there was nobody found to answer this tricky question I myself answered it :

The first class (main class):
package bb;

import java.io.File;
import java.io.FileNotFoundException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

        public class main {

        static   Object o;
        static      int j=0;

            static Object []ss=new Object[10];
    static Object []dd=new Object[10];
    static HashMap<String , Object> map= new HashMap<String, Object>();

    public static void main(String[] args) throws Exception {
        Scanner s=new Scanner(System.in);

        System.out.println("Please Enter File Name !");
        File x=new File(s.nextLine());
        Scanner sc=new Scanner(x);

        do{

            String h=sc.nextLine();
            if(h.contains("=")){
                String[]hh=h.split(" ");

                if(hh[2].equals("=")){
                     //Double√?¬ d√?¬ =√?¬ new√?¬ Double(14.7);
                    Class c=Class.forName(hh[0]);
                    if(h.contains("new")==true){
                    String co=hh[4].substring(hh[4].indexOf("(")+1, hh[4].length()-2);
                    String[] input=co.split(",");
                    Class []cInput=Getinput(input);
                    Object o=GetObject(c,cInput,ss);
                    map.put(hh[1], o);

                    }else{
                        //Long√?¬ l√?¬ =√?¬ d.LongValue();
                        if(map.containsKey(hh[3].substring(0, hh[3].indexOf(".")))==false){

                        MethodesFeilds mf=new MethodesFeilds (hh[3].substring(0,hh[3].length()-1),map);
                        Object o=mf.main();
                        map.put(hh[1], o);

                        }else{
                            Object o=map.get(hh[3].substring(0, hh[3].indexOf(".")));
                            Object o2=ObjectMethod(o,o.getClass(),hh[3].substring(hh[3].indexOf(".")+1,hh[3].length()-1));
                            map.put(hh[1], o2);

                        }

                    }
            }else if(hh[1].equals("=")){
                // d=new boolean(false);
            Class c=map.get(hh[0]).getClass();
                map.remove(hh[0]);
            if(h.contains("new")==true){
                String co=hh[3].substring(hh[3].indexOf("(")+1, hh[3].length()-2);
                String[] input=co.split(",");
                Class []cInput=Getinput(input);
                Object o=GetObject(c,cInput,ss);
                map.put(hh[0], o);

                }else{
                    //√?¬ l√?¬ =√?¬ d.LongValue();
                    if(map.containsKey(hh[2].substring(0, hh[2].indexOf(".")))==false){
                    MethodesFeilds mf=new MethodesFeilds (hh[2].substring(0,hh[2].length()-1),map);
                    Object o=mf.main();
                    map.put(hh[0], o);

                    }else{
                        Object o=map.get(hh[2].substring(0, hh[2].indexOf(".")));
                        Object o2=ObjectMethod(o,o.getClass(),hh[2].substring(hh[2].indexOf(".")+1,hh[2].length()-1));
                        map.put(hh[0], o2);
                    }
            }
            }
            }else{
                MethodesFeilds x1=new MethodesFeilds(h.substring(0,h.length()-1),map);
                    x1.main();
            }

        }while(sc.hasNext()==true);         
}

    public static Class[] Getinput( String[] input) {

        if(input.length==1&&input[0].equals("")){
            Class[]o2=new Class[0];
            return o2;}
        else{Class[]o=new Class[input.length];
        for (int i = 0; i < input.length; i++) {
            if(  map.containsKey(input[i])   ){
                ss[i]=map.get(input[i]);
                if(ss[i].getClass().equals(Long.class))
                    o[i]=long.class;

                else if(ss[i].getClass().equals(Double.class)){
                    o[i]=double.class;

                        }
                 else if (ss[i].getClass().equals(String.class)) {
                        o[i]=String.class;

                 }else if((ss[i].toString().charAt(0)==('f')||ss[i].toString().charAt(0)==('t'))) {
                        o[i]=boolean.class;

                 }else{
                     o[i]=int.class;

                 }
            }   
            else if(input[i].contains(".")){
            o[i]=double.class;
            ss[i]=Double.parseDouble(input[i] ); 
                }

            else if (input[i].charAt(0)==('"')||input[i].contains("'")) {
                o[i]=String.class;
                ss[i]=input[i].substring(1,input[i].length()-1);
         }else if((input[i].charAt(0)==('f')||input[i].charAt(0)==('t'))) {
                o[i]=boolean.class;
                ss[i]=Boolean.parseBoolean (input[i] ); 
         }else{
             o[i]=int.class;
             ss[i]=Integer.parseInt(input[i] ); 
         }



    }
        return o;}
    }
    public static Object GetObject(Class c, Class[] cInput,Object[]x) throws Exception {

        if(cInput.length==0){
            Object o=c.newInstance();
            return o;       
        }else if(cInput.length==1){
            Constructor cons =c.getConstructor(cInput[0]);
            Object o=cons.newInstance(x[0]);
            return o;
        }else if(cInput.length==2){
            Constructor cons =c.getConstructor(cInput[0],cInput[1]);
            Object o=cons.newInstance(x[0],x[1]);
            return o;

        }else if(cInput.length==3){
            Constructor cons =c.getConstructor(cInput[0],cInput[1],cInput[2]);
            Object o=cons.newInstance(x[0],x[1],x[2]);
            return o;

        }
            return null;        
    }

    public static Object ObjectMethod(Object o2, Class c, String input) throws Exception {
        String a=input.substring(0, input.indexOf("("));
        String b=input.substring(input.indexOf("(")+1, input.indexOf(")"));
        String[]x=a.split("\\.");
        while(input.equals("")==false){


            int i=x.length-1;
            while(i>=0){
                if(input.contains("(")&&i==0){
                    String[] Minput=b.split(",");
                    Class []cInput=Getinput(Minput);
                    if(cInput.length==0){
                        Method m= c.getDeclaredMethod(x[x.length-1], null);
                        o=m.invoke(o2, null);
                    }else if(cInput.length==1){
                        Method m= c.getDeclaredMethod(x[x.length-1], cInput[0]);
                        o=m.invoke(o2, dd[0]);
                    }else if(cInput.length==2){
                        Method m= c.getDeclaredMethod(x[x.length-1], cInput[0],cInput[1]);
                        o=m.invoke(o2, dd[0],dd[1]);
                    }else if(cInput.length==3){
                        Method m= c.getClass().getDeclaredMethod(x[x.length-1], cInput[0],cInput[1],cInput[2]);
                        o=m.invoke(o2, dd[0],dd[1],dd[2]);
                    }

                }else{
                    Field f=c.getDeclaredField(x[j]);
                    o =f.get(o2);

                }
                i--;
                j++;

                c=o.getClass();

            }
            input=input.substring( input.indexOf(")")+1, input.length());
            if(input.equals("")==false) {
            a=input.substring(0, input.indexOf("("));
            x=a.split("\\.");
                b=input.substring(input.indexOf("(")+1, input.indexOf(")"));}
        }
    return o;
    }

        }
The second class(Methodes Fields):
package bb;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;

public class MethodesFeilds {
    static Object []ss=new Object[10];
    String input;
    HashMap<String,Object>map=new HashMap<String,Object>();
    Object o=null;
    int j=3;
    public MethodesFeilds(String x, HashMap<String,Object> map2){
        map=map2;
        input=x;

    }
    public Object main() throws Exception {
        if(input.contains("java.lang.")){
        String a=input.substring(0, input.indexOf("("));
        String b=input.substring(input.indexOf("(")+1, input.indexOf(")"));
        String[]x=a.split("\\.");

        Class c=Class.forName("java.lang."+x[2]);

        int i=x.length-4;
        while(input.equals("")==false){
        while(i>=0){

            if((b.equals("")==false)&&i==0){
                String[] Minput=b.split(",");
                Class []cInput=Getinput(Minput);
                if(cInput.length==0){
                    Method m= c.getDeclaredMethod(x[x.length-1], null);
                    o=m.invoke(o, null);
                    if(o==null)break;
                }else if(cInput.length==1){
                    Method m= c.getDeclaredMethod(x[x.length-1], cInput[0]);

                    o=m.invoke(o, ss[0]);
                if(o==null)break;
                }else if(cInput.length==2){
                    Method m= c.getDeclaredMethod(x[x.length-1], cInput[0],cInput[1]);
                    o=m.invoke(o, ss[0],ss[1]);
                    if(o==null)break;
                }else if(cInput.length==3){
                    Method m= c.getClass().getDeclaredMethod(x[x.length-1], cInput[0],cInput[1],cInput[2]);
                    o=m.invoke(o, ss[0],ss[1],ss[2]);
                    if(o==null)break;
                }

            }else{
                Field f=c.getDeclaredField(x[j]);
              o=f.get(o);

            }
            i--;
            j++;

            c=o.getClass();
        }input=input.substring( input.indexOf(")")+1, input.length());
            if(input.equals("")==false) {
            a=input.substring(0, input.indexOf("("));
            x=a.split("\\.");
                b=input.substring(input.indexOf("(")+1, input.indexOf(")"));}



    }
        }else
        {
                String a=input.substring(0, input.indexOf("("));
                String b=input.substring(input.indexOf("(")+1, input.indexOf(")"));
                String[]x=a.split("\\.");

                Class c=Class.forName(x[0]);
            j=1;
                int i=x.length-2;
                while(input.equals("")==false){
                while(i>=0){

                    if(input.contains("(")&&i==0){
                        String[] Minput=b.split(",");
                        Class []cInput=Getinput(Minput);
                        if(cInput.length==0){
                            Method m= c.getDeclaredMethod(x[x.length-1], null);
                            o=m.invoke(o, null);
                            if(o==null)break;
                        }else if(cInput.length==1){
                            Method m= c.getDeclaredMethod(x[x.length-1], cInput[0]);
                            o=m.invoke(o, ss[0]);
                            if(o==null)break;
                        }else if(cInput.length==2){
                            Method m= c.getDeclaredMethod(x[x.length-1], cInput[0],cInput[1]);
                            o=m.invoke(o, ss[0],ss[1]);
                            if(o==null)break;
                        }else if(cInput.length==3){
                            Method m= c.getClass().getDeclaredMethod(x[x.length-1], cInput[0],cInput[1],cInput[2]);
                            o=m.invoke(o, ss[0],ss[1],ss[2]);
                            if(o==null)break;
                        }

                    }else{
                        Field f=c.getDeclaredField(x[j]);
                        Object o=f.get(null);
                    }
                    i--;
                    j++;

                    c=o.getClass();
                }input=input.substring( input.indexOf(")")+1, input.length());
                    if(input.equals("")==false) {
                    a=input.substring(0, input.indexOf("("));
                    x=a.split("\\.");
                    b=input.substring(input.indexOf("(")+1, input.indexOf(")"));
                    }
            }

        }
        return o;
    }
    public  Class[] Getinput( String[] input) {
        if(input.length==1&&input[0].equals("")){
            Class[]o2=new Class[0];
            return o2;}
        else{
        Class[]o=new Class[input.length];
        for (int i = 0; i < input.length; i++) {
            if(  map.containsKey(input[i])   ){
                ss[i]=map.get(input[i]);
                if(ss[i].getClass().equals(Long.class))
                    o[i]=long.class;

                else if(ss[i].getClass().equals(Double.class)){
                    o[i]=double.class;

                        }
                 else if (ss[i].getClass().equals(String.class)) {
                        o[i]=String.class;

                 }else if((ss[i].toString().charAt(0)==('f')||ss[i].toString().charAt(0)==('t'))) {
                        o[i]=boolean.class;

                 }else{
                     o[i]=int.class;

                 }
            }   
            else if(input[i].contains(".")){
            o[i]=double.class;
            ss[i]=Double.parseDouble(input[i] ); 
                }

            else if (input[i].charAt(0)==('"')||input[i].contains("'")) {
                o[i]=String.class;
                ss[i]=input[i].substring(1,input[i].length()-1);
         }else if((input[i].charAt(0)==('f')||input[i].charAt(0)==('t'))) {
                o[i]=boolean.class;
                ss[i]=Boolean.parseBoolean (input[i] ); 
         }else{
             o[i]=int.class;
             ss[i]=Integer.parseInt(input[i] ); 
         }
    }
        return o;
    }}
}

for more information contact me with my mail:



August 14, 2012 at 4:16 PM


Well although there was nobody found to answer this tricky question I myself answered it :

The first class (main class):

package bb;

import java.io.File;
import java.io.FileNotFoundException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

        public class main {

        static   Object o;
        static      int j=0;

            static Object []ss=new Object[10];
    static Object []dd=new Object[10];
    static HashMap<String , Object> map= new HashMap<String, Object>();

    public static void main(String[] args) throws Exception {
        Scanner s=new Scanner(System.in);

        System.out.println("Please Enter File Name !");
        File x=new File(s.nextLine());
        Scanner sc=new Scanner(x);

        do{

            String h=sc.nextLine();
            if(h.contains("=")){
                String[]hh=h.split(" ");

                if(hh[2].equals("=")){
                     //Double√?¬ d√?¬ =√?¬ new√?¬ Double(14.7);
                    Class c=Class.forName(hh[0]);
                    if(h.contains("new")==true){
                    String co=hh[4].substring(hh[4].indexOf("(")+1, hh[4].length()-2);
                    String[] input=co.split(",");
                    Class []cInput=Getinput(input);
                    Object o=GetObject(c,cInput,ss);
                    map.put(hh[1], o);

                    }else{
                        //Long√?¬ l√?¬ =√?¬ d.LongValue();
                        if(map.containsKey(hh[3].substring(0, hh[3].indexOf(".")))==false){

                        MethodesFeilds mf=new MethodesFeilds (hh[3].substring(0,hh[3].length()-1),map);
                        Object o=mf.main();
                        map.put(hh[1], o);

                        }else{
                            Object o=map.get(hh[3].substring(0, hh[3].indexOf(".")));
                            Object o2=ObjectMethod(o,o.getClass(),hh[3].substring(hh[3].indexOf(".")+1,hh[3].length()-1));
                            map.put(hh[1], o2);

                        }

                    }
            }else if(hh[1].equals("=")){
                // d=new boolean(false);
            Class c=map.get(hh[0]).getClass();
                map.remove(hh[0]);
            if(h.contains("new")==true){
                String co=hh[3].substring(hh[3].indexOf("(")+1, hh[3].length()-2);
                String[] input=co.split(",");
                Class []cInput=Getinput(input);
                Object o=GetObject(c,cInput,ss);
                map.put(hh[0], o);

                }else{
                    //√?¬ l√?¬ =√?¬ d.LongValue();
                    if(map.containsKey(hh[2].substring(0, hh[2].indexOf(".")))==false){
                    MethodesFeilds mf=new MethodesFeilds (hh[2].substring(0,hh[2].length()-1),map);
                    Object o=mf.main();
                    map.put(hh[0], o);

                    }else{
                        Object o=map.get(hh[2].substring(0, hh[2].indexOf(".")));
                        Object o2=ObjectMethod(o,o.getClass(),hh[2].substring(hh[2].indexOf(".")+1,hh[2].length()-1));
                        map.put(hh[0], o2);

                    }

            }
            }
            }else{
                MethodesFeilds x1=new MethodesFeilds(h.substring(0,h.length()-1),map);
                    x1.main();
            }

        }while(sc.hasNext()==true);
}
    public static Class[] Getinput( String[] input) {

        if(input.length==1&&input[0].equals("")){
            Class[]o2=new Class[0];
            return o2;}
        else{Class[]o=new Class[input.length];
        for (int i = 0; i < input.length; i++) {
            if(  map.containsKey(input[i])   ){
                ss[i]=map.get(input[i]);
                if(ss[i].getClass().equals(Long.class))
                    o[i]=long.class;

                else if(ss[i].getClass().equals(Double.class)){
                    o[i]=double.class;

                        }
                 else if (ss[i].getClass().equals(String.class)) {
                        o[i]=String.class;

                 }else if((ss[i].toString().charAt(0)==('f')||ss[i].toString().charAt(0)==('t'))) {
                        o[i]=boolean.class;

                 }else{
                     o[i]=int.class;

                 }
            }   
            else if(input[i].contains(".")){
            o[i]=double.class;
            ss[i]=Double.parseDouble(input[i] ); 
                }

            else if (input[i].charAt(0)==('"')||input[i].contains("'")) {
                o[i]=String.class;
                ss[i]=input[i].substring(1,input[i].length()-1);
         }else if((input[i].charAt(0)==('f')||input[i].charAt(0)==('t'))) {
                o[i]=boolean.class;
                ss[i]=Boolean.parseBoolean (input[i] ); 
         }else{
             o[i]=int.class;
             ss[i]=Integer.parseInt(input[i] ); 
         }  

    }
        return o;}
    }
    public static Object GetObject(Class c, Class[] cInput,Object[]x) throws Exception {

        if(cInput.length==0){
            Object o=c.newInstance();
            return o;       
        }else if(cInput.length==1){
            Constructor cons =c.getConstructor(cInput[0]);
            Object o=cons.newInstance(x[0]);
            return o;
        }else if(cInput.length==2){
            Constructor cons =c.getConstructor(cInput[0],cInput[1]);
            Object o=cons.newInstance(x[0],x[1]);
            return o;

        }else if(cInput.length==3){
            Constructor cons =c.getConstructor(cInput[0],cInput[1],cInput[2]);
            Object o=cons.newInstance(x[0],x[1],x[2]);
            return o;

        }
            return null;        
    }

    public static Object ObjectMethod(Object o2, Class c, String input) throws Exception {
        String a=input.substring(0, input.indexOf("("));
        String b=input.substring(input.indexOf("(")+1, input.indexOf(")"));
        String[]x=a.split("\\.");
        while(input.equals("")==false){


            int i=x.length-1;
            while(i>=0){
                if(input.contains("(")&&i==0){
                    String[] Minput=b.split(",");
                    Class []cInput=Getinput(Minput);
                    if(cInput.length==0){
                        Method m= c.getDeclaredMethod(x[x.length-1], null);
                        o=m.invoke(o2, null);
                    }else if(cInput.length==1){
                        Method m= c.getDeclaredMethod(x[x.length-1], cInput[0]);
                        o=m.invoke(o2, dd[0]);
                    }else if(cInput.length==2){
                        Method m= c.getDeclaredMethod(x[x.length-1], cInput[0],cInput[1]);
                        o=m.invoke(o2, dd[0],dd[1]);
                    }else if(cInput.length==3){
                        Method m= c.getClass().getDeclaredMethod(x[x.length-1], cInput[0],cInput[1],cInput[2]);
                        o=m.invoke(o2, dd[0],dd[1],dd[2]);
                    }

                }else{
                    Field f=c.getDeclaredField(x[j]);
                    o =f.get(o2);

                }
                i--;
                j++;

                c=o.getClass();

            }
            input=input.substring( input.indexOf(")")+1, input.length());
            if(input.equals("")==false) {
            a=input.substring(0, input.indexOf("("));
            x=a.split("\\.");
                b=input.substring(input.indexOf("(")+1, input.indexOf(")"));}
        }
    return o;
    }

        }
 The second class(Methodes Fields):
package bb;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;

public class MethodesFeilds {
    static Object []ss=new Object[10];
    String input;
    HashMap<String,Object>map=new HashMap<String,Object>();
    Object o=null;
    int j=3;
    public MethodesFeilds(String x, HashMap<String,Object> map2){
        map=map2;
        input=x;

    }

    public Object main() throws Exception { 
        if(input.contains("java.lang.")){
        String a=input.substring(0, input.indexOf("("));
        String b=input.substring(input.indexOf("(")+1, input.indexOf(")"));
        String[]x=a.split("\\.");
        Class c=Class.forName("java.lang."+x[2]);
        int i=x.length-4;
        while(input.equals("")==false){
        while(i>=0){

            if((b.equals("")==false)&&i==0){
                String[] Minput=b.split(",");
                Class []cInput=Getinput(Minput);
                if(cInput.length==0){
                    Method m= c.getDeclaredMethod(x[x.length-1], null);
                    o=m.invoke(o, null);
                    if(o==null)break;
                }else if(cInput.length==1){
                    Method m= c.getDeclaredMethod(x[x.length-1], cInput[0]);

                    o=m.invoke(o, ss[0]);
                if(o==null)break;
                }else if(cInput.length==2){
                    Method m= c.getDeclaredMethod(x[x.length-1], cInput[0],cInput[1]);
                    o=m.invoke(o, ss[0],ss[1]);
                    if(o==null)break;
                }else if(cInput.length==3){
                    Method m= c.getClass().getDeclaredMethod(x[x.length-1], cInput[0],cInput[1],cInput[2]);
                    o=m.invoke(o, ss[0],ss[1],ss[2]);
                    if(o==null)break;
                }

            }else{
                Field f=c.getDeclaredField(x[j]);
              o=f.get(o);

            }
            i--;
            j++;

            c=o.getClass();
        }input=input.substring( input.indexOf(")")+1, input.length());
            if(input.equals("")==false) {
            a=input.substring(0, input.indexOf("("));
            x=a.split("\\.");
                b=input.substring(input.indexOf("(")+1, input.indexOf(")"));}
    }
        }else
        {
                String a=input.substring(0, input.indexOf("("));
                String b=input.substring(input.indexOf("(")+1, input.indexOf(")"));
                String[]x=a.split("\\.");

                Class c=Class.forName(x[0]);
            j=1;
                int i=x.length-2;
                while(input.equals("")==false){
                while(i>=0){

                    if(input.contains("(")&&i==0){
                        String[] Minput=b.split(",");
                        Class []cInput=Getinput(Minput);
                        if(cInput.length==0){
                            Method m= c.getDeclaredMethod(x[x.length-1], null);
                            o=m.invoke(o, null);
                            if(o==null)break;
                        }else if(cInput.length==1){
                            Method m= c.getDeclaredMethod(x[x.length-1], cInput[0]);
                            o=m.invoke(o, ss[0]);
                            if(o==null)break;
                        }else if(cInput.length==2){
                            Method m= c.getDeclaredMethod(x[x.length-1], cInput[0],cInput[1]);
                            o=m.invoke(o, ss[0],ss[1]);
                            if(o==null)break;
                        }else if(cInput.length==3){
                            Method m= c.getClass().getDeclaredMethod(x[x.length-1], cInput[0],cInput[1],cInput[2]);
                            o=m.invoke(o, ss[0],ss[1],ss[2]);
                            if(o==null)break;
                        }

                    }else{
                        Field f=c.getDeclaredField(x[j]);
                        Object o=f.get(null);
                    }
                    i--;
                    j++;

                    c=o.getClass();
                }input=input.substring( input.indexOf(")")+1, input.length());
                    if(input.equals("")==false) {
                    a=input.substring(0, input.indexOf("("));
                    x=a.split("\\.");
                    b=input.substring(input.indexOf("(")+1, input.indexOf(")"));
                    }       
            }

        }
        return o;
    }
    public  Class[] Getinput( String[] input) {
        if(input.length==1&&input[0].equals("")){
            Class[]o2=new Class[0];
            return o2;}
        else{
        Class[]o=new Class[input.length];
        for (int i = 0; i < input.length; i++) {
            if(  map.containsKey(input[i])   ){
                ss[i]=map.get(input[i]);
                if(ss[i].getClass().equals(Long.class))
                    o[i]=long.class;

                else if(ss[i].getClass().equals(Double.class)){
                    o[i]=double.class;

                        }
                 else if (ss[i].getClass().equals(String.class)) {
                        o[i]=String.class;

                 }else if((ss[i].toString().charAt(0)==('f')||ss[i].toString().charAt(0)==('t'))) {
                        o[i]=boolean.class;

                 }else{
                     o[i]=int.class;

                 }
            }   
            else if(input[i].contains(".")){
            o[i]=double.class;
            ss[i]=Double.parseDouble(input[i] ); 
                }

            else if (input[i].charAt(0)==('"')||input[i].contains("'")) {
                o[i]=String.class;
                ss[i]=input[i].substring(1,input[i].length()-1);
         }else if((input[i].charAt(0)==('f')||input[i].charAt(0)==('t'))) {
                o[i]=boolean.class;
                ss[i]=Boolean.parseBoolean (input[i] ); 
         }else{
             o[i]=int.class;
             ss[i]=Integer.parseInt(input[i] ); 
         }

    }
        return o;
    }}
}

for more information contact me with my mail:



Related Tutorials/Questions & Answers:
INTERPRETER
INTERPRETER  how to write a simple interpreter in java that can execute simple commandes like adding two integers and sysout a result and calling java classes and executing the methodes in that class
Java interpreter
Java interpreter  What is meant by Java interpreter
Advertisements
Java Interpreter
Java Interpreter      ... interpreter. That is why Java applications are platform independent. Java interpreter... System. Basically, A Java interpreter is a software that implements the Java
Java Interpreter
Java Interpreter      ... interpreter. That is why Java applications are platform independent. Java interpreter... System. Basically, A Java interpreter is a software that implements the Java
Java Interpreter
Java Interpreter      ... interpreter. That is why Java applications are platform independent. Java interpreter... System. Basically, A Java interpreter is a software that implements the Java
We can run Java on most platforms provided a platform must has a Java interpreter
Java Interpreter      ... interpreter. That is why Java applications are platform independent. Java interpreter... System. Basically, A Java interpreter is a software that implements the Java
jMATLAB
jMATLAB       jMATLAB is an Eclispe based interpreter interface to linear algebra libraries. It is based on the notion of MATLAB. It provides MATLAB like scripting
Byte Code
Byte Code       Bytecode is a term that denotes a form of intermediate code, a binary representation of an executable program designed to be executed by an interpreter or virtual
SQL for Beginner
interpreter. The Tutorial Support you from the basic concept of SQL and showing
EL Implicit Objects
EL Implicit Objects          EL is the JSP 2.0 Expression Language Interpreter from Apache Corporation. EL means the expression language , it makes it possible
Eye Speaks your Expressions
Eye Speaks your Expressions Cicero, a Roman philosopher, once said, "The face is a picture of the mind and the eyes are its interpreter". However, a face can show a different picture, eyes always speak the truth. A face can lie, eyes
JVM - Java Beginners
JVM  Hi, Is JVM a compiler or an interpreter? Thanks   Hi Friend, JVM is an interpreter. Thanks
java-basics
java-basics  hi anybody tell me, JVM is a compiler or an interpreter?  JVM is not a compiler, it is a interpreter
java qustion
java qustion  how is compiler differ from interpreter?why they use differtly?can we combine it together as single unit?what r there purposes
java
java  we compile FileName.java with command javac FileName.java. then at run time, how JVM decide that .class must be compiled(with JIT compiler) or interpreted or work both at same time.(use of JIT compiler and Interpreter
java-basics
is executed by an interpreter. The just-in-time compiler comes with JVM
Applications and Applets
and is executed by a run-time interpreter. Applications are stand alone and are executed using a Java interpreter. Whereas, A Java applet produces object code which
Applications and Applets
and is executed by a run-time interpreter. Applications are stand alone and are executed using a Java interpreter. Whereas, A Java applet produces object code which
When is java main method called?
a program is executed. When you execute a class with the Java interpreter
Java
by a Java interpreter. For more information, visit the following link: Java
Behavioral Patterns
of Resposibility Pattern 2. Command Pattern 3. Interpreter Pattern 4. Iterator Pattern 5
jvm work
jvm work  wht is the work of jvm? deaply.   Hi Friend, Java Virtual Machine or JVM for short is a software execution engine to run the java programs. Java Virtual Machine is also known as "Java Interpreter" which
Roadsend PHP
these binaries without interpreter on the targeted platform. The Roadsend PHP
What Beginners Should Know for PHP
handled at a certain time. A PHP Interpreter is also used. This is used... as accurately and efficiently as possible. The interpreter will also review scripting tags. The tags will get the interpreter to know how to start and stop certain
Java Introduction
be the same as class name. Java Interpreter- is the reason why Java is platform... it into a code that is read by the concerned operating system. Java interpreter... applications. When a Java interpreter is installed on any platform that means
Java Tools
Java on most platforms provided a platform must has a Java interpreter.  
Java Tools
Java on most platforms provided a platform must has a Java interpreter.  
What is programming?
. So a programmer writes a source code and uses a tool or interpreter... or an interpreter. In all kinds of programming languages a complier and if required an interpreter is available. But the basic difference between these two is that the complier
java
whereas VB is not. VB was interpreter based language whereas VB.net is a complied
help - Java Beginners
by a Java interpreter. For more information,Tutorials,Examples on Java visit
Advertisements
 

 

 

DMCA.com