DevOps / BeanShell Interview questions
How do you import a Java class in BeanShell?
BeanShell supports the standard Java import statement exactly as Java does, like import java.util.ArrayList;, making that class available by its short name for the rest of the script.
Because BeanShell interprets ordinary Java syntax, this works identically to importing a class in a compiled Java file - there's no BeanShell-specific import syntax to learn separately.
BeanShell also supports wildcard imports, like import java.util.*;, and by default has several common packages already imported so scripts can reference frequently used classes without an explicit import statement at all.
More Related questions...