How to Convert JSON to XML or XML to JSON in Java

In this tutorial you will learn how to convert json to xml or xml to json in java. While programming we may come across a situation where we have to convert json to xml or vice versa. JSON.org provides a library that can be used for this conversion process in just one line of code. Below I have shared examples to do this. Download the json java library from below link and import in your project. Link: https://mvnrepository.com/artifact/org.json/json If you don’t

Read more

4 Ways to Reverse String in Java

In this tutorial you will learn about different ways to reverse string in java with examples.   For example: Input: Hello World Output: dlroW olleH Ways to Reverse String in Java Method 1: This is the simplest method in which we iterator through given string from end character by character and append to new empty string.

  Output Original String: I love programming Reversed String: gnimmargorp evol I   Method 2: It is also an iterative method in which

Read more

2 Ways to Convert String to Character Array in Java

Here you will learn about different ways to convert string to character array in java. 1. Using String.toCharArray() Method We can easily convert string to character array using String.toCharArray() method. It can be done in following way.

  Output I   L o v e   J a v a    2. Writing Own Logic We can also writing our own logic. Each character of string is extracted using String.charAt() method and inserted into the character array.

  Please

Read more

4 Ways to Check String is Anagram in Java

In this tutorial I will tell you the four different ways to check string is anagram in Java or not. Two strings are anagram if they contains same characters in different order. For example word and odwr are anagrams.     Ways to Check String is Anagram in Java Method 1 In this method we sort the strings using Arrays.sort() method and then compare them using Arrays.equals() method. If strings are equal then they are anagram.

  Output Enter first

Read more

Heap Sort in Java

Here you will get program for heap sort in java. Heap sort is a sorting algorithm that uses heap data structure. Its best, worst and average time complexity is O (n log n).   How heap sort algorithm works? First we make max heap from given set of elements. In max heap each parent node is greater than or equal to its left and right child. Now first node is swapped by last node and size of heap is reduced by 1.

Read more

Java Web Services Tutorial

Here in this java web services tutorial you will learn about various concepts of web services and how to create web services in java.   What is Web Service? Web Services are used for communication and exchanging information between applications. In simple words, a service that is available on internet and can be invoked by client using some web protocols is called web service. Why we need Web Services? Let’s take one real life example to understand this. Suppose there

Read more

Solve java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver Error

In this tutorial you will learn to solve java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver error. If you are using jdk 1.8 and trying to connect java with MS Access database then you will get error java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver. This is because java 8 or jdk 1.8 does not support jdbc odbc bridge. To connect with ms access you have to import some libraries. How to Solve java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver Error? 1. Download jars from below link and import in the ide you are using. Link: http://www.mediafire.com/download/ahzw21rrp20qiw8/ucanaccess.rar   Also Read: How

Read more

How to Connect Java (JDBC) with MS Access Database

In this tutorial I will teach you how to connect java (jdbc) with ms access database. MS Access is a part of Microsoft Office and used as database management system (dbms). For making a new database go to MS Access > Blank Database. Give a name to database and click on Create button to create the database. Also Read: How to Connect Java (JDBC) with MySQL or Oracle Database Below example shows jdbc ms access database connectivity. How to Connect Java

Read more
1 7 8 9 10 11 12