Site icon TestingDocs.com

Introduction to Java Language

Introduction to Java

Java is an object-oriented programming language. It is a high-level, multi-threaded, portable, secure, platform-independent language. Java is guaranteed to be Write Once, Run Anywhere(WORA). It is designed for the internet and web applications.

History of Java

Java History

Java is Object-Oriented

Almost everything in  Java is an Object. Object-oriented programming is a programming methodology. OOPs is a method of implementation in which programs are organized as collections of objects, each of which represents an instance of some class. Java program can be easily extended since it is based on the object model.

Write Once and Run Anywhere(WORA)

Java is compiled to be byte code which is the intermediate language between source code and machine code. This byte code is not platform specific and hence can run on any platform.

 

OOP Principles

Basic OOP( Object-oriented Programming) Principles or common jargon of Java are:

OOPs is a method of implementation in which programs are organized as collections of objects.

Example

We would write a simple class in Java to print Hello World! on the console. You can choose your favorite IDE to write the program. I prefer either Eclipse or IntelliJ IDEA. We use Eclipse here to write the class code snippet.

You can create a new class from the menu shown and highlighted below :

 

Sample Class

Sample class to print HelloWorld! text on the console.

public class HelloWorld
    {
    public static void main(String[] args)
       {
       System.out.println("Hello World!");
        }
}

 

To run the program choose Right click –> Run as –> Java Application

 

Basic Jargon

Keywords are reserved identifiers that are predefined in Java language. example class, method, etc.

Identifier: A name in a program is called an identifier. An identifier may be any sequence of uppercase and lowercase letters, numbers, etc. Keep the identifier name descriptive which increases the readability and understanding of the program.

Note that: Identifiers must not begin with a number or any special character other than _ and $.

Variable: variable is the basic unit of storage in a Java program. All variables have a scope, which defines their visibility. ( private, public, protected, default )

Java is very popular and Java knowledge is essential for automation engineers. Object-oriented programming skills make it easy to learn automation and develop object-oriented automation frameworks.

Java Tutorials

Java Tutorial on this website:

https://www.testingdocs.com/java-tutorial/

For more information on Java, visit the official website :

https://www.oracle.com/java/

Exit mobile version