Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

Instance Initialization Block

Instance Initialization Block is a block used to initialize instance variables or non-static variables in a class i.e., to initialize a state of an object. The Instance Initialization Block executes after the call of the constructor. It gets exec...

Threads

Threads Threads are used to get the multiple activities in a single process. They are light weight programs. They share memory and files and process state. They have their own local variable and stack and program counter. Every jav...

Static Keyword

Static Keyword Static keyword can be applied on 1.Method 2.Variable 3.Class nested within another Class 4.Initialization Block Static keyword can not be applied to 1.Class (Not Nested) 2.Constructor 3.Interface 4.Met...

Convert String to Date in Java

Its very easy in java to convert String to Date. Java provides SimpleDateFormat to handle Date related functionality. Here we call parse() method of SimpleDateFormat. Example import java.text.SimpleDateFormat; import java.util.Date;...

Phone number Regex Java

Regex for mobile number validation with prefix of '+' ^[+][0-9]{12,13}$ Regex for mobile number validation with optional '+' ^[+]?[0-9]{10,13}$ Use in Code:- Pattern.matches("^[+][0-9]{12,13}$",mobilenumber); Ha...

super and this Keyword

Super Keyword The super keyword in java is the one which is used to refer to the immediate base class members in the sub class. Super Keyword can be used to invoke the constructor of the base class. Whenever you create the object of th...

JAVA Garbage Collection and finalize() method

Whenever an object is created using the new keyword in the memory, then a constructor is called to initialize the the object. Afterwards when the scope of the object comes to end the memory allocated required to be reclaimed at the runtime, then ...

Constructor in Java

Java Class Constructor It is special kind of function, but doesn't have a return type. It has the same name as class name. Constructor is used to initialized the variable of class. we can't call the constructor with the help of object. If...

Create PDF file using java servlet

Here, We are going to create pdf file using servlet in java technology help of darwinsys api. Darwinsys api is most important for creating pdf file at runtime in servlet, in which we can set page no., auther, header, footer and page contents e...

Meaning of public static void main() in Java

hi friends Earlier, i wrote how main method is executed by JVM. Here i have posted, why main() is public static. Correct meaning of public static void main() public : it is visible to all. (so that main is accessible by JVM & other c...

Get Current Date in Java

Hello, We need current date in many situations. Here I am writing different ways to get current date in java. 1. Get current date using java.util.Date. Date currentDate = Date(); System.out.println(Current date : +currentDate); O/P: Curr...

Servlet Filter in java

Servlet Filter is a unique concept of java technology, which intercept to Http repuest in web application. It's can intercept Http request for servlets, JSP's or other static contents. Filter's, In which servlet filter's doesn't dependent on e...

Struts framework

The Struts Framework is used to develop Web applications or we can say that it is a standard for developing Web applications. Its features are as: 1.It is an open source 2. It is based on the Model-View-Controller (MVC), MVC levels has: ...

Collections in Java

Collection in java can be called as a container, or an object which binds multiple elements into a single unit. Collections in java is a framework used to store, and manipulate group of elements. They represent data items that form a group on ...

Sorting using Collection

To sort the collection elements Collection class gives us the methods. In case of Set collection, we have TreeSet that can use to set the Set elements. We can sort elements of type String objects, Wrapper class objects and User-defined class...

Covariant Return Type

When return type of the method of super class is different than the return type of method of subclass and it is also a method overriding then it is known as covariant return type. And here the return type is non primitive. I am writing the si...

Access Denied in spring security 4 even after successful authentication

In spring security after successfull authentication I was getting the Access denied error to go to pages which had the authentication. What I did was. @Override protected void configure(HttpSecurity http) throws Exception { ht...

How to add multiple properties file in spring configuration

Here we have configured the spring mvc configuration. In @ComponentScan we can give the path where we have our components(like controller, model, dao etc). For adding the single properties file we use: @PropertySource("classpath:application.p...

How to disable csrf spring security 4

In spring security bydefault the csrf protect in on. As a result it asks for token during login and other requests. Although its not a good practise to disable the protection but we can do it. As we can see in the code below, http.csrf().disable...

How to authenticate MD5 password encyption in spring security 4

Whenever we deal with password in an application, we go for some encryption. In spring the password it authenticated within the configuration. Here is the sample code where we have already saved the password in encrypted form and now during lo...

ServletRequest Interface with example

The ServletRequest interface have many methods to handle client requests to access a servlet. It is used for access client requests in servlet. HttpServletRequest extends to ServletRequest. Below example will help you to batter understan...

What is Servlet

Servlet is a part of java technology which used for to create web application. Servlet technology is used at server side and generates dynamic web page. Servlet make robust and scaleable to web application of java language. Before Servlet, We...

Object Cloning in Java

Whenever we want to create an exact copy of an object, object cloning is used. So, clone() method of Object class is used to clone an object. The java.lang.Cloneable interface must be implemented by the class to create object clone. And If we d...

Final and Static Keywords in Java

Final and Static Keywords in Java The Keyword Final is used for declaring a class member as constant. The member declared as final cannot be overridden.To prevent a class from being inherited the Keyword Final is used. Initialization of a fina...

Static Initializer Block

Static Initialization Block-SIB The Static members of the class are stored inside the Class Memory space in heap. The Static members can be accessed directly with the class name there is no need to create objects to access them. A block of ...

Encapsulation

Encapsulation is a concept of wrapping up of data into a single unit and hiding implementation details from the user. If we use the private method then they can not be accessed in the other class. If we put a getter setter method to update ...

Final Keyword

Final is keyword that can be used before a class or method or a variable. Final Class They can not be subclassed and the method in it are by default final. public final class MyFinalClass {...} public class ThisIsWrong extends MyFinal...

Why String is an immutable class in Java ?

Why String is an immutable class in Java ? Before going for the above question we should be clear what are Immutable classes ? Immutable classes are the one which once created, then its instances can not be changed. Objects of the Immutabl...

Difference between ServletConfig and ServletContext

ServletConfig ServletConfig is use to initialize a servlet. Its scope is within the servlet i.e.,when servlet starts executing, ServletConfig object will be available until execution of servlet is completed. For a particular servlet, there is ...

Access Modifiers

Access modifiers in java are used to control the access of other classes to access the class or method. There are different type of access modifiers used 1.Public-It is the default access modifier it means that your class or method is visib...

Wrapper classes in JAVA

Wrapper classes are used to convert any data type into an object. a wrapper class gets enclose around a data type and appears as an object. for example: int k = 100; Integer it1 = new Integer(k); The int data type k is converted into an o...

Memory Management in Java

Memory Management In Java The memory management is done in Stack and Heap in java. whenever the java command is triggered it divides memory in two parts(Stack and Heap) for the program, the Stack is used for the execution purpose and Heap is u...

Interface vs Abstract Class

Interface Interface can extend many interface. Interface can extend from a interface only. Interface have only abstract method by default. Interface can have public method only it it. Abstract Abstract can attend only on class at a time. ...

Abstract Class

Abstract class are simply the base class. They can not be instantiated but can be subclassed and have protected, private method unlike the interface. Abstract classes can be declared by simply using the keyword abstract. abstract class Graphi...

Interface

Interface is the way to get the multiple inheritance. This means that a class can inherit two or more class. As java, we can not extend more than one class but we can extend more than one interface. So Interface is used to have inheritance Bu...

Inheritance

Inheritance in java is concept by which one class can have the method of the other class. The class that is being inherited is called Base or Parent class and the one which derive is called the Derive or child class. Inheritance can be of the t...

Fading in and out an element using jQuery

Sometimes we want an image, control or element in a page to fade in and out of visibility .With jQuery it can be done easily. Below are examples of fade in and out method for a div element: Fade In: fadeIn() method is used to fade in a hidd...

Method Overriding

Method Overriding is a type of polymorphism. It is dynamic type of polymorphism. In this we have the method with the similar name in both parent class and child class. But the child class override the method of the parent class when we create ...

Method Overloading

Method Overloading is a type of polymorphism. Using this we can have two different method having the same name in a single class. Method have the same name but different argument through which they are recognize. Argument have 1.Different num...

Method Overriding in JAVA

Method Overriding in Java If child class has the same method which is declared in the parent class, it is known as method overriding in java. Method overriding provides specific implementation of a method which is already provided by its par...

How to clear all textboxes in a form using jQuery

Hi readers ! In this blog we will see how we can clear all textboxes in a form using jQuery . To clear a textbox with id 'txtBox1' in javascript we use below code : document.getElementById('txtBox1').value = ''; We can use this cod...

HttpSessionAttributeListeners in Servlet

In Servlet we can also track the events using the Listeners, In below code script we have to track the events using the listeners. we have easily maintained the HttpSession events with the HttpSessionAttributeListener while we add, remove or repl...

Spring JDBC Template for calling Stored Procedures

In Spring we can call the stored Procedures using the SimpleJdbcCall class. we have use it with IN and OUT parameters. Firstly we need to create the procedure in database. DELIMITER // DROP PROCEDURE IF EXISTS `TEST`.`getRecord` $$ CREATE ...

How to call a method after bean initialization is complete

Hello Friends, If you Want to call the method after your bean is initialize in spring you can use the following options. Use the afterProprtiesSet method. class MyClass implements InitializingBean { public void afterPropertiesSet(...

How to get Session Object in Spring MVC

Hello Friends, we need the session object to maintain the session in the web applications. we have to get the session object in Spring MVC by the following method:- 1:- Put the Session object with the method parameter. Session Object is declar...

How to set and get href attribute in jQuery?

Sometimes we need to set and get value of href attribute of <a> tag from jQuery. We can do this very easily by using element.attr() function in jQuery. Example: for example you declare an <a> as below: <a id="element_url" hr...

Initializing Log4J with Spring

In below Code you have to define the following log4j properties into your log.properties file:- log4j.properties # Global logging configuration log4j.rootLogger = DEBUG, fileout # Define the file appender log4j.appender...

Stack in java

In stack, we save elements in last-in, first-out manner. Stack extends the Vector class and have only one constructor that is default. By this default constructor, we can create an empty stack. Below is the example. public class Exampl...

SortedSet in Java

I am writing a way to implement SortedSet in java. SortedSet have the properties of Set interface plus feature of sorting in ascending order. It is by default provides elements in ascending order. It is very useful in such situation when we do...

LinkedList implementation in Java

Hi friends, Here I am writing a way to implement basic LinkedList. First of all LinkedList has the properties of List interface and AbstractSequentialList class because it implements List interface and extends AbstractSequentialList. ...
1 7 13
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: