如何用java接口,建立驱动类测试Task对象?

如何用java接口,有两个方法:setPriority和getpriority,设计Task类Priority,建立驱动类测试Task对象?


慕姐8265434
浏览 718回答 1
1回答

POPMUISE

interface Jiekou{public void setPriority(int i);public int getPriority();}class Task implements Jiekou{int i;public void setPriority(int i){this.i=i;}public int getPriority(){return i;}}public class TaskTest{public static void main(String args[]){int test;Task task=new Task();task.setPriority(6);test=task.getPriority();System.out.println(test);}}
打开App,查看更多内容
随时随地看视频慕课网APP