You are on page 1of 5

Name: Saptashwa Banerjee

Roll: 13000318064
Sec: A
Sub: Web Technology
Paper code: OE-EC704A
-------------------------------------------------------------------------------------------------------------------------------
Ans 1 :
<html>
<head>
<h2>Course Registration Form</h2>
</head>
<body >
<form>
<b>Name:</b>&emsp;<input type="text" name="username"><br> <br>
<b>Email:</b>&emsp;<input type="email" name="email"><br> <br>
<b>Password:</b>&emsp;<input type="password" name="pwd"/><br> <br>
<b>Gender:</b>&emsp;<input type="radio" name="gender" value="Male" checkbox/> Male
<input type="radio" name="gender" value="Female" checkbox/> Female <br>
<b>Stream:</b>&emsp;<input type=checkbox name=subject checkbox/>CSE
<input type=checkbox name=subject checkbox/>ECE
<input type=checkbox name=subject checkbox/>IT<br>

<b>Course:</b>&emsp; <select name=cours>


<option>B.Tech </option>
<option>M.Tech </option>
</select><br><br<br>
<br>
<p><b>Address:</b>&emsp;<textarea></textarea></p>
<p>
For any problem <a href="https://www.google.com/">visit</a> feel free to visit here.
</p>
<button type="button">Submit</button>
<button type="button">Reset</button>

</form>
</body>
</html>

OUTPUT:
Ans 2:
If a class has multiple methods having the same name but different in parameters, it is
known as Method Overloading. There are two ways to overload the method in java:
1. By changing number of arguments
2. By changing the data type

class Subtract{

static int sub(int a,int b){return a-b;}

static int sub(int a,int b,int c){return a-b-c;}

}
class TestOverloading{

public static void main(String[] args){

System.out.println(Subtract.sub(9,5));

System.out.println(Subtract.sub(10,5,2));

}}
OUTPUT:
4
3

Ans 3:
class Car{
public Car()
{
System.out.println("Class Car");
}
public void vehicleType()
{
System.out.println("Vehicle Type: Car");
}
}
class Maruti extends Car{
public Maruti()
{
System.out.println("Class Maruti");
}
public void brand()
{
System.out.println("Brand: Maruti");
}
public void speed()
{
System.out.println("Max: 90Kmph");
}
}
public class Maruti800 extends Maruti{

public Maruti800()
{
System.out.println("Maruti Model: 800");
}
public void speed()
{
System.out.println("Max: 80Kmph");
}
public static void main(String args[])
{
Maruti800 obj=new Maruti800();
obj.vehicleType();
obj.brand();
obj.speed();
}
}
OUTPUT:
Class Car
Class Maruti
Maruti Model: 800
Vehicle Type: Car
Brand: Maruti
Max: 70Kmph
Ans 4:
Differentiate between Class and Method with suitable examples.

Class Method

A template for creating objects within a A function that exposes the behaviour of
program an object

Standalone entity Depends on the class

It is a set of properties and behaviors method defines just one behavior of


that must be exhibited by any instance the class
(object) of said class.
Helps to create and substantiate objects Describe functionality of object

Example:
public class Cube {

/*FIELDS - properties of the blueprint class*/


int length;
int breadth;
int height;

/*METHOD - describes the behaviour of the the blueprint class


When the getVolume() method is called, it returns the volume of
the cube that is calculated from the fields.
*/
public int getVolume() {
return (length * breadth * height);
}
}

You might also like