Support us .Net Basics C# SQL ASP.NET Aarvi MVC Slides C# Programs Subscribe Download

Java basics for beginners

Suggested Videos
Part 1 - Java introduction for beginners

Life cycle of Java Program : Developer writes source code in his favorite editor like NotePad, TextEdit etc. For advanced development, there are great IDE (Integrated Development Environment) like Eclipse, IntelliJ, NetBeans etc, that can be used.

Here we have used compiler - javac that compiles java source code to Byte Code. Finally, the ‘java’ command executes this byte code in JVM (Java Virtual Machine)

In this sample program, you will observe keywords like public, static, void, main etc.

Java is strongly typed language and we have to specify the type of variable while declaring the variables. A variable is a container that holds values that are used in a Java program. Declaring variables is normally the first thing that happens in any program.  We can declare variables as follows

int x, y, z;

Before a variable can be used it must be given an initial value. This is called initializing the variable.

int x = 0;   // Variable Declaration and Assignment

Variable Naming Conventions

There are certain rules for naming variables:
  1. reserved words are not allowed.
  2. Cannot start with a digit but digits can be used after the first character.
  3. Can start with a letter, an underscore (i.e., "_") or a dollar sign (i.e., "$").
public class Program
    public static void main(String[] args)
        System.out.println("Hello World");

$  javac

$ java Program

Hello World

java tutorial for beginners

No comments:

Post a Comment

It would be great if you can help share these free resources