What is Java?

JAVA is an Object Oriented Programming (OOP) language that was developed by Sun Microsystems. Before we move on to create our first Java program, we first need to learn a few basic terms that we will come across often while writing java programs.

Class- A class is a group of functions, methods and objects that have similar characteristics

Function/method- it is a collection of statements that are grouped together to perform a specific operation.

Java Overview by Knowledgetpoint

A few things to keep in mind while writing a java program-

  • Case sensitive- Java is a case sensitive language. Certain keywords and names in Java will have upper case letters. Not making them capitalized will cause a compilation error.
  • Semicolon- after every line of java code, we use a semicolon to signify the end of a line, or a block of code.

Now we will write a simple java program to print “Hello World” on the screen.

//A simple Hello World Program
 public class HelloWorld
 {
 public static void main()
 {
 System.out.println("Hello World !");
 }
 }

public- this is an access specifier and it tells the computer that the classes, objects or function following this is accessible to all the classes in the program

class-It is used to specify the class name

HelloWorld- it is the name of the class

static- it means that you can run this method without creating an instance of main

void- it means that this function does not return any value

main()- it is the name of the function and is usually the first method that gets called while running a program

System- it is a pre-defined class that has certain methods that can be called to do certain function in a program

Recommended Post   Features of Java

out- it is a static variable within System

Println- it is a method that can be used to print a line. ‘ln’ specifies that the output will be printed in a new line.

Comments- when we use a ‘//’ before any line, that line gets commented out, which means that the compiler does not compile that line. A comment is used to explain a certain piece of code, or give more information on that block of code.

How to execute the program?

There are many IDE’s or software’s where you can write your Java program and execute it. Make sure that you have the latest version of JDK installed in your computer before you run a program. Some common applications used to execute java programs are NetBeans, Eclipse, BlueJ, or, you can write your program in notepad and execute it from there.

Java has a wide range of applications from smartphones to embedded systems to robotics and games, even websites and desktop applications are made using java. And java’s importance is only growing! Learning java is fun and easy and these series of tutorials will explain to you very lucidly about the various concepts of java.

Content Protection by DMCA.com