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

java.util.Scanner Class

java.util.Scanner Class: It is used to read input from keyboard. It breaks the input provided into tokens using a delimeter (Whitespace). It extends Object  class and implements Iterator & Closeable interface. To use Scanner class we ...

Object Cloning

Object Cloning: Cloning means to create exact copy of an existing object. To clone a object we have to implement  java.lang.Cloneable interface by that class whose object will be cloned. clone() method is defined in Object class. Examp...

Printing something without using main method

Printing hello without using main method: We can use static block to print something without using main method as static block executes as soon as the class is loaded. To ignore exception "System.exit(0);"  is used which termina...

How to to use Array object sorting method in java

 In the below example I have used ArraySorting method to sorting array object. Here I have initialized Object array and then I have used Array sorting method and java.util.Arrays.sort(Object[]) method to sort object ArrayList. You can see b...

Error: Cannot change version of project facet Dynamic Web Module to 2.3

While working on maven project, encountered an error: Cannot change version of project facet Dynamic Web Module to 2.3. line 1 Maven Java EE Configuration Problem When I tried to run the project it was running fine but always giving t...

Scala

Scala is a programming language and full form is Scalable language. It first released in 2003. Scala is object-oriented and functional language. Many companies that depend on Java switching to Scala to enhance their development productivity, s...

How to create thread

Thread: A thread is a light-weight process which can run independently. A java program can contain multiple threads. Every  thread is created and controlled by the java.lang.Thread class. We can create threads in two ways: By extend...

Enum in java

Enum: It is a special data type used to define fixed set of constants . Enum can contain constants, methods etc. We can use enum with switch statement easily. Enum keyword is used to create enums. Example: class EnumDemo{ pu...

Different ways to create objects

Different ways to create object: We can create objects in java in four different ways.  Using new keyword Using Class.forName() Using clone() Using object deserialization Creating an object with the help of new keyword: ...

replaceAll() to replace square brackets in a String

To replace any character from a String, we generally use replaceAll() method of String. Below is the example String Str = new String("Hello + world +"); System.out.print("Output Value :" ); System.out.println(Str.replaceAl...

java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.JavaType.isReferenceType()Z

I was integrating solr with java using maven dependencies  <dependency> <groupId>org.apache.solr</groupId> <artifactId>solr-solrj</artifactId> <version>5.5.0</version> ...

Command Line Arguments

Command Line Arguments: Command Line Arguments are those arguments which are passed during executing a program through console. Arguments passed from  console can be used in a java program and  can be taken as an input. Example...

Java heap size on Solr

I was working on a huge data, around 10gb, which I needed to import on solr. So I split the data in 1gb files, then I imported the data in solr using the post method. I ended up getting error: SEVERE: java.lang.OutOfMemoryError: Java heap s...

Error: No identifier specified for entity

I was working with spring 4 integration with hibernate 4 and encountered and error: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ...CustomConfiguration: Invocat...

How to extend array after initialization by creating an new array

In the below example I have created extend array function. Here first I have define array length then extend new array value. You can see below program it will clearly describe to extend  array after initialization by creating an new array. ...

How to Merge two array list

 In the below example I have described "how to add or merge two array list?". Here I have created two array String  a[],String b[], then I have initialize values in array . After this I have created arrayList and merge value S...

Wrapper Class

Wrapper Class: In Java there are 8 primitive data types and to convert them into object we use wrapper classes. We use boxing and autoboxing to convert primitive into object and object into primitive. Primitive type and their correspnding w...

Variable Arguments

Variable Arguments : We can pass variable number of arguments to a function in Java. Variable arguments means passing different number of arguments to same function on different call. Variable number of arguments are represented by elipsis(......

Nested and Inner Class

Nested Class: A class written inside another class is known as nested class, and the class that contains the inner class is called the outer class. Nested class are of two types Static class and  Non-static inner class. And non-static ...

PreparedStatement Interface

PreparedStatement interface: It is used to execute a SQL parameterized query and it compiles only one time and we can use it many times. It extends the Statement interface. It is more secure then Statement interface and safely provid...

User Defined Exception

User Defined Exceptions: In some situation a programmer needs to create and throw his own created exception and such type of exceptions are known as User defined Exception or Custom Exceptions. To create own exceptions we have to Extend t...

Checked and Unchecked Exceptions

Checked Exceptions: Checked Exceptions are those exceptions which are checked during compile time. If a program contains checked exception then it should be handled using try-catch block or by using throws keyword, otherwise there will be a co...

How to create executable JAR file with dependencies using Maven?

Using maven we can create executable JAR file with all the requires dependencies and then we can use that JAR file to execute the whole project. So, to create the JAR file just add the below plugin inside the build tag. <plugin> <...

How to to use covariant return type in java

 In the below example I will help you to use covariant return type in java. In covariant return will used  overriding method. The covariant return type specifies the return type in the same direction as the subclass. Here in the below e...

ArrayList Class

ArrayList: The arraylist class provides dynamic arrays for storing elements. It extends AbstractList class and implements List interface. It stores only one type of objects (generic array). Syntax: ArrayList<String> arr=new Array...

Access Modifiers in Java

Access Modifiers: Access Modifiers are used to provide access level and visibility to variables,classes and to methods. There are four access modifiers in Java. Default Private Public Protected 1. Default Access Modifier: ...

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 ...

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...

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...

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...
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: