In this article we will learn how to use optional in java 8 streams. Optional is a container object which may or may not contain null value. Some of the most important methods in Optional’s are . So now lets look into the code on how to use optional in Java 8 stream. In this… Continue reading
Posts in "Code Base"
Java Date format
Here i will provide list of Java Date formats that are used in Java frequently. There are different ways you can achieve the same result in Java. 1- Using Predefined Format You can directly use DateFormat class to format date in predefined style. DateFormat has predefined 4 styles which can be used for quick formatting… Continue reading
Generate random number in java
Here you will learn to generate random number in java between two given number by different means. I will try to provide cons for different mechanism so that you can choose what is best for you.
Java write to file
There are n number of ways to achieve this.
Java String Split
In java you might face a situation where you need to split String, based on some criteria. To fulfill this requirement Java has already provided two in-built methods to achieve this.
Calculate difference between two dates in java
In this topic we will learn how to calculate difference between two dates in java in terms of Second/ Minutes / Hours / Days. By Using java class. In next section we will use Java api(JODA) to perform the same activity.
Create web application in eclipse using Servlets and JSP
Here we will learn to create web application in Eclipse using Servlets and JSP.
How to Create Table in Oracle Using statement in Java
import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; import java.util.Scanner; /* * Here we will learn to Create Table in DB using JDBC Statements in Oracle and MySQL DB */ public class CreateTableWithStatement { public static void main(String[] args) { String tableCreateQuery = "create table JBT(name varchar2(10), course varchar2(10))"; Statement statement = null; Connection connection… Continue reading
How to connect to oracle database in java using eclipse
Here we will learn to connect to MYSQL DB via Java.
How to connect to mysql database in java
Here we will learn to connect to MYSQL DB via Java. import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Scanner; /* * Here we will learn to connect to Oracle DB using JDBC Driver. */ public class ConnectMySQLDB { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out .println("Please provide below details to… Continue reading