当前位置:网站首页>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
边栏推荐
- Read the meaning of serial port and various level signals
- R语言中实现作图对象排列的函数总结
- Implement default page
- C, calculation method and source program of bell number
- 第九天 static 抽象类 接口
- 糖尿病眼底病变综述概要记录
- Spark 算子之sortBy使用
- Import address table analysis (calculated according to the library file name: number of imported functions, function serial number and function name)
- Unity Shader学习
- 捡起MATLAB的第(9)天
猜你喜欢

Spark 算子之交集、并集、差集

一文掌握vscode远程gdb调试

Implement default page

新动态:SmartMesh和MeshBox的合作新动向

volatile的含义以及用法

Interview question 17.10 Main elements

Using JSON server to create server requests locally

The system research problem that has plagued for many years has automatic collection tools, which are open source and free

Questions about disaster recovery? Click here

Metalife established a strategic partnership with ESTV and appointed its CEO Eric Yoon as a consultant
随机推荐
Win11/10家庭版禁用Edge的inprivate浏览功能
Install redis and deploy redis high availability cluster
Government cloud migration practice: Beiming digital division used hypermotion cloud migration products to implement the cloud migration project for a government unit, and completed the migration of n
Implement default page
What is cloud migration? The four modes of cloud migration are?
Day (5) of picking up matlab
Spark 算子之distinct使用
Upgrade MySQL 5.1 to 5.610
[section 5 if and for]
JSP learning 1
Spark 算子之partitionBy
shell_ two
Day (4) of picking up matlab
Meaning and usage of volatile
【自娱自乐】构造笔记 week 2
Filter usage of spark operator
Solution to the fourth "intelligence Cup" National College Students' IT skills competition (group B of the final)
C, calculation method and source program of bell number
Hypermotion cloud migration helped China Unicom. Qingyun completed the cloud project of a central enterprise and accelerated the cloud process of the group's core business system
Groupby use of spark operator