Greetings java Diploma and Engineering project

Greetings java Diploma and Engineering project

< —————-Greetings.java ———————- >

 

importjavax.servlet.*;

importjavax.servlet.http.*;

importjava.util.*;

import java.io.*;

public class Greetings extends HttpServlet

{

public void doGet(HttpServletRequest r, HttpServletResponserp) throws IOException

{

String[] greetings={“gm”,”gn”,”ga”,”bye”,”hi”};

PrintWriter out=rp.getWriter();

 Random no= new Random();

out.println(“<html><head><title>Greetings</title></head><body>”);

out.println(greetings[no.nextInt(greetings.length)]);

out.println(“</body></html>”);

}

}

 

 

 

 

 

                                  

 

OUT PUT

 

User Greeting:-1

Good After Noon

 

User  Greeting:-2

Hai Girls

 

User Greeting:-3

Good Night

 

User Greeting:-4

Good Morning

 

User Greeting:-5

Bye Girls

296 total views, 1 views today

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by wp-copyrightpro.com