Introduction To Java Programming Language
Java is a class machine, orientated programming language and is applied predominantly in the fabrication of applications that have the capability to run on any operating structure, and it has forceful safety measures. Sun Microsystems developed it and when owned by Oracle; it was released in the year 1995. Java supports the “Write once, Run anywhere” notion but compiled byte code will run on the platform which has support for JVM.In this article we will provide an introduction of java programming language, It's advantages, disadvantages, key features, and a summary
Core features of Java
Object-oriented: The basic construct in Java is the class and a class creates an object and an object is defined as a field or attribute along with a method. This makes the code more portable and more loosely coupled and easier to modify at the same time.
Platform Independence: Java possesses a great advantage in this aspect of compilation to Bytecode and execution by JVM which makes the program not to fragment over the systems.
Robust: Some of the elements include, exception handling, automatic garbage collection and strong types which drastically lower the incidence of run-time errors and hence make the code more stable.
Secure: Java has several measures, which have been put in place to improve security and utmost protection against malicious code; these include the bytecode checks, magnificence loaders, and security managers.
Simple: Java’s syntax is clear and simple to parse, which makes it blends in efficiently with the specific backgrounds of programmes.
High performance: Java, although slower in comparison to low level languages is proper in term of performance as it supports just in time compilation with optimized byte code.
Multi-threaded: Java supports multithreading, which promotes potential execution of a couple of duties within an application.
1st way to write a program
Main is a class of public accessibility, thus making its name and it also acts as the container to the program. In this class there is a method ‘main’ that serves as the starting point of the program. This method is defined as static and void and doesn’t have any return type other than void, although it has one input parameter which is a string array ‘args’. The basic utilization is to simply type a ‘Hello, World!’ message to the Output Console using System. out. println() statement.
2nd way to write a program
Calculator class: Has a single method ‘add’ that which take two numbers as argument and returns their sum.
Main class: Makes an instance of the Calculator class.
Here, invokes the add method with two arguments 5 and 3.
Prints the result.
Summary
The features of Java include flexibility, robustness, and comfort of work with large surroundings. Since it is not platform specific, based on OOP and has efficient Network support; makes it widely used for organization programs, webs, android app, and many more. while others reveal general performance and verbosity problems, it has benefits that are greater than those drawbacks most of the time.
We are glad that you went through this article titled (Introduction to Java Programming) developed by Sparkify Solutions.
Comments