Write a Socket program in java in which client accept a number, send it to the server, server calculates its factorial and sends result to the client.

factclient.java import java.io.*; import java.net.*; class factclient{ public static void main(String argv[]) throws Exception { String n; DatagramSocket clientSocket = new DatagramSocket(); byte []send=new byte[102]; byte []resive=new byte[102]; BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in)); ...

Write a Socket program in java for chatting application. (Use AWT)

ClientChatForm.java import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.print.PrinterException; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.net.InetAddress; import java.net.Socket; import java.net.UnknownHostException; import...

Create a JSP page to accept a number from an user and display it in words: Example: 123 – One Two Three. The output should be in red color.

NumberWord.html <html> <body> <form method="get" action="NumberWord.jsp"> <fieldset> <legend>Enter Any Number </legend> <input type=text name=num><br><br> </fieldset> <div align=center> <input type="submit" value="Display"> </div> </form> <body> </html> NumberWord.jsp <html> <body> <font...

Write a JSP script to check whether given mail ID is valid or not. (Mail ID should contain one @ symbol and atleast one Dot(.) symbol)

Email.html <html> <body> <form name=f1 action="EmailCheck.jsp"> <fieldset> <legend>Enter Email Id...!!!</legend> Enter Email Id:<input type="text" name="t1" > </fieldset> <div align=center> <input type="submit" name="Submit" value="Submit"> </div> </form> </body> </html> Emailcheck.jsp <html> <body> <%@...

Write a JSP script to accept the details of Student (RNo, SName, Gender, Computer_ Knowledge , Class) and display it on the browser. Use appropriate controls for accepting data.

student.html <html> <body> <form method=get action="Student.jsp"> <fieldset> <legend>Enter Student Details...!!!</legend> Enter Roll No :&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp <input type=text name=rno><br><br> Enter Student Name:&nbsp <input type=text name=sname><br><br> Enter Gender: &nbsp...

Write a JSP script to accept username, store it into the session, compare it with password in another jsp file, if username matches with password then display appropriate message in html file.

index.html <html> <head> <title>Login Page</title> </head> <body> <form action="checkdetails.jsp"> <fieldset> <legend>Enter User Id and Password...!!!</legend> UserId:&nbsp &nbsp &nbsp <input type="text" name="id" /> <br><br> Password: <input type="text" name="pass" /> <br><br> </fieldset> <div...

Write a SERVLET program in java to accept details of student (SeatNo, Stud_Name, Class, Total_Marks). Calculate percentage and grade obtained and display details on page.

Student.html <html> <body> <form name="f1" method="Post" action="http://localhost:8080/Servlet/Student"> <fieldset> <legend><b><i>Enter Student Details :</i><b></legend> Enter Roll No :&nbsp <input type="text" name="txtsno"><br><br> Enter Name :&nbsp &nbsp <input type="text" name="txtnm"><br><br> Enter...

Write a SERVLET program that provides information about a HTTP request from a client, such as IP address and browser type. The servlet also provides information about the server on which the servlet is running, such as the operating system type, and the names of currently loaded servlets.

serverInfo.java import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class serverInfo extends HttpServlet implements Servlet { protected void doGet(HttpServletRequest req,HttpServletResponse res)throws IOException,ServletException { res.setContentType("text/html"); PrintWriter pw=res.getWriter(); pw.println("<html><body><h2>Information...

Write a SERVLET program which counts how many times a user has visited a web page. If user is visiting the page for the first time, display a welcome message. If the user is revisiting the page, display the number of times visited. (Use Cookie)

VisitServlet.java import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class VisitServlet extends HttpServlet { static int i=1; public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException { response.setContentType("text/html"); PrintWriter out=response.getWriter(); ...

Write a Multithreading program in java to convert smile face into the crying face after 5 seconds and vice versa(Use Applet).

/*<applet code= "smileface.class" height="300" width="300"></applet>*/import java.awt.*; import java.applet.*; public class smileface extends Applet implements Runnable { int aflag; Thread t; public void init() { t=new Thread(this); aflag=0; t.start(); } public void run() { try { if (aflag==0) { ...

Write a java program which will display name and priority of current thread. Change name of Thread to MyThread and priority to 2. Display the details of Thread.

public class MainThread { public static void main(String arg[]) { Thread t=Thread.currentThread(); System.out.println("Current Thread:"+t); //Change Name t.setName("My Thread "); System.out.println ("After the name is Changed:"+t); try { for(int i=2;i>0;i--) { System.out.println(i); Thread.sleep(1000); ...

Write a Multithreading program in java to display the number’s between 1 to 100 continuously in a TextField by clicking on button. (use Runnable Interface)

import javax.swing.*; import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class MultiThread extends JFrame implements ActionListener { Container cc; JButton b1,b2; JTextField t1; MultiThread() { setVisible(true); setSize(1024,768); cc=getContentPane(); setLayout(null); t1=new JTextField(500); ...


Write a Multithreading program in java using Runnable interface to move text on the frame as follow

import java.awt.*; import java.awt.event.*; class MoveText extends Frame implements Runnable { Label l1; Thread t; int x,y,side; public MoveText() { setLayout(null); l1=new Label("Sachin "); l1.setFont(new Font("",Font.BOLD,14)); l1.setForeground(Color.red); setSize(400,400); setVisible(true); t=new Thread(this); t.start(); ...


Write a menu driven java program for the following

import java.io.*; import java.sql.*; class Menu { public static void main(String args[]) { DataInputStream din=new DataInputStream(System.in); int rno,k,ch,per; String nm; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection cn=DriverManager.getConnection("jdbc:odbc:BCA"); Statement st=cn.createStatement(); ...