JSP and Operators (Java) โอเปอร์เรเตอร์ หรือ เครื่องหมายดำเนินการ ในการเขียน JSP ด้วยภาษา Java  เป็นการกระทำกับชุดของตัวแปรบนภาษา Java ในรูปแบบต่าง ๆ เพื่อให้ได้ผลลัพธ์ที่ต้องการ และสามารถแยกย่อยออกเป็นหลายส่วน ขึ้นอยู่กับวัตถุประสงค์ของการใช้งาน เช่น การ บวก ลบ คูณ หาร เปรียบเทียบค่า เพิ่ม ลด และอื่น ๆ ซึ่งหลัก ๆ แล้วจะประกอบด้วยดังนี้ 
- เครื่องหมายดำเนินการทางคณิตศาสตร์ (Arithmatic Operator) เช่น + , - , * ,  / , %
 - เครื่องหมายเพิ่มค่าและลดค่า ++ , --
 - เครื่องหมายที่ใช้ในการเปรียบเทียบ (Compare Operator) เช่น < , > , <= , >= , != , ==
 - เครื่องหมายตรรก (Logical Operator) เช่น ! , & , | , ^ , && , || 
 
  
 
Example 
 
index.jsp 
<html>
<head>
	<title>ThaiCreate.Com JSP Tutorial</title>
</head>
<body>
	<%
    // result is now 3
    int result = 1 + 2;
	out.println("<br>"+ result);
    // result is now 2
    result = result - 1;
    out.println("<br>"+ result);
    // result is now 4
    result = result * 2;
    out.println("<br>"+ result);
    // result is now 2
    result = result / 2;
    out.println("<br>"+ result);
    // result is now 10
    result = result + 8;
    // result is now 3
    result = result % 7;
    out.println("<br>"+ result);
	%>
</body>
</html>
 
Output 
 
  
 
 
 
อ่านเพิ่มเติมเกี่ยวกับ Operators บนภาษา Java 
 
  
 
Java and Operators 
              
  
              			
			  
								  
			  
  
                          
  |