当前位置:网站首页>Day 9 static abstract class interface
Day 9 static abstract class interface
2022-04-23 16:08:00 【Students Mr sun】
static
package oop.redo; public class Demo1 { private static int a; private double b; public static void main(String[] args) { Demo1.a=1; System.out.println(Demo1.a); Demo1 a= new Demo1(); a.b=0.4; System.out.println(a.b); a.go();// No, static The modifier needs to be called first new An object run();// Yes static Can be called directly } public void go() { System.out.println("go"); } public static void run() { System.out.println("run"); } }
abstract class
package oop.redo; // abstract class public abstract class Demo2 { public abstract void Sun(); }package oop.redo; //demo3 Inherit demo2 The abstract class of , But it needs to be rewritten demo2 Abstract methods in public class Demo3 extends Demo2{ @Override public void Sun() { System.out.println("say hi"); } }
Interface
package oop.redo; public interface Userservice { void add(String name); void delete(String name); void update(String name); void select(String name); }package oop.redo; // Class overrides methods in the interface public class Userserviceimp implements Userservice{ @Override public void add(String name) { System.out.println(name); } @Override public void delete(String name) { System.out.println(name); } @Override public void update(String name) { System.out.println(name); } @Override public void select(String name) { System.out.println(name); } }
版权声明
本文为[Students Mr sun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231602157351.html
边栏推荐
- Using JSON server to create server requests locally
- 5 minutes, turn your excel into an online database, the magic cube net table Excel database
- C语言自编字符串处理函数——字符串分割、字符串填充等
- 捡起MATLAB的第(7)天
- Fastjon2他来了,性能显著提升,还能再战十年
- Day (5) of picking up matlab
- 如何进行应用安全测试(AST)
- 捡起MATLAB的第(8)天
- The biggest winner is China Telecom. Why do people dislike China Mobile and China Unicom?
- [section 5 if and for]
猜你喜欢
451. 根据字符出现频率排序
Spark 算子之交集、并集、差集
New developments: new trends in cooperation between smartmesh and meshbox
Config组件学习笔记
多线程原理和常用方法以及Thread和Runnable的区别
5分钟,把你的Excel变成在线数据库,神奇的魔方网表excel数据库
Nanny Anaconda installation tutorial
Six scenarios of cloud migration
Function summary of drawing object arrangement in R language
Groupby use of spark operator
随机推荐
Read the meaning of serial port and various level signals
js正則判斷域名或者IP的端口路徑是否正確
The biggest winner is China Telecom. Why do people dislike China Mobile and China Unicom?
shell_ two
New developments: new trends in cooperation between smartmesh and meshbox
VIM specifies the line comment and reconciliation comment
通过Feign在服务之间传递header请求头信息
Algorithem_ ReverseLinkedList
Hyperbdr cloud disaster recovery v3 Release of version 3.0 | upgrade of disaster recovery function and optimization of resource group management function
Oak-d raspberry pie cloud project [with detailed code]
Win11/10家庭版禁用Edge的inprivate浏览功能
Day (9) of picking up matlab
5分钟,把你的Excel变成在线数据库,神奇的魔方网表excel数据库
一文掌握vscode远程gdb调试
Day (2) of picking up matlab
How can poor areas without networks have money to build networks?
Metalife established a strategic partnership with ESTV and appointed its CEO Eric Yoon as a consultant
Hyperbdr cloud disaster recovery v3 Version 2.1 release supports more cloud platforms and adds monitoring and alarm functions
PS为图片添加纹理
ESP32_ Arduino