Computer science and programming may be relatively young, but they are growing rapidly. Today, dozens of different programming languages are actively used. Few niches have just one dominant language, and to make matters even more complicated, there are often competing frameworks even within a single language. All these factors combined make it difficult for aspiring programmers to not only pick which language to learn, but also where and how to learn it.
To help, the following guide serves as both an introduction for the curious as well as a resource for those looking for more in-depth information. Whether new to coding, beginner, or more advanced, programmers can find out where to learn Java, details on the types of careers available to Java developers, and a list of resources for those interested in the basics or who want to take their Java skills and knowledge to the next level.
Understanding Object-Oriented Programming
Because Java is object-oriented, no discussion about the language can be complete without explaining what this concept means. Before object-oriented programming (OOP) gained momentum, the dominating software design methodology was procedural programming, which is, essentially, a series of instructions for the computer. These instructions would be executed one by one in order, while occasionally calling sub-routines along the way. The procedural philosophy encouraged the separation of the data from the functionality of the program. This was a solid approach, but in larger programs it tended to create code that was difficult to understand and maintain.
The concept of object-oriented programming emerged in the early 1970s as an alternative to procedural programming. As the name suggests, OOP is based on the idea of using objects. An object in a program is meant to be a representation of a real-world object. For example, in a program that simulates a zoo, objects would represent the different types of animals. An object defines the types of data that is known about it, and the various actions that it can perform. However, if each object had to be created individually, this approach would not bring much value, which is why in object-oriented languages, objects are organized into classes.
Think of a class as a blueprint of a type of object. A class usually consists of a name, a set of attributes, and a set of operations. For example, in Java, a very simple class for a dog would look like this:
In this example, “Dog” is the name of the class, while “name” and “breed” are the attributes (what is known about the dog), and “drinkWater”, “eatFood”, and “wagTail” are the operations (what a dog can do; in Java these are called methods).
The main benefit that OOP provides is reusability. Imagine writing a program for a pet shop. Instead of having to define the variables and functions for each separate dog, you can just create a Dog class, and then create as many instances of the class as you need.
However, object-oriented programming is not just about objects. In order to be considered object-oriented, a language must implement the four major principles of OOP:
Let’s take a brief look at each of them.
TInheritance allows objects to receive (or inherit) the attributes and behavior of other objects, while still allowing them to define some unique characteristics. For example, cats and dogs are both pets. So, if we were to represent them in Java, we would make a Pet superclass, where we define what the various pets have in common – for example, they all have a name, and they all can drink and eat. We would then have the Cat and Dog subclasses inherit from the Pet class, and would define some unique properties for each – for example, a cat can climb trees and a dog can wag its tail. In Java code, that would look like this:
Polymorphism allows for the definition of some sort of action with potentially many ways to perform that action. For example, we all know that dogs bark and cats meow. However, if we decide to implement a bark() method in the Dog class and a meow() method in the Cat class, the program would always have to check which type of pet it is dealing with in order to make a sound. Polymorphism allows us to define a makeSound() method in the Pet superclass, and define different behavior in the subclasses.
Abstraction is the idea of moving the focus from the details of how specific things work to the operations available. It is useful for reducing the complexity of a system. For example, in the real world, a driver does not need to know how the engine of his car works; all he needs to know is that if he presses the pedal, the car accelerates. In Java, abstraction is implemented through Abstract classes and Interfaces.
Encapsulation is closely tied to Abstraction. It is the idea of wrapping data and methods into a single unit, and keeping it safe from external interference. Java allows encapsulation in the form of private methods and variables.
Java Today: Use and Benefits
Today, Java has enjoyed a reputation as one of the best modern programming languages. Sources such asTIOBEhave consistently placed it in the top five most used programming languages for the past 15 years. This is no accident. Here are a few factors that make Java popular:
While it still requires slight adaptation for different platforms, it is still one of the most cross-platform languages out there.
This, and the relatively standardized style of programming it promotes make the language valuable for enterprise applications, which have to be written and maintained by a large number of programmers over many years.
While not quite as fast as optimized native code, it isvery close. Java is one of the fastest high-level languages used today.
Java has a huge number of open-source and commercial libraries available.
Java, however, does not lack competition. The best-known rival languages are C# (pronounced “C-sharp”), Ruby, and Python.
C# was developed by Microsoft as a direct rival to Java. In fact,James Gosling called it an “imitation” of Java.Indeed, the languages are very similar in terms of syntax, usage, and capabilities. The key difference is the technology stack used in development. While Java aims to be open and cross-platform, C# is intended for use mainly within the Microsoft ecosystem.
Ruby, unlike Java, is interpreted, not compiled. This means that Java will typically have better performance. Ruby, however, has a reputation for being very concise, quick to write, and easy to read, which is why it is often favored by startups, where it is extremely important to get a working version of a product out as quickly as possible.
Python is interesting in that it does not use curly braces to separate statements; instead, it uses line indentation. This was quite a divisive decision, and programmers tend to either love it or hate it. Still, Python is quite popular, especially in the scientific community. Like Ruby, it typically runs slower than Java, but is quicker to develop.
Types of Java
As of today, there are four different editions of Java:
Java Card is targeted at smartcards and other trusted devices with very limited memory and processing capabilities. It is most widely used in SIM cards for mobile phones and ATM cards. The focus in this edition of the language lies in portability and security.
Standard edition (Java SE)
Java SE is the core of the Java programming language. It was designed for the development of software for desktop and server environments. This software is typically client-facing, with the user interface developed either with JavaFX (which is run on a computer itself) or as a Java Applet (which is run from a web browser).
Micro edition (Java ME)
Java ME is designed for mobile devices. It is used in a wide variety of embedded devices, from mobile phones to Blu-Ray players. In the 2000s, the platform enjoyed a period of popularity due to its widespread use for making mobile games. Currently, Oracle is pushing the use of Java ME in the budding field of Internet-Of-Things, which is the idea that everyday devices can connect to the Internet (and to each other) in order to send and receive data.
Enterprise edition (Java EE)
Java EE is an extension of the Java SE platform. Its main purpose is to provide an environment for developing and running enterprise software, including network and web services, and other large-scale, multi-tiered, scalable, reliable, and secure network applications.
It should also be noted that software for the Android operating system is written in Java. Interestingly, the Android platform does not use the JVM; instead, it runs Java code in its own Android Runtime (ART) runtime environment.
How to Learn Java Coding
Regardless of the chosen platform, Java is easy to start, but quite an extensive language to master. Fortunately, there are plenty of ways to learn to language. Today, most people learn Java by pursuing a computer science, or related, degree at a college or university or through online tutorial, coding bootcamp, or even coding games. Below is a breakdown of each option.
Colleges and Universities
Pursing a degree in computer science at an institution of higher education will not only teach the ins and outs of Java – and other programming languages – it will also establish a solid foundation of knowledge in the field of computer science. It is, however, the most demanding place to learn to code, in terms of both money and time commitment. As such, it is best suited for people who are serious about making a career in programming and want to get every advantage they can. Among the top schools that teach Java are:
Massachusetts Institute of Technology (MIT)
MIT is known worldwide for its Electrical Engineering and Computer Science Department, which offers four undergraduate programs, as well as the master of engineering program. Students are able to take the Introduction to Software Engineering in Java course as early as their freshman year, and other programming languages are available as well.
Online tutorials are an excellent way to learn Java for people who like to study at their own pace. There are tons of options available, so almost anyone will be able to choose a tutorial to fit their level of experience and budget. While a person can get a deep understanding of Java programming from online tutorials and courses, they also allow you to dip your toes in the field to see whether it is something of interest to you. Among the best Java courses online are:
Udemy is a well-known resource with courses on a variety of subjects. Among other things, it provides several dozen free and paid tutorials for learning Java. One of the most popular ones is the free Java Tutorial for Complete Beginners that features 75 lectures in 17 hours of video.
As stated on the website, the Treehouse mission is to bring affordable technology education to people everywhere, in order to help them achieve their dreams and change the world. Starting at $25 per month for the basic plan, students will gain access to the various tutorials, including a 13-hour tutorial on Java.
The official Java tutorials by Oracle may not be as interactive as some other options, but they provide the latest and fullest information about the language. And who is better suited to teach Java than the people who make it?
Coding bootcamps are programs intended to quickly teach people with little to no prior coding experience all the skills they would need to start working as a programmer. They typically last between 2 and 6 months and often provide some form of assistance with employment after completion. Some are even free if you don’t get a job in the field. Coding bootcamps are an excellent choice for people looking to jump right into a Java career as soon as possible. Among the best ones are:
Offers a 12-week program, with sessions available four times a year. Job assistance is promised.
Provides a 4-phase learning program once every 18 months. The program itself lasts up to 8 months. The company often hires successful students or offers employment with its partners. Craftsmanship Academy is founded on biblical principles and is explicitly a Christian organization.
Offers a 12-week program twice a year. One of the benefits of this bootcamp is that it works directly with employers and recruiting firms, and promises its students access to the whole network of 60 hiring partners.
It should also be noted that for whatever reason, Java is not as popular at coding bootcamps as some other languages. Yet, plenty of options are still available.
Coding games try to bring fun and a competitive spirit into the learning environment. Most coding games assume a basic knowledge of the language syntax, and they can be great for people who want to improve their coding skills. A coding game provides an online development environment, which can be used to write and execute code, and a series of challenges that should be instantly familiar to gamers (for example, to write a program that will shoot the closest enemy each turn).
Here are some coding games that support Java:
The site offers a huge collection of challenges divided into 4 levels of difficulty, achievements, leaderboards, competitions, contests, and even actual job offers from companies looking for coders of various skill levels.
This site provides a simple, but effective approach. The Java challenges are grouped into 15 sectors, each focusing on a separate topic. Players are given a score based on the efficiency of the written code. There is even a story, which features the player as a, surprise, code hunter.
The Best Way to Learn Java
Unfortunately, there is no single best way to learn Java. A CS degree will provide an extensive base of knowledge, including a deep understanding of computer science theory, but demands the most from a student. For some, this option may not be feasible due to financial reasons or other obligations that do not allow for such a lengthy time commitment. Most top companies, however, do require at least a bachelor’s degree in computer science or related fields, but in practice more and more employers are considering candidates with no formal degree, but sufficient proof of experience and expertise, such as a portfolio, previous Java experience, or bootcamp training.
Online tutorials and courses are more affordable, but do not provided as much training as some other options. Additionally, the freedom they provide to the student comes at the cost of demanding more self-discipline and practice after the tutorial is over. Employers are also more likely to prefer a degree over a course certificate. Coding bootcamps are a middle group between a full degree program and online tutorials. They are more affordable and quicker than college, and offer immediate hands-on experience in an environment that is close to an actual job. However, they provide a much narrower focus.
Coding games are similar in their use to online tutorials. In fact, the two are best used together for a mix of theory and practice.
Ultimately, the best way to learn Java is up to the aspiring developer. Every student learns and retains information differently and everyone has varying budgets and financial limitations. Regardless of what you choose, understanding all the options available up front is an excellent starting point for figuring out the right path.
Receiving an official Java certificate is considered a good way to gain a competitive edge in the professional marketplace. Such certificate shows dedication to the craft and a proven theoretical foundation. That being said, certificates become decreasingly important with every year of practical programming experience.
Oracle offers 4 levels of Java certification:
- Oracle certified associate Java programmer
- Oracle certified professional Java programmer
- Oracle certified expert Java programmer
- Oracle certified master Java programmer
Each level after the first provides several specialization options.
The steps and requirements to become certified are explained in detail at theOracle Universitywebsite.
Resources for Certification
At each certification level, Oracle expects impeccable skills. Many resources are available to help candidates prepare for the exam. Some examples include:
In addition to being an excellent forum for Java developers of all skill levels, Coderanch also offers a rather large collection of mock exams and other useful certification resources.
The Enthuware Test studio is a program that simulates the certification exam. It allows the user to take mock exams to practice for the real thing.
Oracle provides training in a variety of formats including classroom training, live virtual classes, and self-study courses.
is a book focused on a single task – to help the reader prepare for associate and professional level exams.
is targeted at relative beginners who want to get certified as quickly as possible.
The History of Java
According to theOracle,the company behind Java, the Java project was initiated in 1991 by James Gosling, Mike Sheridan, and Patrick Naughton as part of a team within Sun Microsystems. The language was originally called Oak, but it turned out that there already was a computer company with that name. According to legend, the team went out to a nearby café to decide on a new name and came up with Java, after an island in Indonesia famous for its coffee. Much later, the coffee cup was adopted as the official logo.
Sun Microsystems presented the first public version of Java, Java 1.0, in 1995. At the time, the goals of Java were to be:
- Simple, Object Oriented, and Familiar
- Robust and Secure
- Architecture Neutral and Portable
- High Performance
- Interpreted, Threaded, and Dynamic
Java was designed to have syntax similar to C/C++ in order to seem familiar to application programmers. It famously promised developers could “Write Once, Run Everywhere” and provided an implementation of the Java Virtual Machine (JVM) on popular platforms to deliver on that promise. It also had built-in security and allowed network and file restrictions. These factors made the language appealing to web browser developers. By 1996 Java was supported by the two most popular browsers at that time – Netscape Navigator and Internet Explorer.
In 1997, Sun released a major update to the language – Java 2. It included three separate platforms – Java 2 Platform Standard Edition (J2SE), Micro Edition (J2ME) and Enterprise Edition (J2EE). For marketing purposes, they were later renamed to Java SE, Java ME and Java EE respectively.
In 2007, Sun made Java fully open-source under theGNU General Public License.In 2010, the Oracle Corporation purchased Sun Microsystems, and, consequently, gained ownership of Java.
The Future of Java
Java celebrated its 20th birthday in 2015, and it is still going strong. New versions and updates are delivered constantly, and continue to provide even more features to an already impressive package. The last major version, Java SE 8, was released on March 18, 2014. It presented the introduction of several features from functional languages (such as the long-awaited lambda expressions), improvements for working with date and time, and much more.:
Java SE 9 is scheduled for September 22, 2016. While the full feature list has yet to be announced, Oracle already has developers excited for Project Jigsaw, which will allow developers to only use the parts of the Java language that their applications actually require. This will lead to better performance and smaller program sizes.
The most exciting new fields for Java are application development for the Android platform and embedded programming for the Internet-Of-Things. However, traditional enterprise development is not likely to go away any time soon.
Java Careers and Salaries
Becoming a Java programmer is currently a very promising career path. Here are a few of the most common Java positions to give you an idea of what to expect:
According toglassdoor.com,the salary for Java interns can be up to $7,000 per month.
Internships are a starting point in a career and good companies acknowledge that this position is mostly about learning. Candidates will be expected to have a basic understanding of Java and computer science, and a strong desire to learn more.
- Required education and experience
First or second year of studying for a degree in Computer Science or a related field (i.e. Software Engineering, Electrical engineering, Information technology etc.)
According toindeed.com,the average salary for junior Java developers is $71,000
A junior developer is usually a person who has only recently started a career in the chosen technology. This person is expected to possess most of the knowledge to develop software, but not a lot of experience doing so. Junior developers are sometimes assigned a more experienced colleague whom they can ask for help or advice.
- Required education and experience
- Bachelor’s degree in Computer Science or a related field
- Generally, 1-2 years of experience is required
- Certification is a plus, but rarely mandatory
According toindeed.com,the average salary for Java Architects is $115,000
The Architect position is the highest non-managerial position for java developers. Candidates are expected to have extensive experience with developing and designing software. Responsibilities include architecture and technical design development, providing best practice points of view, and also being the authority for IT development methods and processes within the team.
- Required education and experience
- Bachelor’s or Master’s degree in Computer Science or a related field
- 8-10 years of experience in Java development