- Please describe what is the polymorphism? Please Explain how to use inheritance, interfaces, and abstract classes to achieve polymorphism. What is different between key word interface and @interface.
In Java, polymorphism has two implementations:
2. Static polymorphism implemented by method overloading
3. Runtime polymorphism of method override implementations (because of inheritance, subclasses can call methods of their parent classes. To achieve runtime polymorphism)
Polymorphism means that the same code can achieve different function.
And,
interface declares the interface
@interface declares annotations
- Please explain what serialization is and how to serialize objects in Java.
1. Serialization represents the process of converting a Java object into a byte stream.
2. The Serializable interface is implemented for the class that needs to be serialized, and an output stream is used to construct an ObjectOutputStream object
- Please explain how to use Spring Boot to develop RESTful API, including which annotations can help you quickly create API.
SpringBoot uses some annotations to implement Restful apis, if we wanna create a restful API, we need those steps,
A. Confirm request type and resource url, we can use those annotations to replace @RequestMapping(…)
1. @GetMapping processes Get requests
2. @PostMapping Handle Post requests by
3. @PutMapping is used to update resources
4. @DeleteMapping processes the deletion request
5. @PatchMapping is used to update some resources
B. Confirm the received request body, we can use those anotations
1. @PathVariable gor data from url
2. @RequestBody get data from request body
C. use postman doing testing
- Now the operator has held a contest and received some entries, and the form of the data record form is as follows, and now the operation wants to count how many participants are for each gender, please take out the corresponding results
example:user_submit
device_id profile blog_url
2138 180cm,75kg,27,male http:/url/bigboy777
3214 165cm,45kg,26,female http:/url/kittycc
6543 178cm,65kg,25,male http:/url/tiger
4321 171cm,55kg,23,female http:/url/uhksd
2131 168cm,45kg,22,female http:/urlsydney
Please refer the example to prepare your sql and get below result:
gender number
male 2
female 3
select gender,count(*) from
(select device_id, substr(profile, 15) gender from user_submit) tmp
group by tmp.gender;
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/202476.html