Convert Java Collection / List / String[] Array Into JSON
![Convert Java Collection / List / String[] Array Into JSON Convert Java Collection / List / String[] Array Into JSON](/static/images/java.png)
In this example, we are going to convert a Java collection/list/string[] array into appropriate JSON String using GSON library
Calculate Area / Circumference Of Circle Using Java Math.PI

In this example, we are going to explain the usage of Java Math.PI to calculate area / circumference of circle
On below example, we are using Math.PI for finding the area / circumference of circle.
Formula to find the Area/Circumference are below Area = radius*radius*PI Circumference = PI*radius*2
Read File Using Java Scanner Class

Read File Using Java Scanner Class explains about the usage of Java Scanner class API.
while (scnr.hasNextLine()) { String line = scnr.nextLine(); System.out.println( lineNum + " : " + line); lineNum++; }
On above code, we are using java.util.Scanner class methods, method scanner.nextLine() is used for reading whole content line by line
Another important method of Scanner class is useDelimiter(), which allows you to change the delimiter accordingly.
Get / Find Package Name Of Java Class

In this tutorial, we are find / get the package name of a Java class by providing the class name using java API.
Package packs = str.getClass().getPackage();
On above code we are using object.getClass().getPackage() method for getting the package name.
How To view Content Of H2 In-memory & File Database

In this tutorial, we are discussing about the usage of H2 Console Application. This console application is available with h2 package.
We can see / browse the contents in H2 Database in a browser, by using this handy tool
View the content of H2 Database
H2 Console application helps you to view the database contents using a browser, whether it is a In-Memory database or a File based database. It is also possible to view the contents of other database, if it is according to JDBC standards.
We need to start both client / server inorder to view the contents of database through browser.
Reference -> http://www.h2database.com/html/main.html
H2 Database Connection Pool Example

In this H2 Database Connection Pool Example explains about the implementation of connection pool using H2 Database
H2 is an open source software implementation of Java SQL database. The main features of H2 are.
- Very fast, open source, JDBC API
- Embedded and server modes; in-memory databases
- Browser based Console application
- Small footprint: around 1.5 MB jar file size
Reference -> http://www.h2database.com/html/main.html
H2 In-Memory Database Example

In this H2 In-Memory Database Example, we are going to store the database contents on In-Memory of the system. Here persistence happens on Memory of the system. In this example we are creating a java class that shows how to load the driver, create a database, create table and insert some values into table
H2 is an open source software implementation of Java SQL database. The main features of H2 are.
- Very fast, open source, JDBC API
- Embedded and server modes; in-memory databases
- Browser based Console application
- Small footprint: around 1.5 MB jar file size
Reference -> http://www.h2database.com/html/main.html
H2 File Database Example

In this H2 File Database Example, we are going to store the data in file system. Here persistence happens on file system. In this example we are creating a java class that shows how to load the driver, create a database, create table and insert some values into table
H2 is an open source software implementation of Java SQL database. The main features of H2 are.
- Very fast, open source, JDBC API
- Embedded and server modes; in-memory databases
- Browser based Console application
- Small footprint: around 1.5 MB jar file size
Reference -> http://www.h2database.com/html/main.html