【自动化__持续集成】___java___重写

一、代码如下

package www.wujianbotwo;

class Door {
	int height= 200;
	int weight= 80;
	String material= "实木";

	private void open() {
		// TODO Auto-generated method stub
		System.out.println("开门");

	}

	public void close() {
		// TODO Auto-generated method stub
		System.out.println("关门");

	}

}
package www.wujianbotwo;

public class SafeDoor extends Door {
	@Override
	//public void close() {
		// TODO Auto-generated method stub
		//super.close();
	//}

	public void close() {
		// TODO Auto-generated method stub
		System.out.println("子类关闭");
	}

	public void closeTwo() {
		// TODO Auto-generated method stub
		super.close();
	}

	public void closeThre() {
		// TODO Auto-generated method stub
		this.close();
	}

	public  void lock() {
		// TODO Auto-generated method stub
		System.out.println("子类锁门");
	}

}
-generated method stub
		Door door= new Door();
		//door.open();
		System.out.println(door.hashCode());

		SafeDoor sdoor= new SafeDoor();
		//sdoor.open();
		sdoor.lock();
		sdoor.close();
		sdoor.closeTwo();
		sdoor.closeThre();

	}

}
时间: 2024-10-14 13:16:19

【自动化__持续集成】___java___重写的相关文章

【自动化__持续集成】___java___文本文件__字节流

一.代码如下 package www.wujianbotwo; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; public class Demo09 { public static void main(String[] args) { // TODO

【自动化__持续集成】___java___字符串转数组

一.代码如下 package www.wujianbotwo; public class Demo08 { public static void main(String[] args) { // TODO Auto-generated method stub String content= "wujianbo,wujianob,33333"; String[] ud= content.split(",");//将字符串分段成一个数组 for(int i=0; i&l

【自动化__持续集成】___java___继承

一.代码如下 package www.wujianbotwo; class Door { int height= 200; int weight= 80; String material= "实木"; public void open() { // TODO Auto-generated method stub System.out.println("开门"); } public void close() { // TODO Auto-generated metho

【自动化__持续集成】___java___正则表达式

一.代码如下 package com.wujianbo.five; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Demo01 { public static void main(String[] args) { // TODO Auto-generated method stub String phone= "13541433525"; String phoneEx= &quo

【自动化__持续集成】___java___取值范围

一.代码如下 package com.wujianbo; public class Demo03 { public static void main(String[] args) { // TODO Auto-generated method stub Demo03 demo03= new Demo03(); demo03.range(); } public void range(){ float 收入= 4444.33F; char c= '强'; char d= 81; char e= 24

【自动化__持续集成】___java___数据类型转换

一.代码如下 package com.wujianbo; public class Demo04 { public static void main(String[] args) { // TODO Auto-generated method stub short si1= 100; int score=530001; System.out.println((short)score); int gdp1= 2147483647; long gdp2= 2147483648L; long l1=

【自动化__持续集成】___java___字符串

一.代码如下 package com.wujianbo; /** * @author Administrator * */ public class Demo02 { public static void main(String[] args){ System.out.println(args); Demo02 demo02= new Demo02(); System.out.println(demo02); System.out.println("对象在堆栈中的内存首地址:"+dem

【自动化__持续集成】___java___水仙花

一.代码如下 package com.wujianbo; /* * 3位数,各位数的3次方相加为其原值,称为水仙花数 */ public class Demo07 { public static void main(String[] args) { // TODO Auto-generated method stub Demo07 demo07= new Demo07(); //demo07.flowerOne(); demo07.flowerTwo(); } public void flowe

【自动化__持续集成】___java___List

一.代码如下 package www.wujianbotwo; import java.util.*; public class Demo07 { public static void main(String[] args) { // TODO Auto-generated method stub List mylist= new List(); } } package www.wujianbotwo; import java.util.*; public class Demo07 { publ