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.
- If a Java program is containing multiple flow of controls then that Java Program is known as multthreaded.
- 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
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.
- foreground thread/child thread
- 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.
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.
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)
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:
- The language or technology related datatypes must take same amount of memory space on every operating system.
- 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,
- the datatypes of C, C++, PASCAL, COBOL etc will take different memory spaces on different operating systems.
- 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:
- The datatypes of Java takes same amount of memory space on all available operating systems.
- The software of Java contains some special internal programs which will convert one format of one OS to another format of other OS
The native understanding format of DOS OS is MOZARTS and the native understanding format of UNIX is EMBEDDED LINKING FORMAT (ELF)
- There is no complex concept called Pointers. Hence, application development time and execution time is very less bcz of magic of byte code.
- Java program contains inbuilt garbage collector program for collecting unused memory space, for improving the performance of Java Applications
- Java programming contains rich set of API for an effective development of an application.
- Java programming language contains userfriendly syntaxes which makes to develop applications effectively within less time.
(compiler ) – Compilation phase
First.class (byte code) – Intermediate file
JVM converts bytecode native understanding form of OS
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.
Garbage Collector ?
- 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.
- Automatic memory management is taken care by the garbage collector program internally.
Drawbacks, loopholes of Java [ Assumption of few people in the Industry]
- Slow – Performance Issue
- No support for low-level programming
- Poor features in GUI
- 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:
- 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.
- 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.
- 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.
- 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.
Following is the list of the popular Java v8 features.
- Lambda expressions
- Method references
- Functional interfaces
- Default methods
- Generic type changes
- Stream collection types
- Java Date Time API
- Parallel Operations
Java community named Java v7 with a codename called “Dolphin“
Following is the list of the popular Java v7 features.
- Type Inference for Generic Instance creation
- Automatic resource management
- Automatic null handling
- Multi-catch similar exceptions
- “strings” in switch statement
- Try with resources
- Bracket Notation for collections
- Binary literals, underscore in literals
- Java NIO packages (New File System API)
- Support of Dynamic languages
- Dynamic syntax
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:
- Pluggable Annotation Processing API
- Collections API
- Java Compiler API
- Streaming API for XML
- Java API for XML Based Web Services – 2.0
- Scripting in the Java Platform
- JDBC 4.0
- Common Annotations
- JAXB 2.0
- Web Services Metadata
- XML Digital Signature
- Java Class File Specification Update