diff --git "a/work/com/java/minxi/java_20240530/java_2301_\345\217\266\344\277\212\346\235\260_2344310101/Animal.jsp" "b/work/com/java/minxi/java_20240530/java_2301_\345\217\266\344\277\212\346\235\260_2344310101/Animal.jsp" new file mode 100644 index 0000000000000000000000000000000000000000..5b0ab5aefb33c14b19d05ede40bdf20a1a150ef5 --- /dev/null +++ "b/work/com/java/minxi/java_20240530/java_2301_\345\217\266\344\277\212\346\235\260_2344310101/Animal.jsp" @@ -0,0 +1,61 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> + + +
+
+ <%!
+ class Animal{
+ String sleep(int time){
+ return "一只动物在睡觉";
+ }
+ }
+ class Cat extends Animal{
+ private String name;
+ private String time;
+
+ public Cat() {
+ }
+
+ public Cat(String name, String time) {
+ this.name = name;
+ this.time = time;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getTime() {
+ return time;
+ }
+
+ public void setTime(String time) {
+ this.time = time;
+ }
+
+ String sleep(int time){
+
+ return "一只"+getName()+"睡觉睡了"+getTime()+"个小时";
+ }
+ }
+
+ %>
+ <%
+ Animal animal = new Animal();
+ String sleep1 = animal.sleep(8);
+
+ Animal cat = new Cat("汤姆猫","8");
+ String sleep2 = cat.sleep(8);
+ %>
+
<%=sleep1%>
+
<%=sleep2%>
+
+ <%
+
+ for (int i = 1; i <= 9; i++) {
+ for (int j = 1; j <= i; j++) {
+ out.print(i + "*" + j + "=" + i * j + " ");
+ }
+ out.print("
");
+ }
+
+ %>
+