التخطي إلى المحتوى الرئيسي

المشاركات

عرض المشاركات من يوليو, 2021

Job alert for Java, Python, PHP, Angular and NET Profile

 Job alert for Java, Python, PHP, Angular, and NET Profile:-                              

Lambda Expression In Java, What is forEach() in java

 Lambda Expression In Java:- .................................................................................................................................................................. What is a lambda expression? It is a new feature of Java 8 that is used to define the method in a concise pattern. Lambda function uses an anonymous method to block to define functionality. if we want to implement the features under the method of interface or abstract class then we can use a lambda expression. Syntax of a lambda expression? ()->{ Expression } 1) Example of Lambda Expression without return type method package com.scs; interface A {     public void fun(); } interface B {     public  int fun1(); } public class LamdaExpression {     public static void main(String[] args) {         A obj = () -> {                 System.out.println("Lambda Expression A");        ...

Spring MVC With Hibernate Example, Database connectivity in Spring MVC + Hibernate + MYSQL

Step1s:- Create Database and Table. database name hiberdb and tablename employee(empid,empname,jo) Step2nd:- Create hibernate.cfg.xml:- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="connection.url">jdbc:mysql://localhost:3306/hiberdb</property> <property name="connection.username">root</property> <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <mapping class="com.scs.dao.Emp"></mapping> </session-factory> </hibernate-configuration> Step3rd:- Create POJO or BEAN Class under package com.scs.dao packag...

How to use HashTable in Spring MVC Web Application

  Code of  Controller Class:- package bao; import java.util.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @Controller public class AdditionExample { @RequestMapping("/add") public String loadForm() { return "add"; } @RequestMapping("/addlogic") public ModelAndView addLogic(HttpServletRequest request, HttpServletResponse response) { int a = Integer.parseInt(request.getParameter("txtnum1")); int b = Integer.parseInt(request.getParameter("txtnum2")); Hashtable<String, Integer> ht = new Hashtable<>(); ht.put("num1",a); ht.put("num2",b); Set<Map.Entry<String,Integer>> se = ht.entrySet(); int sum=0; for(Map.Entry<String, Integer> me:se) {...