Learn free java tutorials


Naming style cases strings - camel,snake,kebab,pascal cases tutorials with examples

February 27, 2020 ·  3 min read

Case name styles in programming String is a group of characters which contains word(s). Sentence is group of strings or words In programming languages, there are different types strings cases styles available There are various case styles for combing words to declare a variables or functions or URL in programming languages, This will be used as conventional notations only. All programming languages not follow all cases. For example, Camel Cases in java are used for declaring variable names,kebab case are used in lisp language for define variable names....


Java Unique Number Generator - UUID or GUID with examples

November 12, 2018 ·  4 min read

In this blog post, We are going to learn java Unique Number Generator- UUID or GUID with examples. You can also check my previous articles on  javascript UUID Generator example VueJS UUID Generator example Angular UUID Generator example React UUID generator Example Java Unique Number Generator - UUID There are two types of unique identifiers. UUID is a universally unique identifier, GUID is a globally unique identifier, The difference between UUID and GUID, Both are returning 126 bits,...


jcmd command line utility tool to debug and diagnostic java application

October 30, 2018 ·  3 min read

In this blog post, We are going to learn JCMD command line utility with examples. jcmd command utility  JCMD is command line utility tool to diagnose the java process. This will be useful in Java applications to debug the following use cases. When Java application is crashed To know the Application Heap Memory and Garbage collection  troubleshoot and diagnose JVM applications This tool is available as part of Java JDK installation....


java- java.lang.StringBuilder class, methods examples with tutorials

October 26, 2018 ·  3 min read

In this blog post, We are going to learn StringBuilder class and its method tutorials with examples. java.lang.StringBuilder class StringBuilder class is used to manipulate the string of characters in a mutable way. It is replaced in place of String and StringBuffer. Some of the features of StringBuilder class in java. This class is defined in java.lang package. Syntax public final class StringBuilder extends AbstractStringBuilder implements java.io.Serializable, Comparable<StringBuilder>, CharSequence Import notes of StringBuilder and differences with other String classes  StringBuilder and StringBuffer is a mutable class, String is immutable class StringBuilder is faster than StringBuffer in single threaded applications because it consumes less memory and faster....


Gitignore file Generator examples - Eclipse | Intellij |Netbeans

October 16, 2018 ·  2 min read

In this blog post, We are going to learn how to git ignore files in IDE - Eclipse, IntelliJ, and Netbeans In my previous post, We are going to learn gitignore file tutorials with examples gitignore file gitignore file contains patterns of files and folders which prevent from committing to git repository when the code is committed and push to a remote repository This file is specific to IDE and Operating systems and languages....


Different ways to print java object tutorials with examples

September 30, 2018 ·  4 min read

In this blog post, We are going to learn the Print object content as String with examples. Java Object Content Print Java object holds properties and methods. The object can be Collections of Custom classes. When any issues come in project development, There is a need to print the java object to console to inspect the actual values for more debugging Each class in java extends Java.lang.Object and toString() methods...


java - Beginner Guide to Epoch Time with examples

September 2, 2018 ·  2 min read

Epoch time Introduction Epoch time is a number of seconds that already passed from 1 January 1970 UTC time. Every Day the total number of seconds is 24* 60*60 seconds. Epoch time return the long number between the current time and 1 January 1970 time Epoch time is also called Unix time. Every programming language provides API for handling Unix time. Java also provides Date API for manipulation of Epoch Time....


Best 10 java.math.BigInteger class Examples with tutorials

September 1, 2018 ·  3 min read

In this Blog post, We are going to learn How to Convert Integer/int from/to Biginteger with examples. You can also check my previous posts on BigInteger class tutorials in java BigInteger Class tutorials Convert BigInteger to/from String Convert BigInteger to/from BigDecimal Convert BigDecimal to/from String Convert BigIntegerto/from Integer/int Convert BigIntegerto/from Byte Array/int BigInteger Examples BigInteger is a Java class defined in java.math package. BigInteger will be used in arbitrary precession arithmetic calculations where the result value of this calculations is out of range of values of all primitive numeric types....


Java Example - Convert BigInteger to Byte Array or Byte Array to Biginteger

September 1, 2018 ·  2 min read

In this Blog post, We are going to learn How to Convert Integer/int from/to Biginteger with examples. You can also check my previous posts on BigInteger class in java BigInteger Class tutorials Convert BigInteger to/from String Convert BigInteger to/from BigDecimal Convert BigDecimal to/from String Convert BigIntegerto/from Integer/int Convert BigIntegerto/from Integer/int Top 10 Big Integer examples Convert BigInteger to/from ByteArray BigInteger Example Byte Array is an array of bytes....


Best 10 Java Array Sort examples

August 15, 2018 ·  4 min read

Arrays Sort Examples Array is a collection of elements stored under a single name. In my previous article, discussed about array tutorials with examples Sort is based on ascending or descending order.For numbers,Ascending order means lowest number to highest number, Number will be increasing order descending order means highest number to lowest number, numbers will be descresing order. For Alphabets, A,B,C is natural order and ascending order, C,B,A is reverse of ascending and descending order....


How to Convert Float to String or String to Float in java with examples

August 15, 2018 ·  2 min read

Float and String are data types of objects used to store different values. In Applications, UI form can have input text value which accepts the floating value, To deal with form submission and do manipulation of this float values, We have to do the conversion for String to float or float to String in Java. This tutorial talks about various ways to do this conversion. float values example float f = (float) 4....


Learn Basics of Arrays tutorials with examples in java

August 14, 2018 ·  3 min read

Java Array Introduction The array is used to hold of a collection of elements under a single name. Here a collection of elements are of the same type are passed. If you have a list of values to store it, without arrays, you have to declare elements, if there are 200 values, You have to declare 200 declarations String str1="one" String str3="two" String str3="three" Instead of a declaration of multiple values, Arrays store the collection of elements under a single variable name....


Fix for java.lang.UnsupportedClassVersionError: Unsupported major.minor version issue in java

August 13, 2018 ·  3 min read

UnsupportedClassVersionError is a runtime error thrown when Java code is compiled and run with incompatible and unsupported versions. UnsupportedClassVersionError extends ClassFormatError which is a sub class of LinkageError. This is not compiled time error but runtime error thrown when JVM tries to run a java class file with major and minor version are not supported. error stack trace contains a message like an Unsupported major.minor version x.x. x.x is a number corresponding the version of your installed java version....


Learn Java 10 Local variables Type Inference tutorials with examples

August 13, 2018 ·  6 min read

In this tutorial, We are going to learn the Java 10 feature - Local variables Type Inference.JDK Enhancement Proposal(JEP) 286 is a new feature in Java 10 Local variable type inference introduction type inference is automatic detection of a data type by the compiler based on the initialized value. With Java 10, it was introduced for local variables. This feature is already there in other languages like Scala, javascript, and c#....


Learn CopyOnWriteArrayList tutorials with examples in java

August 13, 2018 ·  3 min read

CopyOnWriteArrayList introduction CopyOnWriteArrayList is a class in java.util.Concurrent package. This was introduced in Java 5 as part of java concurrency API changes. This is used in multithreaded safe applications. This is a concurrent version of ArrayList. Why CopyOnWriteArrayList introduced?  ArrayList is list implementation in java collections ArrayList is not threaded safe and can not be used multi-threaded applications. see the below example Created ArrayList object. Iteration of each element is traversing using Iterate method....


How to convert String to Long or Long to String in java with examples

August 13, 2018 ·  3 min read

Long, String objects Long is an object which holds larger values. It is a wrapper class for primitive type long. if you are initializing long values, you need to add l to its value. The string is a class to represent a group of characters enclosed in a double quotes. if the string contains non-numeric characters, converting this non-numeric values to long or any numeric data type results in NumberFormatException....


How to convert String to Double or Double to String in java | Double example

August 12, 2018 ·  2 min read

Double String example The string is a sequence of characters enclosed in double quotes. Double is numeric data type of double precision floating values which hold double primitive types. Both have different values for a different purpose. Sometimes, In our applications, It is required to convert a string to double or vice-versa in java. This is a basic common requirement for knowing developers. Double holds 64 bits numbers, double value has d or D added to its value....


How to convert BigInteger to BigDecimal or BigDecimal to BigInteger in Java with example

August 12, 2018 ·  2 min read

In this Blog post, We are going to learn How to Convert BigInteger from/to BigDecimal with examples. BigInteger and BigDecimal examples Integer, Long and Double is basic numeric types which are used to store numeric values up to a limited range of values for basic arithmetic operations.BigInteger is used to store the large numeric values.BigDecimal is used to store the correct precision and rounding numbers where precision is important in financial applications....


How to convert BigDecimal to String or String to BigDecimal in java with examples

August 12, 2018 ·  3 min read

In this Blog post, We are going to learn How to Convert String from/to BigDecimal with examples. You can also check my previous posts on BigInteger class in java BigInteger Class tutorials Convert BigInteger to/from String Convert BigInteger to/from BigDecimal Convert BigInteger to/from Integer/Int java.math.BigDecimal class BigDecimal is a class in java.math package of java language. This is data type which can be used in the financial and ERP applications where precision of a number is important....


Java 11 String new methods with examples

July 28, 2018 ·  2 min read

In this blog post, We are going to learn the six new methods added to String class in Java 11. JDK 11 features - Strings Java 11 Version added few more methods to the string class. This method helps the developer to simply the coding styles and improve performance lines() Method Returns the Stream of strings separated with a line break from multi-line strings Syntax Stream<String> lines() Stream lines = string....


Learn XML and JSON basics with examples

August 7, 2016 ·  3 min read

In this blog post, We will discuss XML and JSON basics, pros/cons and also convert JSON to XML or XML to JSON in java. JSON Basics JSON is abbreviated as javascript Object Notation. JSON is the independent format for exchanging data JSON is a simple format which contains key-pair values. JSON and XML are data formats used to transfer data between different systems of enterprise applications. JSON is lightweight and simple to read....


Scanner Class tutorial with examples in java

November 19, 2014 ·  3 min read

Scanner Class tutorial with examples in java In this blog post, I will covert the scanner class tutorials with examples ofJavaa language. Basics Usage of Scanner class in java.  Scanner class is one of the basic default classes provided by Java language as part of JDK installation. Scanner class is located in java.util package Java.util.Scanner class is one way to take the input from the keyboard in java. Scanner class read the input in the form of java primitive data types like Integer and String....


Java 7 feature :Multi catch block exception handling example with tutorial

May 30, 2013 ·  2 min read

Java 7 features – Exception Handling _Java 7 language has introduced features like Usage of Stirings in Switch case, and improving the exception handling. It introduced _multi-catch block.__Prior to Java 7, if we want to handle multiple exceptions in the single catch block is not possible, but we can achieve this using multiple catch block where each catch block used to catch the single exception. Let us see the example of multi-catch exception handling in Java 7...


2 ways to create Connection Pool in java with examples

May 29, 2013 ·  4 min read

Java Connection Pooling Usually applications are hosted on application server, and talk to database using database connection. data base connection is plain HTTP socket connection to database machine. Whenever request comes to application, application create a plain socket connection to database, once the request is completed, connection is timeout/closed, so like this for every request, connection is established and performances of application is decreased.So connection is expensive operation, so for every request, creating connection and closing connection is expensive operation....


Java 7 features: String in switch case usage tutorials with examples

May 24, 2013 ·  3 min read

String in switch case tutorials Java 7 language has introduced using a string in the switch case. Prior to Java 7 version, Switch case allows only Integer, byte, short, char variables and enumeration values only. Support of String is not a great language feature but a handy for developers to use strings directly in switch case and simplify the developers in readability. This post is my first post on Java 7 features; I will do more posting on Java 7 features in coming weeks....


2 Ways to solve java.lang.ArrayIndexOutOfBoundsException errors in java

May 23, 2013 ·  2 min read

In this blog post, Weare going to learn How to Fix/handle java.lang.ArrayIndexOutOfBoundsException errors in java What is java.lang.ArrayIndexOutOfBoundsException error in java? This exception is one of the common exceptions in java. Java developers used to get this exception in the projects when manipulation of data retrieved from the database as well as dealing with arrays and array lists. ArrayIndexOutOfBoundsException is a class in java. lang package which extends IndexOutOfBoundsException, extended by RuntimeException....


Top 3 Examples of variable arguments or varargs feature in java

May 10, 2013 ·  2 min read

Variable Arguments feature in java Varargs Feature in java Variable arguments feature is one of java language feature introduced in Java 5. Java 5 introduced a lot of new features like Enum feature[] etc. method have multiple arguments, this arguments count are fixed, with Variable arguments feature in java5, the method can have multiple arguments(zero to many) to be passed without defining a number of arguments by specifying variable argument syntax....


Top 3 Java Text Formatting examples : MessageFormat

May 3, 2013 ·  2 min read

Why MessageFormat is introduced:- Before MessageFormat is introduced, we used to process the messages using String concatenation, the disadvantages with String class processing is Strings are immutable objects, more objects are created in heap memory and these messages order is not same for every language, because of this problems, Sun has introduced text format classes like MessageFormat String stringText="Hi"+ name+ "How are u"; MessageFormat is class in java.text package, introduced in java 5 language, and this text format class in java used to provide capabilities for Internalization....


How to Internationalization java applications

May 3, 2013 ·  2 min read

How do we Internationalization in java Usually, applications are developed in English, but when we want our applications to target users or customers of different countries, Sun provides Internationalization concept in java. Internalization or I18n is a set of Java classes or interfaces provided by java to support the global application in java. It means Java applications work with multiple languages and multiple countries. What are items to do in Internationalization...


REST API basics,tutorials

April 30, 2013 ·  2 min read

REST API examples REST is one of the popular web services in the software world. REST is abbreviated as Representational State Transfer. REST API used to develop HTTP based web services REST is similar to SOAP web services, SOAP web services can be accessed using object and methods, whereas REST can be accessed using URL with HTTP operations like GET, POST, DELETE, PUT. REST API is used to write the apis for web applications to access the services....


Basic of Cron expression with detailed sample examples

July 16, 2012 ·  2 min read

Cron Expression examples Cron expressions are fixed size certain string formatted characters to represents the particular time or set of specific interval times used in scheduler programming. Cron expressions are used in either Unix programming or any other programming languages like java. Java has a quartz framework as the scheduler to run jobs or task in a specific interval of time. In Quartz scheduler, cron expression is specified for job triggers which will be executed by quartz scheduler....


Grails with java:Learn Basics of Grails Domain Constraints

June 28, 2012 ·  2 min read

Grails Constraints grails are a framework developed in a groovy framework which internally uses java to build the applications very quickly. I got a chance to work on grails application. so I want to blog about the grails constraints. As you know in any web programming language, we need to do the form level validations. which we can do it either at client level validation or server level validation client level validations mean, the entered data cannot be sent to the server and do the validation at the browser, To do this, we have a lot of scripting languages like JavaScript or vb scripts....


Basics of Groovy on Grails framerwork in java

June 25, 2012 ·  2 min read

Groovy on Grails is open source application framework build on java language using groovy scripting languages. what is groovy framework:- Groovy is scripting programming language which runs on java virtual machine. Groovy is a java module that has one dependency jar file. Groovy is a scripting framework for building applications on top of java. It will reduce a lot of java code to write the applications and the files are saved with extension as ....


javac compiler tutorials with examples in java

March 10, 2012 ·  6 min read

In this blog post, We are going to learn the java compiler command with tutorials and example usage Java compiler - Javac tool Javac is java compiler tool developed by Sun framework. Java compiler used to read the java program and compiles this java program machine-readable bytecode. Javac tool is shipped as part of JDK software installation and found in the bin folder of JDK installed folder. This tool is mostly a basic tool to learn for java programming developer....


6 ways to resolve java.lang.NoClassDefFoundError in java

March 6, 2012 ·  6 min read

How to fix for java.lang.NoClassDefFoundError error in java NoClassDefFoundError in java is one of the strange error used to get in java applications. Usually when we run java programs, we used to get the Exception in thread “main” java.lang.NoClassDefFoundError: in our programs I got this exception alot of times. Solving this NoClassDefFoundError is very easy but we have to know the ways to solve this. NoClassDefFoundError exception will be in different cases like windows,linux,unix and tomcat/websphere,jboss....


Static Import feature tutorials in java with examples

March 5, 2012 ·  3 min read

Static Import in java 5:- static import is java language feature introduced in java version 5 alias code name as tiger version. This was introduced to simplify the access of static variables and static members without using classname.Before static import is introduced, we have normal import statetements for every java class to use the methods and classes with using class name How the java code looks like before static import feature is introduced?...


Solution for java.lang.StackOverflowError exception in java

February 29, 2012 ·  2 min read

StackOverflowError is one of frequent exception/issue in java projects. This exceptions should not be caught by the programmer but thrown by Java virtual machine at runtime. whenever this exception is thrown, application stopped its execution java stackoverflowerror class overview:- StackOverflowError extends java.lang.VirtualMachineError class which in turns extends java.lang.Error. so what is java.lang?Error?. Error class extends Throwable class specifies unusual errors that application unable to catch these exceptions. These exceptions are not programming related exceptions but thrown by java virtual machine....


How to inject enum object of java 5 in spring framework?

February 27, 2012 ·  2 min read

Inject Enum of java in Spring Framework:- Spring framework is a popular opensource framework developing applications in java. Enum is java enumeration keyword introduced in java 5 features. usually, In Spring configuration file, we will inject different custom classes as well as predefined classes like Integer, String. But injecting enum class in spring container is different as if we not correctly inject, we will end of with exceptions like “org.springframework.beans.TypeMismatchException: Failed to convert property value of type"....


How to solve IllegalArgumentException in java with examples

February 15, 2012 ·  2 min read

Fix for IllegalArgumentException in java:- IllegalArgumentException is one of frequent exceptions occured in java programming language. This exception extends RunTimeException class. These are also called UncheckedExceptions and need not to be handled in java code for this exceptions occurs at runtime. Exceptions in java are used to indicate that there is an error in your code. IllegalArgumentException is good way of handling in the code.This exception occurs when caller calling method with incorrect arugment types for the methods....


Deque examples with tutorials in java

February 10, 2012 ·  5 min read

Deque Object in java:- Deque is abbreviated as double-ended queue like a normal queue, can store the collection of objects. It is one of the collections class introduced in Java 6. Why deque is different from other collection classes? the answer is, in the deque, we can insert and deletes the objects from both starts, end of the collection. whereas normal collection inserts/deletes are happening at last only. Deque is interface introduced in java 6 java....


Java NumberFormat tutorials: 3 Examples of NumberFormat in java

February 10, 2012 ·  4 min read

Basic Usage of NumberFormat in java :- When we are developing any applications targeted to different countries, the presentation of the data shoulld be specific to each country eventhough data storage is always same. This is tedious task for java programmers to handle of formating the same data to specific country. java introduced Globallization and localization concept. As part this there are number of formatting classes including NumberFormat are introduced in java....


Best examples of using ArrayList Class in java: java array list samples

February 6, 2012 ·  5 min read

ArrayList in java ArrayList is the implementation of List interface in java.utils package.ArrayList stores the collection of objects in the order of insertion. ArrayList stores the objects and grows the size of the list dynamically that’s why array list is a resizable array. whereas an array is static once assigned the values, the size is fixed. In the real-time programming, ArrayList is used to manipulate the collection of custom objects....


java enums tutorial: Best 10 examples of enum in java

February 6, 2012 ·  4 min read

Enums in java:- Enum is one of the cool languages featured introduced as part of Java 5 version. enum or enumeration values are constants meaning which can not be changed. These constants are specified using upper case letters as per java coding specifications Enum is introduced in Java 5 version, Before Java 5 was introduced, we have to write our own constants to handle enum functionality as follows public class MonthsConstants{ public static final String JAN="1"; public static final String FEB="2"; ....


Top 10 Examples of HashMap in java : HashMap tutorial

February 5, 2012 ·  3 min read

How HashMap works in java:- HashMap is implementation of Map interface in java. HashMap is popular collection framework used in every day life of java developer. In most of the backend programming, HashMap is used to store as temparary cache for either request scope or session scope.HashMap is combination of key and values. key and values should be either String,primitives or any custom object. The key stored in the HashMap is based on the hashCode computed for key’object Map is implemented by HashMap in utils package...


Hibernate criteria query | restriction projections Order by examples

January 31, 2012 ·  3 min read

Hibernate Criteria API criteria are used to select the specific type of data from the database. Let us take the use case, where the website has search capability provided, you have to search the website with different conditions, To handle this using hibernate, we can compose different parameters to Criteria object and make custom sql queries to the database to retrieve the data. Hibernate criteria API is alternative to Hibernate query language or HQL and generate complex queries using different criteria....


Best String examples with tutorials in java

January 30, 2012 ·  3 min read

String class or object in java Strings are a sequence of characters in any language. For Java, the sequence of characters is stored in the form of java.lang.String object. Strings are immutable objects, meaning once created, the contents of the string, can not be modified in memory that means string objects are read-only. String class is final class meaning we can’t able to override the behavior of the methods defined in strings....


How to setup and Latest install tomcat 9 server in windows?

January 28, 2012 ·  4 min read

Tomcat is an application server which supports for running java,j2ee based applications. Tomcat provides different services like any other application servers such as JBoss, WebSphere Is tomcat Application Server or Web server? Yes. Tomcat is an application server which provides the following services 1.Object Management like automatic object creation, modifying, and garbage collection 2.JDBC Connection pool mechanism 3. Maintaining multiple nodes in the cluster setup 4.99.99 startup time for running applications...


Timers in java: Create timer in java with example?

January 25, 2012 ·  4 min read

The timer in java:- Timer is java class is in java.utils package, Timer is used to specify the task execution for every interval or after the holdup of some time in an application. TimerTask in java:- TimerTask is java class in java.utils package. TimerTask implements a runnable interface which has run method to override. the run method of TimerTask can have code for which you want to apply the timer functionality....


Issues with OutOfMemoryError: PermGen space in tomcat and solution

January 15, 2012 ·  3 min read

Recently when I have deployed a web application in tomcat 6.0.32 in windows Development environment, I got following PermGen Space errors. so I would like to write the post on this with root cause and exceptions Caused by: java.lang.OutOfMemoryError: PermGen space at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) at java.lang.ClassLoader.defineClass(ClassLoader.java:615) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) What actually causing OutOfMemoryError? This issue either occur in the startup of your application or in runtime whenever the application is running....


Find out 32 bit or 64 bit java jdk version in Java

January 11, 2012 ·  3 min read

I have encountered one of the issues with java installation which is not compatible with my 32-bit machine. This blog post is helpful for check JVM version to install latest java version install. Check 32 bit or 64 bit for Java installation 32 bit is 4 bytes of size, whereas 64 bit is 8 bytes of size. That means 64 bit takes more memory than 32 machines Most of the times, if your code complies with 32-bit JDK version, then you need to execute this class files in 32 bit machine/64 bit machine only....


10 Interview Questions answers for Log4j in java

January 11, 2012 ·  2 min read

What is Log4j? Log4j is logging framework provided by apache foundation for java based applications. In the applications, if you want to log the same information, like any event, triggered, or any Database updated is happened, We have the need to log the specific information or error for the useful of the application. To debug any issues in applications, we have to log the error/exceptions in the logs. For this, we will use the log4j mechanism ....


What is final keyword in java?

December 30, 2011 ·  2 min read

final keyword in java final is one of the Java keywords which can be applied to variables, method, and class and the meaning is once final is applied, it’s value or state cannot be changed what is final keywords for variables:- if we apply the final keyword to fields or member variables, the variables are tread as constants, that means once created, and assigned the value, The value can not be changed...


How to Convert BigInteger to String or String to BigInteger in java with examples?

December 26, 2011 ·  3 min read

In this Blog post, We are going to learn How to Convert BigInteger from/to String with examples. You can also check my previous posts on BigInteger class in java BigInteger Class tutorials Convert BigInteger to/from BigDecimal Convert BigDecimal to/from String Convert BigInteger to/from Integer/Int BigInteger Object in Java Conversion of BigInteger to String is one of the days to day task for java programmer. A few days back I have the need to convert the BigInteger to Integer in my programming....


Why main method is declared as static in java?

December 26, 2011 ·  2 min read

Why the main method is declared as static in java? As you know in a simple java program, we declared the main method as following way **public static void main(String args[]) ** here the method name is main. By using java filename command, JVM loads the Java class into the memory and looks for the main class in the java file. if the main method is not found, it throws NoClassFoundError exception....


How to convert BigInteger to Integer or Integer to BigInteger in java?

December 26, 2011 ·  3 min read

In this Blog post, We are going to learn How to Convert Integer/int from/to Biginteger with examples. You can also check my previous posts on BigInteger class in java BigInteger Class tutorials Convert BigInteger to/from String Convert BigInteger to/from BigDecimal Convert BigDecimal to/from String java.math.BigInteger Class BigInteger is a class defined in java.math package. Integer class is a wrapper of primitive type int and defined in java.lang package....


BigInteger tutorial with example in java

December 25, 2011 ·  3 min read

In this Blog post, We are going to learn BigInteger tutorial with an example in java. You can also check my previous posts on BigInteger class in java Convert BigInteger to/from String Convert BigInteger to/from BigDecimal Convert BigDecimal to/from String Convert BigInteger to/from Integer/Int BigInteger Class introduction BigInteger is one of java object in java.math package introduced in JDK1.6. Integer Primitive stores the numerical values between the range of 2 power 31 -1 -2 power 31....


How to Store unique objects to avoid the duplicates in java List?.

December 19, 2011 ·  1 min read

In real time scenarios, you encountered the cases having duplicate objects in a list. To remove the duplicates, There are no java Collections List implementations to solve this. In Collections, List allows duplicate values and maintain the insertion order, whereas Set does not allow duplicates, doesn’t maintain order. To achieve this, We can do this in a number of ways. List Implementation: for Avoiding Duplicates-  We can write our own set and list implementation by extending List implementation and Implementing Set interface You can not consider implementing List as already Set is implementing....


what is volatile keyword in java?

December 19, 2011 ·  1 min read

Volatile Keyword Basics Volatile is a keyword in java which is applicable to member variables only. what does it mean if we declare a transient member variable in an object? In the multithreaded applications, state of any object can be modified asynchronously by multiple threads This causes the consistency to the state among different concurrent threads. To maintain the consistency between all the threads for that state of an object we can declare a member variable as transient....


What is the use of javap command in java?

December 11, 2011 ·  1 min read

javap is the tool provided by the java language which was bundled with JDK software. This tool (javap is located in JAVA_HOME\bin location) which is used by many Java developers to find the different member variables and methods for any Java object. Syntax javap options classes classes - single or multiple classes Options there are command line options to control configurations. Options Description -help command line usage information -v version information...


Top 10 JDBC Interview Questions

December 4, 2011 ·  1 min read

1.what are different frequent JDBC classes or interfaces used in java code? Connection,DriverManager,ResultSet,Statement,PreparedStatement,CallableStatement. . 2.How do you load the JDBC driver class?. Class.forName(“DriverClass”) is used load the driver class. whenever DriverClass is loaded with this, create a new instance of DriverClass and register the driver with DriverManager Class. Once Driver is registered, it is ready to create physical connections to a database using the Connection object. 3. What is connection pooling?...


Statement,PreparedStatement and CallableStatement

December 4, 2011 ·  2 min read

In JDBC, There are different statements to execute the sql queries in databases. We can send the simple SQL,complex SQL and PL/SQL queries using this statements There are three types of Statements. The following statements are returned from the connection object.before creating any statement object, connection should be presented. The connection object can be returned from the following lines of code Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con= DriverManager.getConnection("jdbc:odbc:orc", "scott", "tiger"); ```**1.Statement :-** This is simple Statement to execute SQL queries like insert,update and delete operations....


Convert of String to Integer or Integer to String in java

December 4, 2011 ·  2 min read

As a developer, in the day to day programming, we have encountered in a number of situations to convert from String to Integer or vice verse. String object holds a sequence of characters Integer object stores the numeric values. The string should hold valid int value. if an invalid numeric value is presented in the string, then NumberFormatException is thrown. For this, you have to handle using try and catch blocks....


Jdbc Basic Example to connect to database in java

December 4, 2011 ·  2 min read

Following steps for writing a sample java program to connect to the database and get the result. JDBC API is provided by sun framework which contains different interfaces and classes to connect to databases. The below diagram depicts the steps to connect to any database. import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; public class ConnDemo { public static void main(String args[]) throws Exception { // establish connection to database this includes loading driver // and fetching data....


Learn Basics of Inside Java Virtual Machine?

December 4, 2011 ·  3 min read

As you know in any machine, we have different components like a hardware (physical machine call it as hardware(CPU, RAM.. etc) and software (Operating System). if you want to perform any operation from another machine, we need to write some code (say in c language) which will open a socket connection, that is a remote network call to other machine and make an OS call i.e native call. Each machine should have different ways to handle this situation....


java Collections overview

December 3, 2011 ·  1 min read

java.util.Collection Collections are data structures are used to represents a group of elements stored under a single name. Different operations like searching, sorting, insert, delete and filter operations will be performed on collection classes Java provides several classes and interfaces to deal with collections Java collections are defined in java. util package java.util.Collection and java.util.map interfaces are root interfaces which all collection classes are extending either one of the interfaces....


Front Controller Design pattern in java/jsp applications

December 3, 2011 ·  1 min read

Front Controller is one of the most important design pattern mostly used in web applications. The problem:- As you know in a web application, whenever clients send the request to the server, the server process the request, if possible make a database call, get the data from the Database or other third party systems and process the data, and send the response. Here there is different components involved, business data validation, holding the database data(model) and view process....


Fix for Common exceptions in java language

December 3, 2011 ·  3 min read

Java Exception Handling Exception handling is a very important part of Java application development. It helps to make application stable and error free. When application results error, java handles using exception classes. The Exception can be handled using try/catch/finally blocks. During development, Developers used to encounter different type exceptions frequently. This post is about listing out the list of common exceptions, and solutions for fixing them. Following are the exceptions in java programming language....


Sorting List of Numbers

December 3, 2011 ·  1 min read

In a java programming, Let us say We have a set of numbers say 100,200,4,5,79,26. In java, we can use either Array or List implementation(ArrayList or LinkedList in java.util package used to sort numbers . import java.util.Arrays; import java.util.Collections; import java.util.List; public class SortDemo { public static void main(String args[]){ Integer[] numbs=new Integer[]{100,200,4,5,79,26}; System.out.println("Initial List="+numbs); /*For sorting numbers we can use Arrays's sort method*/ Arrays.sort(numbs); Integer[] numbs1=new Integer[]{100,200,4,5,79,26,20}; /*For sorting numbers we can also use List's sort method*/ List listNumbers=Arrays....


Data transfer object or Value Object Design Pattern

December 1, 2011 ·  2 min read

DTO stands for Data transfer object or Value Object (VO) design pattern is a one of the design pattern used for transferring the data between one different machine. The problem:- In most of the java projects, we have to retrieve the data from the database. In a system, you are queried (select employee id, employee name from employee) in the databases from your application. Here application is either a web application or standalone application (applet or Eclipse RCP client)....


setup tomcat server on desktop

November 23, 2011 ·  1 min read

Tomcat Application Server Tomcat is an open source application server built on a java framework. It is used for web application deployment on this server. On this blog post, We will cover the installation of Tomcat 9 on windows10 and Linux. Tomcat 9 supports Servlet4 and Jsp 2.3. Tomcat runs applications running HTTP protocol over TCP/IP protocol. The default port for tomcat installation is 80. Tomcat Latest version 9.0.x supports following Specifications Servlet 4....


Find last Element/Object of ArrayList in java

November 22, 2011 ·  1 min read

get the Last Element of List  Most of the times we encountered the situation to read the first element of ArrayList using get(0) method. Some instances you want to read the last element of an array List, you can use the following code snippet. `ArrayList list=new ArrayList(); list.add("one"); list.add("two"); list.add("three"); list.add("four"); ` To Access the fourth object, we have to use list.get(list.size()-1). Here size() method returns the size of the list and size -1 return the last index of the list....


Pros and Cons of Design patterns

November 18, 2011 ·  1 min read

In Software development, reusable code to solve the frequent problems occurred in the designation of any system In OOPS programming, we have several design patterns the following are the Popular design patterns There are different categories types of design patterns in object-oriented programming 1. Creation patterns:- This type of patterns are used to describe the object creation in the best possible ways in different contexts. Singleton is the example 2.Structural design patterns:- 3....


Singleton Design pattern

November 18, 2011 ·  2 min read

Singleton design pattern It is one of the design patterns to maintain the single instance of an object in a system. whenever object created using the new Object() code, one new instance created, if we call these, multiple instances are created in heap memory. Over the time the calls to the new objects grow, the size of the object size grows in the heap memory and it will cause performance overhead....


How to avoid ConcurrentModificationException for map or List

November 11, 2011 ·  1 min read

ConcurrentModificationException exception is occurred because of while one thread is iterating the collections and other thread trying to modify the object in collections. This will be happened for below map and list of collections. 1. Modifying state of any key or value in map implementations(example,HashMap,HashTable,LinkedHashMap) during iteration of Map objects 2.Adding/remove(Iterator.remove) the object in a collections class while iteration of collection of objects at the same time. you can use ConcurrentHashMap for avoiding this exception but there is no guarantee of all your objects are iterated....


Code Names for java releases

June 7, 2010 ·  1 min read

This is my first post for this blog. i am going to post Code Names for different java releases,hope the people don’t confuse with calling code name’s VERSION CODE NAME JDK 1.1.4 Sparkler JDK 1.1.5 umpkin JDK 1.1.6 Abigail JDK 1.1.7 Brutus JDK 1.1.8 Chelsea J2SE 1.2 Playground J2SE 1.2.1 (none) J2SE 1.2.2 Cricket J2SE 1.3 Kestrel J2SE 1.3.1 Ladybird J2SE 1.4.0 Merlin J2SE 1.4.1 Hopper J2SE 1.4.2 Mantis J2SE 5....


Java Code Names

June 7, 2010 ·  1 min read

Hi This is my first post, i am going to post the code names for different java releases, Hope the people don’t confuse with the code names. VERSION CODE NAME JDK 1.1.4 SparklerJDK 1.1.5 PumpkinJDK 1.1.6 AbigailJDK 1.1.7 BrutusJDK 1.1.8 ChelseaJ2SE 1.2 PlaygroundJ2SE 1.2.1 (none)J2SE 1.2.2 CricketJ2SE 1.3 KestrelJ2SE 1.3.1 LadybirdJ2SE 1.4.0 MerlinJ2SE 1.4.1 HopperJ2SE 1.4. 2 MantisJ2SE 5.0 (1.5.0) TigerJava SE 6 MustangJava SE 7 Dolphin...