Stats

Friday, 4 August 2017

Java multithreading,serializable,

Why wait,notify,notifyall are part of object and not thread class?
How to create mutable class. A has B. A is immutable and B is mutable. So can we say A is immutable?
What is difference between synchronized method and synchronized block.Which one to use at what requirements?
S

Tuesday, 24 January 2017

Different methods to create THREADS in JAVA

Method 1:
By extending thread class and creating new object of child of thread and calling start() method

class Mythread extends Thread

Method 2:
By implementing Runnable interface by a class and passing it to thread class and calling start method

class Mythread2 implements Runnable {

run(){}
}

Thread t = new Thread(new Mythread2());

t.start();

Friday, 20 January 2017

Java environment variables

JAVA_HOME : Set to a location of jdk folder
JRE_HOME : Set to a location of jre folder inside jdk
Add %JAVA_HOME%/bin to path variable

Java environment variables

JAVA_HOME : Set to a location of jdk folder
JRE_HOME : Set to a location of jre folder inside jdk
Add %JAVA_HOME%/bin to path variable

Thursday, 3 March 2016

Architecture (folder structure) of Java Web Project .....

Architecture (folder structure) of Java Web Project  --- As below

Web Application Name --- MyWebApp

MyWebApp
        
         --- /src
                 |
                 ---/main
                        |
                        ----/java
                        |
                        ----/resources
                        |            |
                        |            ----/images
                        |            ----/css
                        ----/WebContent
                                     |
                                     ---- /WEB-INF
                                     |             |
                                     |             ---- web.xml
                                     |             ---- /lib
                                     |             ---- /classes
                                     ---- /META-INF
                                     |
                                     ---- *.jsp
                                     ---- *.html

Just explore on each component to get aware of java web project..

    

Monday, 22 February 2016

Environment variables : What it is? How to set it?


Java Bean

What is Java Bean?

Java bean is a simple java class with instance variables (all private) and each instance variable having getter and setter methods (public) for them.

Example :

 class Person {  
 private int id;  
 private String name;  
 private String address;  
 public int getId () { return id; }  
 public String getName () { return name; }  
 public String getAddress () { return address; }  
 public void setId (int id) { this.id = id; }  
 public void setName (String name) { this.name = name; }  
 public void setAddress (String address) { this.address = address; }  
 }