Check out example codes for "how to add .java files to html". It will help you in understanding the concepts better.
Code Example 1
this does not actually work, i tested it out
Code Example 2
<!DOCTYPE html> <html> <head></head> <body> <script lang="java"> // java script here </script> </body> </html>
Learn ReactJs, React Native from akashmittal.com