Java program to check Palindrome Number.
/*This program shows how to check for in the given list of numberswhether each number is palindrome or not*/public class JavaPalindromeNumberExample { public...
Java program to calculate the Simple Interest and Input by the user.
import java.util.*; class SimpleInterest { int p, t; float si, r; public si() { r = 0; p = 0; } public...
Java program to find out the HCF and LCF.
import java.util.*; class Hcf { public static void main(String args[]) { int a, b; Scanner sc = new Scanner(System.in); System.out.println("Enter...
Java program to test the Prime number.
import java.util.*; class Prime { public static void main(String args[]) { int flag, x, i; flag = 0; int a[] =...
Java program to Demonstrate Type Casting.
class Typecast { public static void main(String args[]) { byte h = 127; int a = 300; float a1 = 12.222 f; float...
Find the average, sum, min and max of the N numbers Using user Input in Java.
import java.util.*; class Average { public static void main(String args[]) { Scanner sc = new Scanner(System.in); // to take user input...
Write a servlet which accepts product details from html form and stores the product details into database?
Product database: create table Product ( pid number (4), pname varchar2 (15), price number (6, 2) ); web.xml: <web-app> <servlet> <servlet-name>abc</servlet-name> <servlet-class>DatabaServ</servlet-class> </servlet>...
Write a servlet which accepts client request and display the client requested data on the browser?
import javax.servlet.*;import javax.servlet.http.*;import java.io.*;public class DataServ extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/html"); PrintWriter pw =...
Spring Based interview Questions
1. Explain DI or IOC pattern. Dependency injection (DI) is a programming design pattern and architectural model, sometimes also referred to as inversion...
Write a servlet which illustrate the concept of ServletContext?
web.xml:<web-app><context-param><param-name>v1</param-name><param-value>10</param-value></context-param><context-param><param-name>v2</param-name><param-value>20</param-value></context-param><servlet><servlet-name>abc</servlet-name><servlet-class>Serv1</servlet-class><init-param><param-name>v3</param-name><param-value>30</param-value></init-param></servlet><servlet><servlet-name>pqr</servlet-name><servlet-class>Serv2</servlet-class><init-param><param-name>v4</param-name><param-value>40</param-value></init-param></servlet><servlet-mapping><servlet-name>abc</servlet-name><url-pattern>/firstserv</url-pattern></servlet-mapping><servlet-mapping><servlet-name>pqr</servlet-name><url-pattern>/secondserv</url-pattern></servlet-mapping></web-app>Serv1.java:import javax.servlet.*;import javax.servlet.http.*;import java.io.*;public class Serv1 extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/html"); PrintWriter pw =...