Data types in JSP are listed below with brief in them:
- Byte: This is an 8-bit signed teo’s compliment integer. It has minimum value of -128 and maximum value of 127.
- Short: This data types are 16-bit signed two’s compliment integer. It has a minimum value of -32,768 and maximum value of 32,767.
- Int: it is 32-bit signed two’s compliment integer. It has a minimum value of -2,147,483,648 and a maximum value of 2,147,483,647.
- Long: This data types are 64-bit signed two’s compliment integer. It has a minimum value of -9,223,372,036,854,775,808 and a maximum value of 9,223,372,036,854,775,807.
- Float: It is single-precision 32-bit IEEE 754 floating point. Its ange of values is beyond the scope.
- Double: it is double-precision 64-bit IEEE 754 floating point, Its range of value is beyond the scope.
- Boolean: it has only two possible values either a true or a false.
- Char: it is 16-bit Unicode character. It has minimum value of '\u0000' (or 0) and maximum value of '\uffff' i.e. 65,535.
Example:
JSP File (datatype.jsp)
<!DOCTYPE html>
<html>
<head>
<title>nirajanghimireyworkshop.blogspot.com</title>
<meta charset="UTF-8">
</head>
<body>
<h2>Example of Data Types in JSP</h2>
<%
int a;
float b;
doublec,d;
a=10;b=30; c=b;d=a+c;
out.println("c = "+ c +"<br/>");
out.println("d = " + (int)d);
%>
</body>
</html>
No comments:
Post a Comment