当前位置:网站首页>Up and down transitions in polymorphism
Up and down transitions in polymorphism
2022-06-29 07:48:00 【Mertrix_ ITCH】
/* * * Up transformation and down transformation in polymorphism : * * Conversion between reference types * Upward transformation * From small to large ( Child type to parent type ) * Move down * From big to small * Conversion of basic data types * Automatic type conversion * From small to large * byte short char --- int --- long --- float --- double * Cast * From big to small * * * */
public class PoymorphicDemo3{
public static void main(String[] args) {
Animal2 a = new Dog();// Upward transformation
//a.eat();
Dog d = (Dog)a;// Move down
d.swim();
}
}
class Animal2 {
public void eat() {
System.out.println(" Eat something ");
}
}
class Dog extends Animal2 {
public void eat() {
System.out.println(" Gnaw at the bone ");
}
public void swim() {
System.out.println(" Dogplane ");
}
}
边栏推荐
- How to solve the cross domain problem of mobile phone accessing the web in the web development scenario
- 1031 Hello World for U
- Using cdockablepane to realize floating window in MFC
- 道闸控制器通讯协议
- 719. find the distance of the number pair with the smallest K (two points)
- Appium 环境搭建
- [industrial control old horse] detailed explanation of the design scheme of the running lamp control system based on Siemens S7-200PLC
- Markdown skill tree (2): paragraph and emphasis
- VMware vcenter/ESXI系列漏洞总结
- Mmclassification installation and debugging
猜你喜欢

帆船动力学仿真分析
![[FreeRTOS] interrupt mechanism](/img/ab/9b1d07048b4631d7cc95db99ed529a.png)
[FreeRTOS] interrupt mechanism

4 years of working experience, and you can't tell the five communication modes between multithreads. Can you believe it?

Appium environment setup

Postman pre request

施努卡:什么是视觉定位系统 视觉定位系统的工作原理

Appium自动化测试基础 — ADB常用命令(三)

阿里云访问资源:NoSuchKey
![Detailed explanation of communication principle between [industrial control old horse] single chip microcomputer and Siemens S7-200](/img/56/b300c0c3606dbc328e301092615bff.jpg)
Detailed explanation of communication principle between [industrial control old horse] single chip microcomputer and Siemens S7-200

ES中配置ext.dic文件不生效的原因
随机推荐
Mmclassification installation and debugging
How to view software testing training? Do you need training?
【工控老马】基于西门子S7-200PLC的跑马灯控制系统的设计方案详解
postman预处理/前置条件Pre-request
【域渗透提权】CVE-2020-1472 NetLogon 权限提升漏洞
Software testing
关于开发web场景下如何解决手机访问web跨域问题
【工控老马】洗衣机PLC程序控制系统设计详解
Select distinct on statement in kingbasees
Detailed explanation of shell condition judgment
Unexpected exception ... code: Badrequest when downloading Xilinx 2018.2
Appium 环境搭建
Schnuka: 3D visual recognition system 3D visual inspection principle
KingbaseES应对表年龄增长过快导致事务回卷
KingbbaseES V8R6集群维护案例之---集群之间数据迁移
tf. to_ int64
498. 对角线遍历(模拟)
查看tensorflow是否支持GPU,以及测试程序
Listen to textarea input through Keyup to change button style
Check whether tensorflow supports GPU and test program