Skip to content

Instantly share code, notes, and snippets.

@2013techsmarts
Created February 15, 2017 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2013techsmarts/43381cba400213acb188e2cc797d0602 to your computer and use it in GitHub Desktop.
Save 2013techsmarts/43381cba400213acb188e2cc797d0602 to your computer and use it in GitHub Desktop.
Create a class with method via jshell and invoke the method
jshell> public class Sample {
...> public int add(int a, int b) {
...> return a+b;
...> }
...> }
| created class Sample
jshell> Sample s = new Sample();
s ==> Sample@49993335
jshell> s.add(10,9);
$4 ==> 19
jshell>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment