Monday 24 March 2014

Networking

Networking 

For adding networking functions we should import  java.net package

Logical or Physical link between one or more than  one device or system is called networking.

IP address

16 bit address used to identify each computer/system within network.

Host name

Host name is user defined name which wrap ip address.

Port Number

It is a 16 bit number in order to identify service or program provided by server.

Client

A program which uses the services provided by server.

Server

A program which provides services.

Thread using Runnable Interface

Creating Thread using Runnable Interface

The Runnable interface should be implemented by any class whose instances are intended to be executed as a thread.

The class must define run() method of no arguments.

The run() method is like main() for the new thread provides the means for a class to be active while not subclassing thread.

A thread that implements Runnable can run without sub classing thread by instantiating a thread instance and passing itself in as the target.

Program

class AThread implements Runnable
{
public void run()
{
for (int i=1;i<=10;i++)
System.out.println("Iam runnable");
}
}
class RunnableDemo
{
main(0
{
AThread a = new AThread();
Thread t1 = new Thread(a);
t1.start(0;
}
}

Saturday 15 March 2014

Hai Friends, Today we would learn regarding Inter Thread Process Communication

Inter Thread Process Communication

One Thread Communicate with another thread inorder to avoid dead locks.

1. wait
2. notify or notifyAll

1.wait

To call wait(), notify(), notifyAll() the current thread should be owner of the object.

* We can call these methods only from synchronized block.

* If we call these method from non synchronized block then compiler give IllegelMonitorStateException.

* After calling wait method, the thread releases lock and enter into waiting state.

* After giving the notification by notify() the thread not release the lock.

* The only case lock is released is wait method.

Thursday 13 March 2014

Today we are going to learn about how to use Synchronization in Multi Threading Through program

class Account
{
private float balance;
Account(float balance)
{
this.balance=balance;
}
void deposit (String name)
{
for(int i=1;i<=10; i++)
balance = balance +100;
System.out.println(name+" "+"Balance is" +balance);
}
}
class TransactionThread extends Thread
{
Account acc;
String name;
TranscationThread (Account acc, String name)
{
this.acc = acc;
this.name = name;
}
public void run(0
{
acc.deposit (name);
}
clas AccountSynch
{
main()
{
Account acc1 = new Account(5000f);
TransactionThread  t1= new TransactionThread
TransactionThread t2 =(101, "Rama");
TransactionThread t2=(acc, "Sita");
t1.start();
t2.start();

Monday 10 March 2014

Today we are going to learn about Java. 

Core Java

Multi Threading:

Synchronization/Locking Mechanism

More than one thread shares the resources.

There are two types of Locks

1. Object Locking

2. Class Locking

* When more than one thread operates on same resources there is a chance of getting inaccurate results to overcome these methods of that class is defined as synchronized.

synchronized return type method-name(parameters)
{
statements;
}

Saturday 8 March 2014

There are many software courses to learn and there many multinational companies which are giving jobs for software professionals.In these days learning software courses is very easy and it can be learnt anywhere. But my aim is to give confidence for whom doesn't know basics at all regarding software courses. One who graduated recently and if they want to enter software industry then this blog is for those people. Listen my friends i am here to give you people a very clear idea on courses to learn and keep in touch with to learn and i would give material which industry requires. I won't post material who may not be useful to get job. I look into the requirements of companies.
Good Morning Everybody

In this blog you will get material regarding all software courses. You can learn as much as you can languages through my blog. It is very useful for those who can't afford to get coaching for software courses. Please utilize my blog as much as you can. This material would be kept by me and this material is from my own experience.