当前位置:网站首页>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
边栏推荐
- Hyperbdr cloud disaster recovery v3 Release of version 3.0 | upgrade of disaster recovery function and optimization of resource group management function
- Best practice of cloud migration in education industry: Haiyun Jiexun uses hypermotion cloud migration products to implement progressive migration for a university in Beijing, with a success rate of 1
- 贫困的无网地区怎么有钱建设网络?
- Unity Shader学习
- Six scenarios of cloud migration
- 多线程原理和常用方法以及Thread和Runnable的区别
- Vision of building interstellar computing network
- Spark 算子之distinct使用
- pywintypes. com_ Error: (- 2147221020, 'invalid syntax', none, none)
- Day (3) of picking up matlab
猜你喜欢
第九天 static 抽象类 接口
多线程原理和常用方法以及Thread和Runnable的区别
Spark 算子之coalesce与repartition
Implement default page
捡起MATLAB的第(5)天
The principle and common methods of multithreading and the difference between thread and runnable
MetaLife与ESTV建立战略合作伙伴关系并任命其首席执行官Eric Yoon为顾问
运维流程有多重要,听说一年能省下200万?
Nanny Anaconda installation tutorial
TIA博图——基本操作
随机推荐
新动态:SmartMesh和MeshBox的合作新动向
Research and Practice on business system migration of a government cloud project
299. Number guessing game
Application case of GPS Beidou high precision satellite time synchronization system
The principle and common methods of multithreading and the difference between thread and runnable
Using JSON server to create server requests locally
Fastjon2 here he is, the performance is significantly improved, and he can fight for another ten years
Compile, connect -- Notes
Cloudy data flow? Disaster recovery on cloud? Last value content sharing years ago
JSP learning 2
Day (7) of picking up matlab
OAK-D树莓派点云项目【附详细代码】
5分钟,把你的Excel变成在线数据库,神奇的魔方网表excel数据库
VIM specifies the line comment and reconciliation comment
shell_2
Ice -- source code analysis
You need to know about cloud disaster recovery
Spark 算子之coalesce与repartition
Start Oracle service on Linux
VIM uses vundle to install the code completion plug-in (youcompleteme)