java

hello java

Wednesday, 27 August 2014

What is Java?


Java Tutorial or Core Java Tutorial is a widely used robust technology. Let's start learning of java from basic questions like what is java tutorial, core java, where it is used, what type of applications are created in java and why use java.


Java is a programming language and a platform.

Platform Any hardware or software environment in which a program runs, known as a platform. Since Java has its own Runtime Environment (JRE) and API, it is called platform.

Where it is used?


According to Sun, 3 billion devices run java. There are many devices where java is currently used. Some of them are as follows:

Desktop Applications such as acrobat reader, media player, antivirus etc.

Web Applications such as irctc.co.in, javatpoint.com etc.

Enterprise Applications such as banking applications.

Mobile

Embedded System

Smart Card

Robotics

Games etc.

Types of Java Applications


There are mainly 4 type of applications that can be created using java:

1) Standalone Application


It is also known as desktop application or window-based application. An application that we need to install on every machine such as media player, antivirus etc. AWT and Swing are used in java for creating standalone applications.

2) Web Application


An application that runs on the server side and creates dynamic page, is called web application. Currently, servlet, jsp, struts, jsf etc. technologies are used for creating web applications in java.

3) Enterprise Application


An application that is distributed in nature, such as banking applications etc. It has the advantage of high level security, load balancing and clustering. In java, EJB is used for creating enterprise applications.

4) Mobile Application


An application that is created for mobile devices. Currently Android and Java ME are used for creating mobile applications.


what is public static void main(String args[]) in java

every java program start running from public static void main(String args[]) method.how ever your program is big its start from main method. 


public : public is access specifier
example:
public class demo {} // A class, method, constructor, interface etc declared public can be accessed from any other class.
Therefore fields, methods, blocks declared inside a public class can be accessed from any class belonging to the Java Universe.

static : static is a keyword
in object oriented programming we have to create object of class to call particular methods. only that's why we called java is object oriented language
so if we use static keyword then java virtual machine create object automatic
it means you don't have to create object of class
that's why public static void main(String args[]) has static keyword


void:it is return type it return some value from particular method
example
1.no return type.
void run()//method have no return type so it will not return anything
{
System.out.println("hello programmers");//system.in for input on screen
                                         //system.out for output on screen
                                         //print for printing message to screen
                                         //println for printing message to screen from new line
}
main: is a name of method


(String args[]).
Those are for command-line arguments in Java.
In other words, if you run
java MyProgram one two
Then args contains:
[ "one", "two" ]
public static void main(String [] args) {
   String one = args[0]; //=="one"
   String two = args[1]; //=="two"
}
The reason for this is to configure your application to run a particular way or provide it with some piece of information it needs. 

ads