Technology
http://www.bratandblekning.com Top Blogs April 2013 ~ JAVA TUTORIAL

Tuesday, 2 April 2013

Java Tutorial

It is intended to let application developers "write once, run anywhere" (WORA), meaning that code that runs on one platform does not need to be recompiled to run on another. Java applications are typically compiled to bytecode that can run on any Java Virtual Machine (JVM). Java is one of the most popular programming languages in use, particularly for client-server web applications, with a reported 10 million users. Java was originally developed by James Gosling at Sun Microsystem (which has since merged into Oracle Corporation) and released in 1995 as a core component of Sun Microsystems' Java Platform. The language derives much of its syntex from C and C++, but it has fewer low-level facilities than either of them.

Today's world is growing very fast, with the technology and the technology works on certain languages."JAVA" is one of the leading computer language used to develop mobile applications and software's as well, which also plays a  crucial role in all other apps used in phones.

Versions:-

Major release versions of Java, along with their release dates:

  • JDK 1.0 (January 21, 1996)
  • JDK 1.1 (February 19, 1997)
  • J2SE 1.2 (December 8, 1998)
  • J2SE 1.3 (May 8, 2000)
  • J2SE 1.4 (February 6, 2002)
  • J2SE 5.0 (September 30, 2004)
  • Java SE 6 (December 11, 2006)
  • Java SE 7 (July 28, 2011)

So everybody should learn a computer language.So without wasting time we should focus on JAVA.
  1. The first question arises in mind is " what is java"?
  • JAVA is a programming language, used to develop applications and software's as well.Most of us knows JAVA as "object oriented language" but there is a concept which prove this concept completely wrong.


  • when we take a value in 'float' for example-float f=3.14;
  • JVM always takes out round values, like in above example it will take only 3,but what about '.14'. It means some data may be lost ,so that's why i asked you that JAVA is not a "pure" object oriented language.

   2.    Then what is "JVM" and "JDK"?

  • JVM i.e-Java Virtual Machine.  JVM is a compiler ,which takes byte code as an input. You will be surprised to know that every machine consists of JVM.On the other hand JDK i.e-Java Developement Kit. JDK converts the source code into byte code.we call this byte code because every instruction in the code after conversion would be of ONE byte.
  • So we need a JDK to run our program, in Java.


      The traditional HELLO WORLD can be written in Java as:

        class HelloWorldApp {
 
             public static void main(String[] args) {
             System.out.println("Hello World!"); // Display the string.
              }
        } 
 
 
  3. Is Java follows OOP concepts?
  • Yes, of course.Inheritance plays a vital role in java.Since it is used for 'reusability of code' ,it not only reduces code but also the time taken to complete the code.In Java "extends" is used to inherit the base class.for example;-

class A
{
void show()
{
System.out.println("show");
}
}
class B extends A
{
void display()
{
 System.out.println("display");
}
}
class One
{
public static void main(String args[])
{
B obj=new B();
obj.show();
}
}























PAC7RZHYVPEQ