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

Featured

StringBuffer in Java

StringBuffer: As we know in Java String is immutable means we cannot reassign a new value to the same string object. That's why in Java to provide mutability we use either StringBuffer or StringBuilder. StringBuffer is a class in Java which pr...

OVERRIDING IN JAVA

Overriding method is different than overloading, as in overloading of a method, their are more than one method with same name but different parameter with in same class unlike this, In overriding of a method, a method in child class(sub class) ha...

ACHIEVING ABSTRACTION BY INTERFACES IN JAVA

Abstraction is a concept which shows only important(essential) feature and hide background details. In other way, abstraction shows only those things to user which are important and hides the background details. In java we can achieve abstractio...

LITERAL IN JAVA

LITERAL IN JAVA A literal is a value that may be assigned to a primitive or string variable or passed as an argument to a method call. Literals can be any thing like number, text or other information who represents a value. Literals a...

OVERLOADING IN JAVA

In java we can define more than one method inside one class(same class), whose names are same until their parameters or signature are different. This process or method of having more than one method within same class with different parameters or ...

Which Code Editor is Best to teach PHP?

So Friends, There are such a variety of decisions out there nowadays with regards to composing PHP code. Here are only a couple of prevalent IDE: Notepad++ NetBeans Superb Text Dreamweaver jEdit Eclipse What's more, there are...

ACHIEVING ABSTRACTION BY ABSTRACT CLASS IN JAVA

Abstraction Abstraction is a concept which shows only important(essential) feature and hide background details. In other way, abstraction shows only those things to user which are important and hides the background details. for eg :- examp...

Interfaces in java

Interface: Interface is similar to class and represented by interface keyword. It contain only pure abstract methods means only declaration of methods is given inside interface and the class which implements it write the body for that ...

INHERITANCE IN JAVA

Inheritance is a process where sub class have same properties then its super class. In this process sub class acquire all the characteristics of its super class. By using inheritance we can manage information in hierarchical manner. The c...

Polymorphism: Overloading and Overriding

Polymorphism: Polymorphism is one of the OOPs pillars. Polymorphism is the ability of a method to behave differently as per the object. Polymorphism allows programmer to declare a method and use it differently based on the instance. In Java...

Difference between Association and Aggregation

In object oriented programming Association and Aggregation shows the relationship between the classes. Relationship in OOPS defines the connection between the objects. It basically shows how objects are attached to each other and how they will op...

How to rename a file in android

Below is the code to rename a file, in this code newdirectory is the path where the file is existing . The Boolean done will give true value if the file get renamed. String PIC_FILE_NAME="hello.png"; String UPDATED_PIC_FILE="world.png"; Fi...

Diffrence between Method Declaration and Method definition

Hii ,friend's Today I will expain you about the diffrence between Method Declaration and method definition. In Method Declartion you can declare somthing like [public void my function();] here myfunction is the name of method. And In Method...

How Jersey return a JSONObject?

If we try to return a JsonOject in jersey, like this @Path("/formSubmit") @POST @Produces("application/json") public JSONObject formSubmit() { JSONObject json1 =new JSONObject(); return json1; } it may give an error (org....

How to validate a form on submit?

Whenever we create a form, we always have a requirement to put validation for empty fields on some input fields on form submit. For this we use onSubmit attribute of the form, inside which we can define a function that will have validations. E...

How to check if an array contains a specific string in jQuery?

Sometimes we need to check if a particular string exists in an array or not, we can do this by using inArray() method of jQuery very easily. Example <!doctype html> <html lang="en"> <head> <meta charset="utf-8"&g...

What is the difference between == and equals in Java?

In Java, the "==" operator is used to compare references. When we use the == operator in Java it compares 2 objects, it checks whether the two objects refer to the same place in memory or not. Example: String str1 = new String("abc"); S...

JSON with JAVA

A JSONObject is an unordered amassment of name/value pairs. Its external form is a string wrapped in curly braces with colons between the designations and values, and commas between the values and designations. A JSONObject constructor can be ...

Remove duplicate items from ArrayList.

I am removing duplication from arraylist. To do this, first add all the items of arraylist to a HashSet. HashSet takes only unique items. Finally, take HashSet items to the arraylist. List arrayList = new ArrayList<>(); arrayList.a...

Multiple file upload using fineuploader in springs.

For multiple file upload, we are using fineuploader plugin with spring mvc. There is need to include the scripts of fineuploader plugin which allow to select the multiple files at a time. And then getting those files as multipart file using @Requ...

How to enable Cross-Origin Requests for a RESTful web service.

The RESTful web service need to include CORS access control headers in its response, there we have to add a @CrossOrigin annotation to the handler method. It enables cross-origin requests only for the particular method. It allows all the HTTP me...

Installing JAVA (open-jdk) in LINUX using TERMINAL simple steps.

The simplest and the easyest way to install anything on Linux is throught Terminal 1. Open terminal using ALT+CTRL+T 2. Type command shown below: sudo apt-get install openjdk-7-jdk Note: in : openjdk-7-jdk, 7 is for demonstration, you can c...

Custom Exceptions in Java

An exception is any problem that occurs during the execution of a program and disrupts the normal flow of the programs instructions.In basic terms, when a condition occurs, in which it is not sure how to proceed in an ordinary way it creates an e...

Use of intern() of string in Java

String.intern() has a great importance in java. We can use String.intern() to deal with String duplication problem in Java. A string is said to be duplicate if it contains the same content as another string but has a different memory location e.g...

SEVERE: Exception unloading sessions to persistent storage

While making changes in jsp pages in eclipse IDE, i was continously getiing error: java.io.FileNotFoundException:/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/_/SESSIONS.ser SEVERE: Exception unloading sessions ...

Deploy project on tomcat start without project name

When we deploy project in tomcat, by default its run as http://<ip>:8080/warname/index.jsp But when we use domain name and wants that on running tomcat automatically the projects main page is opened, we simply need to add following...

Applet in java

APPLET Applet are the client side web based program run on web browser. Applet implements the functionality of the clients.Dynamic and interactive programs runs inside a web page with a displayed Java capable browser.We don't have constructor...

Extract metadata using ImageIO in java

Hello guys We are creating a file which have some information about file i.e create date, modify date, tags and description etc. called metadata of the file. Now, We are extract the Imagedata using javax.imageIO package requires Imag...

How to compare strings in Java

There are two ways of comparison in Java. In you just want to match value of the string Object.equals() will be used. It simply compares the string values. While if you use == to compare, it will check the object reference. So new S...

Prevent site from showing up in search results on Google, Bing and other search engines

Sometimes we need to prevent our testing.dev site from showing up in search results on Google, Bing and other search engines until we are ready to launch. We can do this by addting "X-Robots-Tag" paramet to header of the response. Create filte...

How to implement select event of Autocomplete feature in jsp?

Sometimes we need do functionality when we select any item from the suggestions that display by autocomplte feature. Example: In the below example I'm using autocomplete() function to get suggestions with the provided keyword. As below by impl...

How to implement autocomplete feature with AJAX in jsp?

Sometimes wee need to call an API or action to get matching list with the provide keyword in Search box, for this we usually implemente autocomplete feature to input field for searching purpose by doing AJAX call. Example: In the below example...

How to check a particular date is within past 24 hours or not?

Sometimes we need to check whether a date is within past 24 hours or not. Generally we implement this kind of functionality when we create an AuthToken or a code that we want to to be valid for some time duration. Example: In the below example...

Find Number of days between two given dates

Here, I am writing simple method to find out the number of days between two dates. In many situations, we need to calculate it. So just pass two dates as parameters of the method and get the number of days in long data type. publ...

Adding Component Dynamically In Swings

Hi All, If you are adding JButton ,JLabel or JComboBox etc dynamically or adding them during runtime For example public class Main { public JPanel buttonPanel ; public static void main(String[] args) { JFrame frame = new J...

Difference between HashSet and TreeSet

Hi, I am explaining the difference between HashSet and TreeSet in Java. First of all they both come from the same family. They implement the Set Interface. In HashSet, values store in random order. That means it is not sure that the ele...

How to add/remove class to an element on keyup event with jQuery?

We can add or remove a class to an element very easily by using addClass() and removeClass() methods. To do this on keyup event of a textbox we just need call these functions when we bind keyup event to textbox. Example: <input id="sear...

How to refresh a web page after a particular time?

Sometimes we need to refresh web page after a particular time interval to refresh the content present on that page. So we can do this easily by writing the meta tag in the page source code: <meta http-equiv="refresh" content="60"/> ...

How to resolve problems with Request parameters encoding?

When we type any Accented char(not all) in input field and try to submit it gets encoded to some other chars automatically. To resolve this we need to enable CharacterEncoding. Follow the below steps in order to resolve problems with Request ...

How to put if/else condition in JSTL?

Sometimes we need to show HTML based on some conditions, so for this we use JSTl in JSP file. Example: In the below code I'm changinf heading based on condition. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <h...

How to apply conditional operators in JSTL?

In JSP file sometimes we need to put conditional operators through JSTL. Example: In the below example I am applying && and || operators. <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <html> <head&g...

How to find the size of a file while uploading in JSP?

Sometimes we need to find the size of a file at the time of uploading to prevent the file that is greater than a particular size. We can achieve this by handling "change" event of a input-file. Examlpe: Suppose I want to upload a file less tha...

How to find the extension of a file to be uploaded in JSP?

Sometimes we need to find the extension (file-type) of a file at the time of uploading to apply some validation on it. We can do this by handling "change" event of input-file. Example: In the below example I want to upload the file having exte...

How to change the context root of dynamic web application in eclipse?

To change the default url of the dynamic web project, say, the default url of a project is http://localhost:8080/DemoApp through which we can access the project using brower but we need a url like http://localhost:8080/xyz, then there is need ...

Add any character to String on a particular location

Sometimes, we need to change some special character on String to fulfill our requirements. For example, we need to show phone number, i.e, 2001256443 as (200)-125-6443 Now we use the substring method of String to solve it. We just add Stri...

Compare two Date object in Java

Sometime we need two compare two dates like which Date object's time coming first or last. Here is the code to compare two dates. Date date1; Date date2; if(date1.before(date2)){ System.out.println("Date 1 is before date ...

How to read properties from property file in jsp?

Create a property file in the package with extension '.properties' and use those properties defined in the file in jsp by importing the resource bundle package in the jsp. Example: config.properties name=tom email=tom@gmail.com phone...

if-else in jstl

In JSTL, the functionality if-else is provided by choose-when-otherwise statement . <c:choose> tag is an enclosing tag for <c:when> and <c:otherwise>. And it is also known as mutual exclusion as only a block of code withi...

Send data through ajax call and receive Json response from controller in Springs

Here is the sample code implementing ajax call to send the data of a form to the controller and receiving json response from controller. Student.java Create a java bean class and generate setter and getter. public class Student { ...

Spring Security 4: Auto login with annotation

Spring security gives us the feature to auto login into the system just after creating an account. Other way is to register then go to login page, and then login to the system. When we login login mechanism spring automatically creates the sess...
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: