Posts

Showing posts with the label java

HTTP Servlet

In today's post I will share about the advancing with  servlets in the earlier post we have studied about the Generic servlet  and http servlet what else with http servlet can be done will see today in this post, Http servlet is the sub class of Generic servlet and we have seen that in generic servlet has declared service method as abstract and Http is derived from Generic servlet so definitely service method is to be defined in it. Besides service method two more methods have been defined in Http servlet and they are doget and dopost  they are defined as public void doget(HttpServletRequest req,Http ServletResponse res) { } AND public void dopost(HttpServletRequest req,Http ServletResponse res) { } These two methods are very much useful these two methods are used to catch our request from our normal Html forms generally when we click on submit button we are requesting either by post or get that means either we are sending information or requesting through ...

Usage of final keyword in java

Final Keyword In Java 1) Java final variable If you make any variable as final, you cannot change the value of final variable(It will be constant). final int  ACK //(generally it is the convention to give capital letters to the final variable we declare) It dosent occupy space in memory for multiple executions. Its good that it saves memory  2) Java final method If you make any method as final, you cannot override it. class  bird{      final   void  run(){System.out.println( "running" );}   }         class  animal  extends  bird{       void  run(){System.out.println( "animals eat birds" );}             public   static   void  main(String args[]){      animal lion=  new  animal();      animal.run();...

Thread states, brief intro about synchronization of threads and thread class as well as Runnable interface

ok lets continue with multithreading now we have seen the difference between the thread and the process and the internal structure about the threads and process now lets go deeper in it about the thread states..  For the threads to be in execution it undergoes with several states they are  New Ready Running Waiting From running it can go to stop or block and from stop and block and from sop and block it can go to ready state lets discuss  all the states first . Initially New means  A thread that has not yet started is in this state. RUNNABLE. A thread executing in the Java virtual machine is in this state. BLOCKED. A thread that is blocked waiting for a monitor lock is in this state. suspended. A thread is suspended momentarily but it again runs from where it left. Terminated . A thread when we ment to immediate halt but cannot be resumed from where it left these all were the thread states..... now lets talk regarding the thread ...

Getting started with basics of multithreading(java)

Some basics about multithreading...... Java provides inbuilt support for multithreading. we can say that thread is a part of program. Each thread has its seperate path for execution. let me introduce the first, concept of multitasking... What does multitasking means ..? By simple meaning one can  say that multitasking means more than one task at a particular instant of time that is not in sequence or not in chain. Here in java we have two sides of multitasking one is multitasking based on process and other is multitasking in terms of thread . so multitasking            1) process based       2) thread based So what is the difference between these two ? when we say that it is process based multitasking then we have to think that more than one  program are executing concurrently. for example a java compiler is working currently with the text editor working parallel to it. one th...

working of garbage collector in java.....!!

Well in this post i will give u brief introduction and working of garbage collector....!! Garbage collector:- in java garbage means derefrenced or unrefrenced object.it is the process to reclaim the unused memory automatically.In words it is the way to destroy unused objects. To do so we are using free( )in c and delete( ) in cpp. But in java it is provided automatically so it gives a better concept to destroy unused or derefrenced object to be destroyed automatically. Advantages of garbage collector:-  It makes memory efficient as it destroys the members which are consumed in the object and unused which and are stored in heap is done by the JVM(it is the part of jvm) which makes it run at several time intervals. Now generally how could the object get derefrenced .....!!! Generally the basic concept behind the derefrenced object is that the object gets derefrenced when it's scope gets over generally when the program ends its scope would get over definate...