Java Tutorials for Testers: Introduction, JDK, JRE & JVM Internals

This is the first blog post on Java. When I was learning Java then I found plenty of resources available online for this beautiful programming language. Let me share an interesting thing with you every computer programmers starts with C and frequently starts loving Java. I too was among them. This language helped many to earn their bread and butter and nobody can ever deny that Java helped them to survive in the IT industry. Well, coming to the previous discussion, so I found good resources online on Java but I was looking for something precise & crisp Java tutorials for testers. Being a tester I have to think about this. We don’t require many things in Java in terms of testing, but, the irony is when you plan to switch your job and start appearing for the interviews, the interviewers expect us to be a Java developer. Anyways, do not worry about that stuff. I am your mentor and I am going to guide you properly so that you can have mastery over the language.

How to identify SVG elements in Selenium?

Let’s begin!

What is Java?

Java is a high-level programming language and gives us the platform to run the Java-based application as well.

Who developed Java?

James Gosling is the father of Java, and it was developed at Sun Microsystems (now owned by Oracle) in the year 1995.

Features of Java

Some of the features of Java are listed below:

  • Robust
  • Object-Oriented
  • Secure
  • Portable
  • Simple
  • Platform Independent
  • Interpreted
  • Distributed
  • Dynamic
  • Multi-threaded
  • High Performance & Optimized

What are the different types of applications built with Java?

  • Mobile Application (like Android app)
  • Desktop Application
  • Web Application
  • ERP Application
  • Smart Card
  • Gaming App
  • Embedded Systems

Java tutorials for testers

Different Editions of Java

  • Java SE (Standard Edition)
  • Java EE (Enterprise Edition)
  • Java ME (Micro Edition)
  • Java FX

What is JDK?

JDK stands for Java Development Kit. It is used to develop Java applications and it consists of the development kit, JRE, JVM, Interpreter, Compiler, Document generator, achiever and other tools. JDK can have any of the editions of Java described above.

Learn Java Topics for Selenium

What is JRE?

JRE stands for Java Runtime Environment. It contains multiple libraries to provide the environment to run any Java program.

What is JVM and Its internal architecture?

JVM stands for Java Virtual Machine. As its name depicts, this machine does not exist physically, rather it’s a virtual machine for any Operating system or platform. It provides the environment to run the Java application after executing the byte code on the compilation of the program. It is also responsible to run programs other than Java which generates Java byte codes. Scala programming language is one of them.

JVM, JRE & JDK individually is platform-dependent and Java as a whole is platform-independent language.

JVM performs certain actions internally to run the Java program, those are listed as follows:

  • It first loads the code
  • Then verifies the code
  • Further, executes the code
  • And finally, provide the runtime environment

JVM offers architecture of-

  • Class file formatting
  • Memory area
  • Program Counter Registers
  • Heap
  • Stack
  • Execution engine
  • Reporting

How to set the Java path?

There are two ways to set Java path, one is temporary and another one is permanent.

Temporary

Go to command prompt and execute the following command to set the Java path.

set path=D:\Program Files\Java\jdk1.8.0_221\bin

Permanent

You can set a permanent Java path at your system’s environment variables.

First Java program

package my.project;

public class FirstJavaProgram {

	final public static void main(String[] args) {
		System.out.println("My First Java Program");
	}

}

This is the simple program that just prints the text. Initially, it is saved as dot Java (.java) file and after compilation, it gets converted into byte code and file name gets stored with dot class (.class) extension.

Different ways to write a Java program

We can write the above java program in different ways like changing the sequence of keywords used with the main method.

  • public static void main(String args[])
  • static public void main(String args[])
  • public static void main(String []args)
  • public static void main(String… args)

Valid & Invalid main() method’s signature

Valid main() method

  • public static void main(String args[])
  • public static void main(String[] args)
  • public static void main(String []args)
  • public static void main(String… args)
  • public static final void main(String args[])
  • final strictfp public static void main(String args[])
  • final public static void main(String args[])
  • static public void main(String args[])

Invalid main() method

  • void public static main(String args[])
  • static void public main(String args[])
  • public void main(String args[])
  • static void main(String args[])
  • abstract public static void main(String args[])

This was one of the first Java tutorials for testers. Stay tuned for more series of articles for testers on Java.

OFFER! Get Trained in Software Testing by Avinash Mishra. Join Now! CLICK HERE!

Join Inviul fb group

Leave a Reply