<%@ page import="java.util.Date" %><%-- Created by IntelliJ IDEA. User: zengy Date: 2022/1/28 Time: 22:26 To change this template use File | Settings | File Templates. --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <%! int dual = 18; String color="skyblue"; final boolean YES=true; final boolean NOT=false; boolean checkAge(int age){ if (age >= dual) return YES; return NOT; } %> <% boolean res = checkAge(23);//方法调用 Date sysTime = new Date(); %> <body bgcolor="<%=color%>"> <%=res%> </body> </html>