How Java is “Multithreading” ?

java-logo

Multithreading

The basic aim of multithreading is to achieve concurrent execution.
Thread: A flow of control is known as thread.
The basic purpose of Thread is to execute userdefined/programmer defined methods.

  1. If a Java program is containing multiple flow of controls then that Java Program is known as multthreaded.
  2. The languages like C, C++, PASCAL, COBOL etc are treated as single threaded modeling languages. Because their programming execution environment contains single flow of control.

Using Single threaded modeling languages we can achieve only sequential execution but ot concurrent execution and these languages never allows us to create multiple flow of controls. Because they never contains predefined library.
The languages like Java and .net are treated as Multithreaded modeling languages because we can achieve both sequential and concurrent executions.
Using Multithreaded modeling languages one can create multiple flow of contorls. Because these languages contains a predefined library for creating multiple flow of controls.
In Java programming the library for developing the multithreading applications is

  1. Java.lang.Thread(class)
  2. Java.lang.Runnable(Interface)

The realtime implementation of multithreading concept of Java is to develop real world server softwares. Such as Tomcat, Weblogic, webspheres etc.
Whenever we wirte any Java program, by default we get two types of threads.

They are:

  1. foreground thread/child thread
  2. background thread/parent thread

A foreground thread is one which always executes the logic of the Java program or user/programer defined methods.
By default there exist one foreground thread and programmatically we can create multiple foreground threads
A Background thread is one which always monitors the execution status of foreground Threads. By deafult there exists one background Thread.

How do u justify every Java progame is Multithreaded ?

Whenever we execute any Java program, to execute the logic of the Java programe one thread is created which is known as ForeGround Thread. TO monitor the execution status of Foreground Thread, one more Thread is created, which is known as Background Thread.
Hence In a Java Program there exists multiple threads.
Every Java program is multithreaded.

Advertisements

How Java is “Portable”?

java-logo

Portable

A portable application is one which will run on every operating system and on every processor without considering their architectures and vendors.
The languages like C, C++, PASCAL, COBOL etc related applications are treated as non-portable applications. Because they never run when OS is different and processor is different.
The language like JAVA and whose related applications are treated as portable because they run on every OS and on every processor without considering their architectures and vendors.
According to Sun Micro systems:
PORTABILITY = PLOTFORM INDEPENDENT + ARCHITECTURAL NEUTRAL
The industries always recommended to develop the distributed applications by making use of portable languages but not by nonportable languages.

Why Java is “Architectural Neutral” ?

java-logo

Java is Architectural Neutral: 

1. An architectural neutral application is one which is running on every available processor without considering architecture of the processor and vendors of the processors

2. In order to say a language or technology is said to be architectural neutral, it has to satisfy the following property.

The language or technology must have some special internal programs which will convert the factors of one processor to another factors of other processor.

The languages like C, C++, PASCAL, COBOL etc and their applications are treated as architectural dependent. Because these languages doesn’t contain any special programs which will convert from the factors of one processor to the factors of another processor.

The language like Java and whose applications are treated as architectural neutral because the software of Java contains some special internal programes which will convert from the factors of one processor to the factors of another processor.

The basic aim of SUN micro system is that the JAVA progammer must be free from hardware and software benchmarks. The slogan of SUN microsystems is WORA ( Write once run/reuse anywhere)

How Java is “Platform Independent”?

java-logo

Platform Independent, But How ?

Define: A language or technology related applications are said to be platform independent if and only if that applications must run on every operating system without considering their architectures and vendors.
In order to say particular language or Technology is said to be platform Independent, it has to satisfy the following properties:

  1. The language or technology related datatypes must take same amount of memory space on every operating system.
  2. The language or technology must contain some internal powerful programs which will convert from one native understanding form of One OS to another native understading form of other OS.

The languages like C, C++, PASCAL, COBOL, etc applications are treated as platform dependent because,

  1. the datatypes of C, C++, PASCAL, COBOL etc will take different memory spaces on different operating systems.
  2. C, C++, PASCAL, COBOL etc languages doesnot contain any special programs for converting one format of one OS to another format of other OS.

The language like JAVA and Whose related applications are treated as platform independet because:

  1. The datatypes of Java takes same amount of memory space on all available operating systems.
  2. The software of Java contains some special internal programs which will convert one format of one OS to another format of other OS

NOTE:
The native understanding format of DOS OS is MOZARTS and the native understanding format of UNIX is EMBEDDED LINKING FORMAT (ELF)

Why Java considered as “Simple” ?

java-logo

How Simple:

    1. There is no complex concept called Pointers. Hence, application development time and execution time is very less bcz of magic of byte code.
    2. Java program contains inbuilt garbage collector program for collecting unused memory space, for improving the performance of Java Applications
    3. Java programming contains rich set of API for an effective development of an application.
    4. Java programming language contains userfriendly syntaxes which makes to develop applications effectively within less time.

First.java
|
(compiler ) – Compilation phase
|
First.class (byte code) – Intermediate file
|
JVM (Interpretation)
|
JVM converts bytecode native understanding form of OS
|
Get Result

Byte code:
Set of optimized instructions generated by the Java compiler during the Java compilation phase, and the nature of the Bytecode is so faster than ordinary pointer code.
JVM?

Garbage Collector ?

  1. A garbage collector is a system background Java program which is running along with our regular Java program for collecting unused/unreferenced memory space for improving the performance of Java applications.
  2. Automatic memory management is taken care by the garbage collector program internally.

Outstanding Features or Buzzwords of Java

java-logo

Features or Buzzwords of Java:

  1. Simple (How can you say that ?)
  2. Platform Independent(How it is Platform Independent ?)
  3. Architectural Neutral hmm.. Architectural Neutral, but how ?)
  4. Portable (Java is Portable ?)
  5. Multi-threaded (Well, How Java is Multi-threaded ?)
  6. Networked (fine.. How Java is Networked ?)
  7. Distributed (Java is Distributed ?)
  8. High Performance (Java rated as “High peformance” ?)
  9. Interpreted (Java is Interpreted, is it ?)
  10. Robust-strong (strong ah, How java is Robust ?)
  11. Dynamic (Java is Dynamic, but how ?)
  12. Secured (How Java is Secured ?)
  13. Object Oriented Programming Language [ OOPS concepts ]

What are considered as drawbacks, loopholes of Java?

java-logo

Drawbacks, loopholes of Java [ Assumption of few people in the Industry]

  1. Slow – Performance Issue
  2. No support for low-level programming
  3. Poor features in GUI
  4. No control on Garbage collection

Even though Java is projected as the most demanded language of the times, but has its own disadvantages. Of course, they are very minor in nature and need not be considered as drawbacks compared to the advantages it brings forward.

Following is the list of Java Drawbacks:

  1. Slow performance: Java’s speed of execution is slow. It is designed as platform-independent as it is not consistet on all the platoforms execution speed vice. Java designers are trying their level best to increase the performance by the introduction of JIT (Just-In-Time) compiler. As we know that in earlier version of Java, it is reported that compilation phase was much faster than interpretation phase.
  1. No support for low-level programming: With Java, low-level programming is not possible, it cannot be done as it is intended to be portable across different platforms. Even though Java is termed as a production language where productivity is very high, but still it cannot do certain things. Java includes a few thousands of classes with JDK 1.5 that takes care of many minute aspects of coding. Using Java, a new OS or new protocols or DVD burning software etc. cannot be programmed.
  1. Poor features in GUI: Java supports GUI controls but with less features. Industry not using heavily as its usage is less because of poor features. For example, an image cannot be placed on a button. With the introduction of javax.swing package few of the features with GUI are at its best. Swing came with plenty of features that can work with any GUI available.
  1. No control on Garbage collection: Garbage collection is one of the built-in features of Java and is entirely managed by JVM. Programmer is not given any chance to control the garbage collection to make coding simple. For this reason, Java does not come with delete(), free(), malloc() and sizeof() etc. functions.

Note: Moving forward, Above discussed are very minor in nature and need not be/can not be considered as drawbacks when it is compared to the advantages it brings forward.

Java v7 features, what is new in Java v7 ?

java-logo

Java community named Java v7 with a codename called “Dolphin

Following is the list of the popular Java v7 features.

  1. Type Inference for Generic Instance creation
  2. Automatic resource management
  3. Automatic null handling
  4. Multi-catch similar exceptions
  5. “strings” in switch statement
  6. Try with resources
  7. Bracket Notation for collections
  8. Binary literals, underscore in literals
  9. Java NIO packages (New File System API)
  10. Support of Dynamic languages
  11. Dynamic syntax

 

Java v6 features, What is new in Java v6 ?

java-logo

Java community named Java v6 with a codename as “Mustang“.

In this version most of the changes are added to the Java API  libraries; no major changes to the Java language

List of most popular Java v6 new features:

  1. Pluggable Annotation Processing API
  2. Collections API
  3. Java Compiler API
  4. Streaming API for XML
  5. Java API for XML Based Web Services – 2.0
  6. Scripting in the Java Platform
  7. JDBC 4.0
  8. Common Annotations
  9. JAXB 2.0
  10. Web Services Metadata
  11. XML Digital Signature
  12. Java Class File Specification Update