• Call Us: +91 9437911966
  • Email Us: info@studentstutorial.com
  • Home
  • C Examples
  • Server Side
    • PHP
    • Java
    • CodeIgniter
    • Laravel
    • JSP
    • JDBC
  • Frontend
    • HTML
    • CSS
    • Javascript
    • jQuery
    • AJAX
    • FPDF
    • TCPDF
  • APP & DB
    • Android
    • Cordova
    • SQL
    • Oracle
  • Project
Java Introduction System.out.println(): Program for input through console Program for addition Program for Subtraction Program for Multiplication Program for Division Program for modulus Program for increment Program for percentage Program for square Program for cube Program for square root Check Even or Odd Reverse of a number Find prime numbers Find factorial Program for palindrome Program for Diamond Star Program for Pascal Star Program for Fibonacci Series Find largest number Find Smallest number Find largest third number Find largest second number Program for Bubble Sort Program for Insertion Sort Program for Selection Sort Program for Linear Search Program for Binary Search Find IP address Open notepad through java program Find Armstrong Number Find mirror clock Comparing Value create Backup file Program for file content modifier Program for copying files Fahrenheit to Celsius create deadlock program Implement hashcode program Convert File to Zip Remove Duplicate Element From Array Java Matrix Addition Java Matrix Multiplication

Java Programming Tutorial

  • Students Tutorial
   

Java is an object-oriented programming (OOPs) language.

Object-oriented programming is a methodology to design a program using class and object.

About this tutorial

In this tutorial basically, we provide different Java programs that helps a beginner to write java program easily and create a java project of his own.

Tools needed for run Java program

  • Linux or Windows XP/7/8/9/10 operating system
  • JDK 1.5 or above
  • Notepad

Java programming Example

Examples are better than 1000 words. Examples are often easier to understand than text explanations. So in this tutorial we only provide the example.

Let’s start with a simple Hello World! program

Hello world program

import java.util.Scanner; 
public class HelloWorld
{
    public static void main(String[] args) 
	{
        System.out.println("Hello world!");
    }
}

import java.lang.*;

It is used to Import predefine classes and interfaces which contain methods.This process is called package insertion.A package is a collection of predefined classes and interfaces.

public class HelloDemo

We should declare class(interface) with public modifier to access within entire application or in different package.We have to use class keyword subsequent with class(interface)name.

public static void main(String[] args) { }

This is a main() method. JVM start execution from this line.We have to write same [public static void main(String[] args)] while declaring main() method.

Public is an access modifer which is accessable by JVM.Static is a key word.

Here main() method is declared as static means It can access only static variable which is declared out side the class but we can't create veriables out side the class but JVM may internally provide static variable which is accessed by the main() method.

void is a return type and its menas return nothing because we know java is platefome independent and no need to return value to operating system or JVM.

main is the special user define function. Though it is user define but We can't change the name.

String[] args means we create a string type array. It is useful when we pass the value through command line while execute the program.

Note : args is an array name therefore it is treated as an idetifire means we can change the it and put any name.

System.out.println("Hello World!");

This is output statement.We use print() or println() method to print the message or value of variables.

print() method is define under predefined class System (under PrintStream). print() method is called through out object which is also predefined.

we can create own output object which call print() method.

Example

import java.util.Scanner; 
PrintStream myprint = new PrintStream(System.out, true);
		myprint.println("Hello World!");

Student Tutorial is a online tutorial for web design and development. Here you can find easy example and explanation for each tutorial.
Copyright © 2016-2023 Student Tutorial

Server Side

  • PHP
  • Java
  • CodeIgniter
  • Laravel
  • JSP
  • JDBC

Frontend

  • HTML
  • CSS
  • Javascript
  • jQuery
  • AJAX
  • FPDF

App & Database

  • Android
  • Cordova
  • SQL
  • Oracle