This post is based our visitors queries. We will start
to post java Programming Languages examples from beginning. Hope this post will
help lot. Let's get started.
JAVA INTRODUCTION:
Java is one of the programming language. Which is purely based on
OOP's Concepts and High level language too, Java was introduced by James
Goslings and Mike Sheridan who are all working in sun micro systems, they first
called this language as oak later they changed to JAVA. They just want to
create a language that should be platform (Operating Systems) independent. That
means we can write programs in any operating system and that can be compile and
executed in any operating systems.
Figure
1 James Goshling Creator of Java
The only things we need in order to develop java application is Java
Virtual Machine (JVM) and Java sdk(Standard development kit). This can be downloading
from their official site http://java.com/en/download/index.jsp
as free of cost.
We can develop many applications like microwave oven, washing
machine, mobile application and apps for cars, web application, graphics and
many more. Compare with other languages java occupy less space in memory and
execution time is also very less.
I straight away go to programs without explaining oop’s concepts (Hope
you all know c and c++ ) Every java program should have minimum one class in
program we can use more then one class. But, should have only one main method
in it.
As we use include Statements in C and C++. We have to use import
statements in java.
Many classes are predefined in java we just want to import those to
our programs. Java is the case sensitive language.
We can use comments in java too there are two types single line
comments and multiple line comments.
// I’m single line comment
/*
I’m multiple Line Comments.
From Techmarketworld
*/
Many editors are available in market for Java application
development. One of the famous editor in eclipse IDE(Integrated Development Environment). we can download eclipse from http://www.eclipse.org/downloads/
Let’s see the World famous Hello World Program in Java.
// Program gonna print only Hello World.
The above statements is the first statement should be written in
java program. “Java.io” is the package
and ‘*’ represents all the classes under “io” package.
Public static void
main(String argv[]) {
Body
Of The Program;
}
First line is the
class declaration. Name of the class is first within the flower braces there is
main method, In between open and close braces there is a statement called “String
argv[]” that represents java will consider input only as string. Within main
method body of the statements should be there.
System.out.println(“Hello World”);
Above statement is
the printout statement in java. Println will get cursor to the next line. We can
also use print which will keep cursor in the same line.
The whole Hello
World program is:
import java.io.*;
public class first
{
public static void main(String argv[])
{
System.out.println(“Hello World.”);
}
}
Execution Steps
For Java.
Goto run type cmd
then in command prompt type
Set path=”Java
Location”
Then type the
compile command.
Javac first.java
Then type run
command
Java first
Finally Sun Microsytem is under Oracle Corps. Setting path and execution will be next post.