@sammy1
The two languages are totally different and unrelated. They have similar names because they were originally suppose to play nice with each other, but those plans were scrapped early on in development.
JavaScript is a forgiving interpreted language.
Java is strict compiled language.
Both languages are object oriented.
Both languages are can be ran client side as well as server side.
Both languages are children within the C family, based off of much of the same syntax as C & C++.
JavaScript you can embed in a webpage as a script and is the most common client side scripting language for webpages.
Java you can embed in a webpage as an applet, but applets are frowned upon and considered obsolete / depreciated ... not good cybersecurity.
Java is currently the most profitable programming language on the job market, with the most job opportunities available.
JavaScript is less valuable on the job market, but I would argue is one of the easiest programming languages to pickup and learn.
Both languages are highly cross-platform and versatile.
If you get the chance, learn both. Most people can pickup JavaScript and one of its frameworks as a skill within 3 - 12 months. Java + a few of its popular frameworks can take 2 - 5 years to get down packed, but a job as an experienced Java programmer easily earns 40k - 120k salary and makes you extremely popular on the job market.