当前位置:网站首页>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 ");
}
}
边栏推荐
- Schnuka: 3D visual inspection scheme 3D visual inspection application industry
- 呕心沥血总结出来的MySQL常见错误以及解决方法(二)
- 蓝桥杯——13届第二批试题解析
- Detailed explanation of shell condition judgment
- 498. 对角线遍历(模拟)
- Imx6dl4.1.15 supports EIM bus (upper) - actual operation and modification.
- Appium automation test foundation ADB common commands (II)
- Check whether tensorflow supports GPU and test program
- Markdown skill tree (8): code blocks
- 358. K distance interval rearrange string sorting
猜你喜欢

阿里云访问资源:NoSuchKey

蓝桥杯——最小框架

Unexpected exception ... code: Badrequest when downloading Xilinx 2018.2

打包时提示: Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘

呕心沥血总结出来的MySQL常见错误以及解决方法(一)

Compiling principle: the king's way
![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

100 lectures on Excel advanced drawing skills (VI) - practical application cases of Gantt chart in project progress

VMware vcenter/ESXI系列漏洞总结

matlab 多普勒效应产生振动信号和处理
随机推荐
TF.Slim的repeat和stack操作
蓝桥杯——13届第二批试题解析
Selected Siemens PLC project example source code [300 sets in total]
HANA数据库License的查看申请及安装
帆船动力学仿真分析
C实战——高配版贪吃蛇游戏设计
Compiling principle: the king's way
Kingbasees coping with transaction rollback caused by too fast growth of table age
Markdown skill tree (5): picture
The table cannot be vacuumed because the cursor is open for a long time
[translation] E-Cloud. Large scale CDN using kubeedge
719. find the distance of the number pair with the smallest K (two points)
Es query syntax
[translation] how Bink drives the digital loyalty transactions of some of the largest banks in the UK
Concurrent idempotent anti shake
What you should know about databases
About the problem that the kingbasees temporary file is too large
电检码配置
SAP UI5 初学 ( 一 )、简介
Markdown skill tree (1): introduction to markdown