DEV Community

Cover image for What is Java Programming Language?
Patrice Williams
Patrice Williams

Posted on • Edited on

What is Java Programming Language?

What is Java and why should I use it?

Java is a programming language that was created by Sun Microsystems in 1995. Java was first initiated in June 1991 for a project created by James Gosling. The language was first called “Oak” after an oak tree that lived outside Gosling’s office.  It was eventually named Java from a list of random words. By May 2007 Sun made Java’s core code free and available to the public Java was crafted because the main programming languages around in the early 90s that were used had too many steps to perform simple tasks. The programming language C was too low-level and was not portable, meaning the code that was written in C could not be easily used to run on minicomputers and mainframes, but worked with PC. So developers came out with more programming languages like JavaScript, Ruby,  and PHP. Java became very popular as soon as it was released due to its portability and the large built-in libraries. 2020 marked 25 years since it has been created.

Alt Text

Java's main features

The latest version of Java is version 15, with version 16 due to come out in about 1 month. Since 2017, Java has published a new version roughly twice a year. Because it is so popular, there are many different configurations, like the J2EE for Enterprise Applications, and J2ME for Mobile Applications. The point of the Java language is to write your code once and have it be able to run anywhere. Java is:

Object Oriented – everything is an object in Java and can be extended since it is based on the Object model
Platform Independent – when Java is compiled it is not compiled into a platform based on the specific machine, but in an independent byte code. Then a Virtual Machine (JVM) interprets the byte code on whichever platform that is running the code.
Secure – Java is a secure language due to its secure feature, which allows it to develop virus-free, protected programs. Public-key encryption is used for authentication procedures.
Portable – because Java has no specific architecture and “having no implementation dependent aspects of the specification makes Java portable” (Java - 2021).
Multithreaded – developers can create smooth running interactive applications because with Java you can write programs that perform a lot of tasks simultaneously.   
Easy to learn – it is a simple language to learn if you are familiar with Object Oriented Programming (OOP).
High Performance – Java’s Just-In-Time compilers enables Java’s high performance.
Dynamic – Java is designed to be adaptable depending on the environment. Java programs contain a vast amount of run-time information that can be utilized to confirm and resolve accesses to objects on run-time.

Java syntax

Java is a language influenced by C++ and C. It is an object-oriented language using classes. Every piece of data is an object, except for primitive data types like integers, floating-point numbers, Boolean values, and characters. Java does not support multiple inheritance for classes, but through interfaces, multiple inheritance is supported. Java does use comments just like JavaScript, but there are three types: a single line comment ‘//’, a multi-line comment ‘/   /’ and the Javadoc commenting style opened with ‘/*’ and closed with  ‘/’.

The following is a code example of a “Hello World” application:

public class HelloWorldApp {
    public static void main(String[] args) {
                       System.out.println(Hello World App!); // Prints the string “Hello World App!” to the console.
           }
}
Enter fullscreen mode Exit fullscreen mode

Source files are named after the public class they contain, ending with the suffix .java, for example, HelloWorldApp.java. The keyword public refers to a method that can be called from code in other classes or that a class can be used by classes outside the class hierarchy. That hierarchy deals with the name of the directory that the .java file is located. The keyword static in front of a method shows that it’s a static method, which is associated only with the class and not a specific instance of that class. Only static methods can be invoked without an actual reference to an object. The keyword void designates that the main method does not return any value to the caller. The method name main is not a keyword, but just the name of the method the Java launcher uses to pass control to the program. When Java classes are run in managed environments like applets and Enterprise JavaBeans(a Java API) do not need a main() method. The main method has to accept an array of String objects. Printing is a part of Java’s standard library. The System class defines a public static field named out. The out object is an instance of a class of printing methods used to print data. This includes println(String), which also adds a new line to the passed in string. The string “Hello World App!” is converted to a String object by the compiler.

Java is a dynamic language made popular in the 90s. Java is a vital aspect in Android, a mobile operating system and is one of the fastest programming languages due to it being able to be scaled to programs that can process a large amount of resources. It is definitely a language that should be learned to widen your programming horizon.

Sources

Binstock, A. (2015, May 20). Oracle BrandVoice: JAVA'S 20 years of innovation. Retrieved February 22, 2021, from https://www.forbes.com/sites/oracle/2015/05/20/javas-20-years-of-innovation/?sh=1dec7f1111d7
Java (programming language). (2021, February 19). Retrieved February 22, 2021, from https://en.wikipedia.org/wiki/Java_(programming_language)
Java - Overview. (n.d.). Retrieved February 22, 2021, from https://www.tutorialspoint.com/java/java_overview.htm

Top comments (1)

Collapse
 
michelemauro profile image
michelemauro

Quite good. Just a few points:

  • latest version is Java 15, with 16 due in a month. Since version 9 in 2017, a new Java version is published twice a year.
  • Portability and platform independence were (probably the) main concerns in defining Java. Next to those were multithreading and network operations.
  • Use the word "Dynamic" as an adjective to the language with caution, because there is a term, "Dynamic Typing", that is widely used and is not applicable to Java.

You are on the right track. Happy coding!