Posts

Showing posts from February, 2016

Split digit in java

Image
Below sample program can be used to split number into digits. Here we are using a 4 digit number to do the same. class Split { public static void main(String args[]) { int a=1234,r=0; while(a!=0) { r=a%10; a=a/10; System.out.println(r+""); } } } Output:

MultiThreading in Java

Image
Multithreading is a type of execution model that allows multiple threads to exist within the context of a process such that they execute independently but share their process resources. A thread maintains a list of information relevant to its execution including the priority schedule, exception handlers, a set of CPU registers, and stack state in the address space of its hosting process. Multithreading is also known as threading. Following are some of the common advantages of Multithreading: Enhanced performance by decreased development time Simplified and streamlined program coding Improvised GUI responsiveness Simultaneous and parallelized occurrence of tasks Better use of cache storage by utilization of resources Decreased cost of maintenance Better use of CPU resource Multithreading does not only provide you with benefits, it has its disadvantages too. Let us go through some common disadvantages: Complex debugging and testing processes Overhead switching of cont...