Home Getting Started With Java | Basics of Restful Api's
Post
Cancel

Getting Started With Java | Basics of Restful Api's

Getting Started with javaBasics of Rest API’s

Introduction: Basic Program

Java is a popular programming language that is used to develop a wide variety of applications, from mobile apps to enterprise systems. Like Python and C, it is an object-oriented programming language, which means that it organizes code into classes that contain properties (variables) and methods (functions).

Here is a simple Java program that prints the message “Hello, World!” to the console:

1
2
3
4
5
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}
  • public class HelloWorld declares a new class called HelloWorld.
  • public static void main(String[] args) is the entry point for the program. This method is called when the program is run, and it takes an array of strings called args as an argument.
  • System.out.println(“Hello, World!”); prints the message “Hello, World!” to the console.

To run this code, save it to a file called HelloWorld.java, and then compile and run it using the following commands in the terminal:

javac HelloWorld.java
java HelloWorld
This post is licensed under CC BY 4.0 by the author.