Introduction to Java

Java is a class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible.

Java is a class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible.

Introduction to Java

First Java Program

Let's write simple code that will print the words Hello Java.

Example:

public class MyFirstJavaProgram { /* This is my first java program. * This will print 'Hello Java' as the output */ public static void main(String []args) { System.out.println("Hello Java"); // prints Hello Java }

}

Compile MyFirstJavaProgram.java:

1) javac MyFirstJavaProgram.java

2) java MyFirstJavaProgram

Output:

Hello Java

Execute Jar File:

java -jar MyFirstJavaProgram.jar

blog

copyright©2020 Full Stack Developer - Kripesh Bista all rights reserved