当前位置:网站首页>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: what is visual positioning system? How visual positioning system works
- Schnuka: visual positioning system manufacturer what is a visual positioning system
- Dump (cl\alv\tree\base================================cp|set\items\for\column) when expanding node or clicking toolbar button
- 面试官:为什么数据库连接很消耗资源,资源都消耗在哪里?
- SQL 注入绕过(六)
- matlab simulink 电网扫频仿真和分析
- 施努卡:3d视觉检测方案 3d视觉检测应用行业
- 施努卡:3d机器视觉检测系统 3d视觉检测应用行业
- Imx6dl4.1.15 supports EIM bus (upper) - actual operation and modification.
- 498. diagonal traversal (simulation)
猜你喜欢

Use of parameter in Simulink for AUTOSAR SWC

帆船动力学仿真分析

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

解题-->在线OJ(十三)

【工控老马】基于PLC的花样喷泉设计原理详解

VMware vcenter/ESXI系列漏洞总结

Wechat applet learning notes (summer vacation)

Viewing application and installation of Hana database license
How to view software testing training? Do you need training?

Appium自动化测试基础 — ADB常用命令(三)
随机推荐
[translation] how Bink drives the digital loyalty transactions of some of the largest banks in the UK
[FreeRTOS] interrupt mechanism
Compiling principle: the king's way
postman预处理/前置条件Pre-request
帆船动力学仿真分析
Check whether tensorflow supports GPU and test program
excel高级绘图技巧100讲(六)-甘特图在项目进度上的实战应用案例
施努卡:3d视觉检测方案 3d视觉检测应用行业
Dump (cl\alv\tree\base================================cp|set\items\for\column) when expanding node or clicking toolbar button
施努卡:视觉定位系统厂家 什么是视觉定位系统
Mmclassification installation and debugging
Markdown skill tree (9): tables
C实战——高配版贪吃蛇游戏设计
Postman pre request
阿里云访问资源:NoSuchKey
【FreeRTOS】中断机制
Schnuka: 3D machine vision inspection system 3D vision inspection application industry
关于KingbaseES临时文件过大问题
游标长时间open导致表无法vacuum问题
Imx6dl4.1.15 supports EIM bus (Part 2) - configuration principle analysis.