Last time we learned about String and Math. Here are some of the string methods we saw.
jshell> String s = "abcdefghij";
s ==> "abcdefghij"
jshell> s.charAt(0)
$2 ==> 'a'
jshell> s.substring(4)
$3 ==> "efghij"
jshell> s.substring(4,6)
$4 ==> "ef"
jshell> s.substring(0,4)
$5 ==> "abcd"
jshell> s.contains("fgh")
$6 ==> true
All Math methods are static, so we just call them by clas name. Math is just a bag of functions; such a class is called a static service class.
jshell> Math.cos(0)
$7 ==> 1.0
jshell> Math.exp(.69)
$8 ==> 1.9937155332430823
jshell> Math.pow(3,4)
$9 ==> 81.0
jshell> Math.factorial(6)
| Error:
| cannot find symbol
| symbol: method factorial(int)
| Math.factorial(6)
| ^------------^
jshell>