Java Reference
In-Depth Information
value. The executeQuery method returns a ResultSet object that contains the
rows matching a query.
12. CREATE TABLE BooksAuthors (ISBN varchar(15), author_id int)
13. INSERT INTO BooksAuthors VALUES('0-553-38095-8',3)
INSERT INTO BooksAuthors VALUES('0-553-57294-6',2)
INSERT INTO BooksAuthors VALUES('0-671-46149-4',1)
INSERT INTO BooksAuthors VALUES('0-553-57928-9',2)
14. A java applet is downloaded and executed on the client, while a JSP program is
written alongside HTML and runs on the server.
15. <html>
<head>
<title>Submit Firstname</title>
</head>
<body>
<form ACTION = "ProcessName.jsp" METHOD = POST>
First Name:
<input TYPE = "TEXT" NAME = "FirstName" VALUE = "" MAXLENGTH = "50">
<input TYPE="SUBMIT" VALUE="Submit">
</form>
</body>
</html>
16. <% %> is a scriptlet, <%@ %> is a directive, <%! %> is a declaration, <%= %> is an
expression.
17. <%
String firstName = request.getParameter("FirstName");
out.println("<h1><b>" + firstName + "</b></h1>");
%>
Programming Projects
Visit www.myprogramminglab.com to complete select exercises online and get instant
feedback.
1. Write a GUI program that uses the methods in the Graphics class together with
threads to draw a smiley face, wait two seconds, draw a frowny face, wait two sec-
onds, and repeat starting with the smiley face. A separate thread should be started
to implement the two-second timer. The application should be responsive and exit
immediately if the user decides to close the window.
2. Create a class named TimerAlarm that extends Thread and implements a timer.
Do not use the built-in Timer class for this exercise. Your class constructor should
take as input an integer named t representing time in milliseconds and an interface
object named obj that defines a method named alarmAction( ) . You will need
to define this interface. Every t milliseconds the class should invoke method obj.
alarmAction( ) . Add pause( ) and play( ) methods that disable and enable
 
Search WWH ::




Custom Search