WT Practical File Final
WT Practical File Final
<html>
<head>
</head>
<body>
<table border="1">
<tr><th>First_Name</th><th>Last_Name</th><th>Marks</th></tr>
<tr><td>Amit</td><td>Yadav</td><td>85</td></tr>
<tr><td>pradeep</td><td>singh</td><td>80</td></tr>
<tr><td>hemant</td><td>tiwari</td><td>82</td></tr>
<tr><td>vinay</td><td>sharma</td><td>72</td></tr>
</table>
</body>
</html>
Output-
<form action="#">
<table>
<tr>
</tr>
<tr>
</tr>
<tr>
<td class="tdLabel"><label for="register_email" class="label">Enter Email:</label></td>
<td
</tr>
<tr>
<td>
<label for="register_gendermale">male</label>
<label for="register_genderfemale">female</label>
</td>
</tr>
<tr>
<option value="india">india</option>
<option value="pakistan">pakistan</option>
<option value="africa">africa</option>
<option value="china">china</option>
<option value="other">other</option>
</select>
</td>
</tr>
<tr>
<td colspan="2"><div align="right"><input type="submit" id="register_0" value="register"/>
</div></td>
</tr>
</table>
</form>
Output
Exp 3 JavaScript example
<html>
<head>
<title>Variables!!!</title>
<script type="text/javascript">
var two = 3;
document.write("First No: = " + one + "<br />Second No: = " + two + " <br />");
</script>
</head>
<body>
</body>
</html>
Output-
HTML Code
<html>
<head>
<script src="js/login.js"></script>
</head>
<body>
<div class="container">
<div class="main">
<label>Password :</label></br>
</form>
</div>
</div>
</body>
</html>
Login.js
function validate(){
return false;
else{
document.getElementById("username").disabled = true;
document.getElementById("password").disabled = true;
document.getElementById("submit").disabled = true;
return false;
}
Output
Write programs using Java script for Web Page to
Exp5
<html>
<head>
<title>Browser Information</title>
</head>
<body>
<h1>Browser Information</h1>
<hr>
<p>
The <b>navigator</b> object contains the following information
about the browser you are using.
</p>
<ul>
<script LANGUAGE="JavaScript" type="text/javascript">
document.write("<li><b>Code Name:</b> " +
navigator.appCodeName);
document.write("<li><b>App Name:</b> " +
navigator.appName);
document.write("<li><b>App Version:</b> " +
navigator.appVersion);
document.write("<li><b>User Agent:</b> " +
navigator.userAgent);
document.write("<li><b>Language:</b> " +
navigator.language);
document.write("<li><b>Platform:</b> " + navigator.platform);
</script>
</ul>
<hr>
</body>
</html>
Output-
Rectangle
• import java.applet.Applet;
• import java.awt.*;
• public class GraphicsDemo extends Applet{
• public void paint(Graphics g){
• g.setColor(Color.red);
• g.drawString("Welcome",50, 50);
• g.drawLine(20,30,20,300);
• g.drawRect(70,100,30,30);
• g.fillRect(170,100,30,30);
• g.drawOval(70,200,30,30);
• g.setColor(Color.pink);
• g.fillOval(170,200,30,30);
• g.drawArc(90,150,30,30,30,270);
• g.fillArc(270,150,30,30,0,180);
• } }
/*
<applet code="GraphicsDemo.class" width="300"
height="300">
</applet>
*/
Output-
class SimpleArray
array[count]=count+1;
System.out.println("array["+count+"] = "+array[count]);
Output-SimpleArray.java
Exp 8 WAP in java for try-catch block.
Program- try-catch
try{
for(int i=5;i>=0;i--){
System.out.println(10/i);
} catch(Exception ex){
ex.printStackTrace();
}}
Output-
Exp 9 WAP in java for create simple Thread using extends keyword.
Program-
//create thread
}}
class ThreadEx1 {
t.start();
}}
Output-
Exp 10 WAP in java for creating Simple interface.
Program-amimal.java
interface Animal
//MammalInt.java
System.out.println("Mammal eats");
System.out.println("Mammal travels");
}
return 0;
m.eat();
m.travel();}}
Output-
Program-
interface Printable
{
void print();
interface showable
void show();
System.out.println("Hello");
System.out.println("welcome");
AA obj=new AA();
obj.print();
obj.show();
}
Output-
Program-
import java.io.*;
try{
System.out.print((char)bin.read());
}}
catch(FileNotFoundException e)
catch(IOException ioe)
Finally{
try{
if(bin != null)
bin.close();
}catch(IOException ioe)
}}}}
Output-
Program-
// MyClient.java
import java.io.*;
import java.net.*;
try{
dout.flush();
dout.close();
s.close();
}catch(Exception e){System.out.println(e);}
}}
// MyServer.java
import java.io.*;
import java.net.*;
try{
String str=(String)dis.readUTF();
System.out.println("message= "+str);
ss.close();
}catch(Exception e){System.out.println(e);}
}}
Output-
Program-
import java.io.*;
import java.net.*;
try{
InetAddress ip=InetAddress.getByName("www.fmcarbscollege.in");
}catch(Exception e){System.out.println(e);}
}}
Output-
• //save as Simple.java
• package mypack;
• System.out.println("Welcome to package");
• }
• }
• javac -d . Simple.java
import java.sql.*;
class OracleCon
try
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","hr","hr");
Statement stmt=con.createStatement();
while(rs.next())
con.close();
catch(Exception e)
{
System.out.println(e);
Output-