在显示器输出school,student和study
时间: 2023-04-02 16:04:49 浏览: 61
可以使用 C 语言的 printf 函数来输出这些单词,代码如下:
```c
#include <stdio.h>
int main() {
printf("school\n");
printf("student\n");
printf("study\n");
return ;
}
```
运行程序后,会在显示器上输出这三个单词。
相关问题
java中继承student和person
Java中可以使用关键字extends来实现类的继承。例如,可以定义一个Student类继承自Person类,代码如下:
```
public class Person {
private String name;
private int age;
public Person(String name, int age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public int getAge() {
return age;
}
}
public class Student extends Person {
private String school;
public Student(String name, int age, String school) {
super(name, age);
this.school = school;
}
public String getSchool() {
return school;
}
}
```
在上面的例子中,Student类继承了Person类,并且添加了一个新的属性school。在Student类的构造方法中,使用super关键字调用了父类的构造方法来初始化继承自Person类的属性name和age。这样,Student类就可以使用Person类的属性和方法,同时还可以添加自己的属性和方法。
查询 student 和school表当中id为1的总和数据sql怎么写
假设student表中的id列与school表中的id列是关联的,可以使用以下SQL查询id为1的学生和学校的总和数据:
```
SELECT SUM(s.score + c.amount) AS total
FROM student s
JOIN school c ON s.id = c.id
WHERE s.id = 1
```
其中,s是student表的别名,c是school表的别名,score和amount是分别表示学生和学校的某个指标列,total是表示总和的列别名。
相关推荐
![apk](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)