Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

Java or Javascript?

Hi All, I am new to programming and my question is, is it better to learn java or javascript and whether it is essential to know javascript since I would rather not get involved in building website if possible. Can someone also please explain where those two languages shine most?

Thank You

1 Answer

Hi Cris,

While their names are similar, they are two very different in the way they function and are written. Java is mostly just used as server backends nowadays such as running content management system's (i.e Adobe Experience Manager) or Minecraft and even powers the applications for Android devices. The biggest benefit Java offers is the need to only support a specific SDK which you compile your code down to that can be run by most systems, you could also build your own projects using the latest SDK that not many people would support and not have to worry about implementing or creating your own logic that previous SDK's may not have had.

On the other hand, Java can be difficult to learn if you haven't worked with a strictly typed language before but it does offer a more powerful code base to work with compared to JavaScript which is limited due to browser support and implementation differences.

Javascript, however, allows you to interface with the user while having no way other than relying on HTML5 technologies to store data which isn't bad but isn't great either as a user can easily reset their browser or switch to a different PC. Java excels in this area as you can easily persist data using user authentication and session management which JavaScript just can't do. A major benefit of JavaScript is of course, you can create a way for the browser and the server to talk to one another.

If you aren't going to be building websites, as in the browser side of things, then JavaScript won't be for you unless you're planning on using NodeJS which allows you to build a backend server using plain old JavaScript. Having said that, it will come down to how confident you are with both languages as most developers are quite easily confused by JavaScript's cumbersome approach and lack of consistency between browsers.

My personal recommendation, go through the basics of each a few times and see which one you prefer. The decision of which one to go with will solely come down to your needs whether it be for personal projects or career progression.