Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Why Java is Platform Independent and C, C++ not !!

Posted by Tushar Bedekar
Most of the people have confusion regarding this Question. So I have decided to write something on this topic. Now we will go step by step whats this

What a Platform means to us

The operating system installed on the computer is known to be a platform. Each and every operating system have different structure and format. These operating systems (platforms) differs on the basis of the following factors

  • Like the way they execute the files. 
  • On the basis of system kernels
  • The way the optimize the system for best performance and make use of processor
  • On the basis of different file extensions, etc
For example, Windows operating systems executes .exe files. 
                       Linux here everything is a file. And also here there is no specific extension. Any file                            can be executable here
                       similarly, we have Unix and Mac Os  that have their own file extensions.

Platform Independent Vs Platform Dependent

Platform Independent means the program that we have developed can run / execute (show results) on any platform. That is on any operating system.

Platform Dependent means the program / software that we have developed can run /execute (show results) on a specific platform. That is on a specific operating system.

Why Java is Platform Independent and C, C++ not !!

The programming language like C and C++  do not generate any intermediate code like bytecode in java. The C and C++ generate directly Native Code which is specific to one platform or operating system. This Native code is known as object code (Machine Code ). 

As we also know that Object Code (Machine Code) generation requires some Operating system files to be included which makes it platform dependent.
Whereas in Java we have intermediate code by the name of Byte Code (not a machine code). This can is understandable by JVM (Java virtual Machine) which converts it to the object code (machine Code) . That  why in order to run Java code we need JVM installed on the device which makes java Platform independent. 



Read More

Byte Code Vs Machine Code

Posted by Tushar Bedekar
Generally, "machine code" refers to the data that can be executed by a certain computer, while "byte code" refers to data that can be executed by a virtual machine. The virtual machine takes the byte code and produces machine code appropriate for the actual machine it is running on.



Machine Code:-

Machine code or machine language is a set of instructions executed directly by a computer's central processing unit (CPU). Each instruction performs a very specific task, such as a load, a jump, or an ALU operation on a unit of data in a CPU register or memory. Every program directly executed by a CPU is made up of a series of such instructions.


Numerical machine code  may be regarded as the lowest-level representation of a compiled and/or assembled computer program or as a primitive and hardware-dependent programming language. While it is possible to write programs directly in numerical machine code, it is tedious and error prone to manage individual bits and calculate numerical addresses and constants manually. It is therefore rarely done today, except for situations that require extreme optimization or debugging.


Almost all practical programs today are written in higher-level languages or assembly language, and translated to executable machine code by a compiler and/or assembler and linker. Programs in interpreted languages[1] are not translated into machine code however, although their interpreter (which may be seen as an executor or processor) typically consists of directly executable machine code (generated from assembly and/or high level language source code).

Byte Code:-

Byte code, also known as p-code (portable code), is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, byte codes are compact numeric codes, constants, and references (normally numeric addresses) which encode the result of parsing and semantic analysis of things like type, scope, and nesting depths of program objects. They therefore allow much better performance than direct interpretation of source code.

The name byte code stems from instruction sets which have one-byte op codes followed by optional parameters. Intermediate representations such as byte code may be output by programming language implementations to ease interpretation, or it may be used to reduce hardware and operating system dependence by allowing the same code to run on different platforms. Byte code may often be either directly executed on a virtual machine (i.e. interpreter), or it may be further compiled into machine code for better performance
.

Since byte code instructions are processed by software, they may be arbitrarily complex, but are nonetheless often akin to traditional hardware instructions; virtual stack machines are the most common, but virtual register machines have also been built.Different parts may often be stored in separate files, similar to object modules, but dynamically loaded during execution.


Source:-Wikipedia 
Read More

Java Basic Introduction

Posted by Tushar Bedekar

  What is JAVA:-


Java is a computer programming language that is concurrentclass-basedobject-oriented, and specifically designed to have as few implementation dependencies as possible. 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 tobytecode (class file) that can run on any Java virtual machine (JVM) regardless of computer architecture. Java is, as of 2014, one of the most popular programming languages in use, particularly for client-server web applications, with a reported 9 million developers. Java was originally developed by James Gosling at Sun Microsystems (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 syntax from C and C++, but it has fewer low-level facilities than either of them.


History:-

  1. Java was designed by Sun Microsystems in the early 1990s.
  2. Basic aim of java was to solve the problem of connecting many household machines together.
  3. Project was unsuccessful because no one wanted to use it.
  4. Earlier Name of Java : OAK
  5. Creator of Java :  James Gosling  (the father of Java)
  6. As there was another language called Oak , they decided to rename OAK. New name was given to OAK , OAK was renamed Java in 1994
  7. Java was publicly released on : May 27, 1995
  8. Java was targeted at :  Internet development
  9. Applets Had early support from companies :Netscape Communications

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)
  • Java SE 8 (March 18, 2014)


5 Principles of JAVA:-




  • It should be "simple, object-oriented and familiar"
  • It should be "robust and secure"
  • It should be "architecture-neutral and portable"
  • It should execute with "high performance"
  • It should be "interpreted, threaded, and dynamic"


Sources:-


                  wikipedia

http://www.c4learn.com/java/java-history-2/

Warning 

  • This is provided for educational purpose only.  
  • Though we have collected the contents from the above specified sources in the aim of providing the readers all the information at one place. 

Read More
back to top