软件园学生在线

  • {{ item.name }}
  • 2023试用期

登录与注册

后端第一次培训——胡益萌

  • 202300300152
  • 2023-10-29
  • 0

怎么做的作业

看培训时的PDF

  • 跟着写了一遍,熟悉流程
  • 尝试加上减法和除法
  • 发现int不能用两遍

    上CSDN查

  • 开始用double代替
  • 没法运行
  • 问学长发现FirstspringApplication.java类被我删了
  • 重新建了一个project
    写完发现程序运行但是白标签错误
    加上地址

    package com.example.firstspring.controller;

    import org.springframework.web.bind.annotation.GetMapping;
    import org.springframework.web.bind.annotation.RequestParam;
    import org.springframework.web.bind.annotation.RestController;

    @RestController
    public class spring {
    @GetMapping("/")
    public int add(@RequestParam int a, @RequestParam int b) {
    return a + b;
    }

    @GetMapping("/add")
    public double add(@RequestParam double c, @RequestParam double d) {
    return c - d;
    }

    @GetMapping("/a")
    public double add(@RequestParam float e, @RequestParam double f) {
    return e * f;
    }
    @GetMapping("/d")
    public double add(@RequestParam int g, @RequestParam double h) {

    return g / h;

    }
    }

202300300152
202300300152
© 2025 软件园学生在线
Theme by Wing