Tuesday, February 22, 2011

Coding Convention in Java


1. Proper Names
  • Should give correct spellings
  • All meaningful names should have to give. Method should have to do same or more what they say..
  • Try to Avoid abbreviations.
  • Don't give java keywords as variable and method names
  • Package name should be lower case.
  • Ex: com.challa.action

Wednesday, February 16, 2011

Web Services Interview Questions and Answers


What is Web Services.
Web Services is Type of interaction between the applications helping their features each other.
Ex: Application A performs addition of two numbers and application B performs multiplication of Two Numbers. Application B required the feature of adding two numbers instead of implementing the same feature in Application B send the numbers to application A and get the result.

What is the use of Web Services or Why you should use Web Services
May be these tips can convince the client.
Web Services make use of developed application.
Reduce the cost for development and maintenance of the application.
Web Services can make easy integration.

Thursday, February 10, 2011

Multithreading in Java

Multithreading in Java

Some times we do multple tasks at a particular period of time to complete the unit of work ASAP.
For example: If your working on one issue in the middle you came to know that this issue is dependent on DB. You need help from
DB guy if DB guy is not available at this point of time, you will not keep waiting for him. you will switch to some other task to work on.
ones he come back you can finish the task which is dependent on DB.

Java also perform muti tasking using Multithreading, so that it will improve the performance of the appilication.

We can see how to implement multithreading in java.

In Java We have two types of multi tasking.
1. Thread based multi tasking.
2. Process based multi tasking.

Processed based multi threading:
The best way to remeber is Multiple programs running at a time
ex: adding and subtracting.

Thread based multi tasking.

Multiple tasks in one program.
if we take one example adding numbers 1+2+3+4=9

if one thread is processing this program if we assume for each operation it is taking 1ms it will take 3ms to add this .
if we perform multithreading first two numbers will add by one thread and the last two numbers will add thread this task will in 1 sec by using multi threading
the result of two threads can added in another secong we can complete this in two seconds, so we are able to save 33% of the time.


Java run time environment manages threads, Threads are processed asynchrously this means that one thread can wait while other thread can continue process.
A thread can be in one of four states:
• Running A thread is being executed.
• Suspended Execution is paused and can be resumed where it left off.
• Blocked A resource cannot be accessed because it is being used by
another thread.
• Terminated Execution is stopped and cannot be resumed.

Thread Priority: In a mutlithreaded programing few threads can be dependent on the result of anthor thread so by giving the priority
we can decide which thread have to excute first.





We can see how to implement multithreading in java.

Creating Thread
Multiple Threads in a Program
Synchronization Concept
Thread Communication