Java Technologies
  • Followers
  • Latest Feeds
  • About
  • Review
  • Gallery
  • Question
Java Technologies
Java Technologies
05 Feb, 2019 06:13 pm study24x7 study24x7

# Multithreading in Java Multithreading is a Java feature that allows concurrent execution of two or more parts of a program for maximum utilization of CPU. Each part of such program is called a thread. So, threads are light-weight processes within a process.
# Threads can be created by using two mechanisms : 1. Extending the Thread class 2. Implementing the Runnable InterfaceA thread can be in one of the five states. According to sun, there is only 4 states in thread life cycle in java new, runnable, non-runnable and terminated. There is no running state.But for better understanding the threads, we are explaining it in the 5 states.

# The life cycle of the thread in java is controlled by JVM. The java thread states are as follows:

1. New : The thread is in new state if you create an instance of Thread class but before the invocation of start() method.
2. Runnable : The thread is in runnable state after invocation of start() method, but the thread scheduler has not selected it to be the running thread.
3. Running : The thread is in running state if the thread scheduler has selected it.
4. Non-Runnable (Blocked) : This is the state when the thread is still alive, but is currently not eligible to run.
5. Terminated : A thread is in terminated or dead state when its run() method exits.

Write a comment
  • Shridhar Agrawal
  • Nice Post
    Java Technologies
    10 Jan, 2019 11:29 am study24x7 study24x7

    The JVM Architecture Every Java developer knows that bytecode will be executed by JRE (Java Runtime Environment). But many don't know the fact that JRE is the implementation of Java Virtual Machine (JVM), which analyzes the bytecode, interprets the code, and executes it. It is very important as a developer that we should know the Architecture of the JVM, as it enables us to write code more efficiently. In this article, we will learn more deeply about the JVM architecture in Java and the different components of the JVM. What is the JVM? A Virtual Machine is a software implementation of a physical machine. Java was developed with the concept of WORA (Write Once Run Anywhere), which runs on a VM. The compiler compiles the Java file into a Java .class file, then that .class file is input into the JVM, which Loads and executes the class file. Below is a diagram of the Architecture of the JVM.

    Write a comment
    Java Technologies
    10 Jan, 2019 11:21 am study24x7 study24x7

    Java is a programming language and computing platform first released by Sun Microsystems in 1995. There are lots of applications and websites that will not work unless you have Java installed, and more are created every day. Java is fast, secure, and reliable. From laptops to datacenters, game consoles to scientific supercomputers, cell phones to the Internet, Java is everywhere!
    Java was originally developed by James Gosling at Sun Microsystems (which has since been acquired by 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.Oracle Corporation is the current owner of the official implementation of the Java SE platform, following their acquisition of Sun Microsystems on January 27, 2010.
    The Oracle implementation is packaged into two different distributions:Java Runtime Environment (JRE) which contains the parts of the Java SE platform required to run Java programs and is intended for end users.Java Development Kit (JDK) which is intended for software developers and includes development tools such as the Java compiler, Javadoc, Jar, and a debugger.
    Garbage Collector :
    Java uses an automatic garbage collector to manage memory in the object lifecycle. The programmer determines when objects are created, and the Java runtime is responsible for recovering the memory once objects are no longer in use. Once no references to an object remain, the unreachable memory becomes eligible to be freed automatically by the garbage collector.

    The traditional “Hello, world!” program can be written in Java as:HelloWorldApplication.javapublic

    class HelloWorldApplication
    public static void main(String[] args) {
           System.out.println("Hello World!"); // Prints Hello World! to the console.  

    Write a comment
    out of 5
    3 Ratings
    5 study24x7
    4 study24x7
    3 study24x7
    2 study24x7
    1 study24x7