import bsh.*;
class Operation
{
public static void main(String[] args)throws Exception
{
Interpreter i=new Interpreter();
int r=(Integer)i.eval(args[0]);
System.out.println(r);
}
}
you just need to compile above code and interpret as follows
C:\java Operaraion 1+2+\4*6
class Operation
{
public static void main(String[] args)throws Exception
{
Interpreter i=new Interpreter();
int r=(Integer)i.eval(args[0]);
System.out.println(r);
}
}
you just need to compile above code and interpret as follows
C:\java Operaraion 1+2+\4*6
Wov!!! Nice one yr... good keep it's up! dear bro. Nice Blogs...
ReplyDeletethanks
ReplyDeleteGud sir im proud of you
ReplyDeletegr8
ReplyDeletewhat is bsh.*; does it comes with standard sdk or need to include separately.
ReplyDelete@ratnesh for this external jar file is need to attach
ReplyDeleteyou can google for this
what is bsh.*; I am not understand so explain the bsh.*;
ReplyDeleteyou need to download external jar file (bash) and set path for it
DeleteYou can download bsh jar file from following link
Deletehttp://www.java2s.com/Code/Jar/b/Downloadbshjar.htm