Java Tutorial
Last Updated : 26 Jun, 2024
This Java Tutorial is designed for beginners as well as experienced professionals. Whether you’re looking to learn the basics of Java or its advanced concepts, this free Java tutorial is the perfect resource for you
What is Java?
Developed by Sun Microsystems in 1995, Java is a highly popular, object-oriented programming language. This platform independent programming language is utilized for Android development, web development, artificial intelligence, cloud applications, and much more.In this tutorial, we will cover everything from the basics of Java syntax to advanced topics like object-oriented programming and exception handling. So, by the end of this tutorial, you will have a strong understanding of Java and be ready to start writing your own Java applications. So let’s get started on this comprehensive Free Java programming course!
First Java Program
// A Java program to print "Hello World" public class GFG { public static void main(String args[]) { System.out.println("Hello World"); } }
Output
Hello World
Table of Content
Java Overview
Java Basics
Java Input/Output
Java Flow Control
Java Operators
Java Arrays
Java Strings
Java OOPs Concepts
Java Classes
Java Interfaces
Java Methods
Java Packages
Java Collection Framework
Java Collection Classes
Java Memory AllocationJava Exception Handling
Java Multithreading
Java Synchronization
Java File Handling
Java Regex
Java IO
Java Networking
Java SE 8 Features
Java Date & Time
Java JDBC
Java Miscellaneous
Java Interview Questions
Java Hello World Program
Java is one of the most popular and widely used programming languages and platforms. Java is fast, reliable, and secure. Java is used in every nook and corner from desktop to web applications, scientific supercomputers to gaming consoles, cell phones to the Internet. In this article, we will learn how to write a simple Java Program.Steps to Implement Java Program Implementation of a Java application program involves the following step.
They include:Creating the program
Compiling the program
Running the program
1. Creating Programs in Java
We can create a program using Text Editor (Notepad) or IDE (NetBeans
1. Creating Programs in Java
We can create a program using Text Editor (Notepad) or IDE (NetBeans
class Test{ public static void main(String []args) { System.out.println(“My First Java Program.”); }};
class Test
{
public static void main(String []args)
{
System.out.println("My First Java Program.");
}
};
File Save: d:\Test.java
- IUST Assistant Professor Vacancies Out 2024
- Class 11 results out Download PDF here
- Download Gazette here JKBOSE Set To Release Class 11th Results Today
- JKBOSE Class 11th Annual Regular Result 23-2024 will be declared
- Why Internships are Important for Engineering Students or Freshers?
2. Compiling the Program in Java
To compile the program, we must run the Java compiler (javac), with the name of the source file on the “command prompt” like as follows
If everything is OK, the “javac” compiler creates a file called “Test.class” containing the byte code of the program.
3. Running the Program in Java
We need to use the Java Interpreter to run a program. Java is easy to learn, and its syntax is simple and easy to understand. It is based on C++ (so easier for programmers who know C++).
The process of Java programming can be simplified in three steps:
- Create the program by typing it into a text editor and saving it to a file – HelloWorld.java.
- Compile it by typing “javac HelloWorld.java” in the terminal window.
- Execute (or run) it by typing “java HelloWorld” in the terminal window.
The below-given program is the most simple program of Java printing “Hello World” to the screen. Let us try to understand every bit of code step by step.
Java
// This is a simple Java program.
// FileName : "HelloWorld.java".
class
HelloWorld {
// Your program begins with a call to main().
// Prints "Hello, World" to the terminal window.
public
static
void
main(String args[])
{
System.out.println(
"Hello, World"
);
}
}
Output
Hello, World
The complexity of the above method
Time Complexity: O(1)