Bean shell functions in jmeter

To concatenate two Strings in BeanShell we have to first make one String and then use the function concate on this String.

str ="hs"; str.concate("d");

so we use a BeanShell function like this i.e type the below command in the name of a Java reg

${__BeanShell(str ="hs";str.concat("d");)}
To add some operations in beanshell

${__BeanShell(int x= 5;int y = 20;int z = x+y;return z;RES)}
Then we can make another Java request and use RES in that to print the result

${RES}

Then we can even define two variables var1 and var2 in testplan and give them values like 100 and 200

and then use the following BeanShell function

${__BeanShell(int x =Integer.parseInt(vars.get("var1"));
int y= Integer.parseInt(vars.get("var2"));int z=x+y;return z;)}

We can use more functions like machineIp(),machineName() and TestPlanName etc.