Skip to main content

Posts

Showing posts from October, 2021

working with auto increment of mysql in JDBC

 working with auto increment of mysql in JDBC For explanation Watch video :: code:: import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; public class AutoIncrementEx { private static final String query = "insert into emp2(ename,eadd) values(?,?)"; public static void main(String[] args) { try(Connection con = DriverManager.getConnection("jdbc:mysql:///new","root","root"); PreparedStatement ps = con.prepareStatement(query);){ ps.setString(1, "raja"); ps.setString(2, "nagpur"); int count = ps.executeUpdate(); if(count!=0) { System.out.println("Record Inserted"); }else { System.out.println("Record Not Inserted"); } }catch(SQLException se) { se.printStackTrace(); }catch(Exception e) { e.printStackTrace(); } } }

Weather Observation Station 2 Hackerrank Solution - SQL

 Weather Observation Station 2 Hackerrank Solution - SQL For Explanation watch video::: Code:: select round(sum(LAT_N),2),round(sum(LONG_W),2) from station;

Modified Kaprekar Numbers Hackerrank Solution - java

 Modified Kaprekar Numbers Hackerrank Solution - java For explanation watch video : Code:: import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.function.*; import java.util.regex.*; import java.util.stream.*; import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toList; class Result {     /*      * Complete the 'kaprekarNumbers' function below.      *      * The function accepts following parameters:      *  1. INTEGER p      *  2. INTEGER q      */     public static void kaprekarNumbers(int p, int q) {         ArrayList<Long> al = new ArrayList<>();         for(long i=p;i<=q;i++){             long sq = i*i;           ...

Servlet Project : User Management Project

  Servlet Project : User Management Project For Explanation Watch video:: Note :: In this Project you must configure web server (for example tomcat) with eclipse ide Download Bootstrap  from ::         https://getbootstrap.com/docs/4.3/getting-started/download/ Download mysql jar file from :: https://mvnrepository.com/artifact/mysql/mysql-connector-java/8.0.22 adding MySQL Connector/J jar file in eclipse ide for jdbc video :: video link : https://youtu.be/4Fyd-k3eG_I Directory Structure in eclipse web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" id="WebApp_ID" version="4.0">    <welcome-file-list>     <welcome-file>home.html</welcome-file>   </welcome-file-list>   <displa...

Servlet Project Book Shop Application in eclipse

 Servlet Project Book Shop Application in eclipse  For explanation watch video::: Note :: In this Project you must configure web server (for example tomcat) with eclipse ide Download Bootstrap  from ::         https://getbootstrap.com/docs/4.3/getting-started/download/ Download mysql jar file from :: https://mvnrepository.com/artifact/mysql/mysql-connector-java/8.0.22 adding MySQL Connector/J jar file in eclipse ide for jdbc video :: video link : https://youtu.be/4Fyd-k3eG_I Directory Structure:: web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" id="WebApp_ID" version="4.0">   <welcome-file-list>     <welcome-file>home.html</welcome-file>   </welcome-file-list>   <display-...

equalize the array hackerrank solution in java

 equalize the array hackerrank solution in java for explanation watch video :: code:: import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.function.*; import java.util.regex.*; import java.util.stream.*; import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toList; class Result {     /*      * Complete the 'equalizeArray' function below.      *      * The function is expected to return an INTEGER.      * The function accepts INTEGER_ARRAY arr as parameter.      */     public static int equalizeArray(List<Integer> arr) {                 HashMap<Integer,Integer> hm = new HashMap<>();         for(int i=0;i<arr.size();i++){             hm.put(arr.get...

Library Fine Hackerrank Solution - java

 Library Fine Hackerrank Solution - java for explanation watch video : code: import  java.io.*; import  java.math.*; import  java.security.*; import  java.text.*; import  java.util.*; import  java.util.concurrent.*; import  java.util.function.*; import  java.util.regex.*; import  java.util.stream.*; import   static  java.util.stream.Collectors.joining; import   static  java.util.stream.Collectors.toList; class  Result {      /*      * Complete the 'libraryFine' function below.      *      * The function is expected to return an INTEGER.      * The function accepts following parameters:      *  1. INTEGER d1      *  2. ...

Sequence Equation Hackerrank Solution - java

 Sequence Equation Hackerrank Solution - java  for explanation watch video :: code:: import  java.io.*; import  java.math.*; import  java.security.*; import  java.text.*; import  java.util.*; import  java.util.concurrent.*; import  java.util.function.*; import  java.util.regex.*; import  java.util.stream.*; import   static  java.util.stream.Collectors.joining; import   static  java.util.stream.Collectors.toList; class  Result {      /*      * Complete the 'permutationEquation' function below.      *      * The function is expected to return an INTEGER_ARRAY.      * The function accepts INTEGER_ARRAY p as parameter.      */      public   s...

Chocolate Feast Hackerrank Solution - java

Chocolate Feast Hackerrank Solution - java for explanation watch video : code: import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.function.*; import java.util.regex.*; import java.util.stream.*; import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toList; class Result {     /*      * Complete the 'chocolateFeast' function below.      *      * The function is expected to return an INTEGER.      * The function accepts following parameters:      *  1. INTEGER n      *  2. INTEGER c      *  3. INTEGER m      */     public static int chocolateFeast(int n, int c, int m) {         //no of  chocolate          int num = n/c;         int w...