shapes
接口 shape
package shape;
public abstract interface shape {
public abstract void Draw();
public abstract void getString();
public static void main(String[] args) {
}
}
实体类矩形
package shape;
public class Rect implements shape{
private int length = 0;
private int wideth = 0;
public Rect(int length,int wideth){
this.length = length;
this.wideth = wideth;
}
public void Draw(){
System.out.println("Draw Rect");
}
public void getString() {
System.out.println("Rect [length=" + length + ", wideth=" + wideth + "]");
}
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
实体类 圆
package shape;
public class Circle implements shape{
private int Radius = 0;
public Circle(int Radius){
this.Radius = Radius;
}
public void Draw(){
System.out.println("Draw Circle");
}
public void getString() {
System.out.println("Circle [Radius=" + Radius + "]");
}
public static void main(String[] args) {
}
}
多态 操作
package shape;
public class Board {
public shape[] S = { new Circle(1), new Circle(2)
, new Circle(3), new Rect(1,2)
, new Rect(2,3), new Rect(3,4) };
public void Refresh(shape s) {
s.Draw();
s.getString();
}
public static void main(String[] args) {
Board B = new Board();
for (int i = 0; i < 6; i++) {
B.Refresh(B.S[i]);
}
}
}
shapes的更多相关文章
- 十二、shapes
1. The control points are attributes on the shape which are usually arrays of points. Control points ...
- Allegro Out Of Date Shapes原因及解决方法
使用Allegro设计PCB板时,查看Status,经常会遇到out of date shapes的警告信息,具体如下: dynamic shape is still out of data or e ...
- Topology Shapes of OpenCascade BRep
Topology Shapes of OpenCascade BRep eryar@163.com 摘要Abstract:通过对OpenCascade中的BRep数据的读写,理解边界表示法的概念及实现 ...
- graphviz - Node Shapes
Node Shapes There are three main types of shapes : polygon-based, record-based and user-defined. The ...
- POJ 3449 Geometric Shapes(判断几个不同图形的相交,线段相交判断)
Geometric Shapes Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 1243 Accepted: 524 D ...
- Geometric Shapes - POJ 3449(多边形相交)
题目大意:给一些几何图形的编号,求出来这些图形都和那些相交. 分析:输入的正方形对角线上的两个点,所以需要求出来另外两个点,公式是: x2:=(x1+x3+y3-y1)/2; y2:=(y1+y3 ...
- 详细分析Orchard的Content、Drivers, Shapes and Placement 类型
本文原文来自:http://skywalkersoftwaredevelopment.net/blog/a-closer-look-at-content-types-drivers-shapes-an ...
- POJ 3449 Geometric Shapes (求正方形的另外两点)
Geometric Shapes Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 1470 Accepted: 622 D ...
- 解决gerber-Failed to Match All Shapes for PCB问题
有效解决在Protel 99se导gerber时提示gerber-Failed to Match All Shapes for PCB出错问题如图 这种问题很好解决,打开这个窗口 操作方法如下图Emb ...
- 【python问题系列--4】ValueError: operands could not be broadcast together with shapes (100,3) (3,1)
背景:dataMatrix是(100,3)的列表,labelMat是(1,100)的列表,weights是(3,1)的数组,属性如下代码所示: >>> import types> ...
随机推荐
- GitHub 上受欢迎的 Android UI Library 整理二
通知 https://github.com/Tapadoo/Alerter ★2528 - 克服Toast和Snackbar的限制https://github.com/wenmingvs/Notify ...
- ML | k-means
what's xxx k-means clustering aims to partition n observations into k clusters in which each observa ...
- python3:requests模块-写了一点
使用requests,它的七个主要方法,在这里只讲两个:get.post >>> import requests >>> r=requests.get(" ...
- jvm 问题分析
jmap dump:file=[文件名].dump [进程号] 生成dump root@VM-185-251-ubuntu:/opt/scripts# jmap -dump:file=three.d ...
- html中的列表标签
1.<dl>定义列表,<dt>定义列表中的项目,<dd>对项目的描述 例: 效果: 2.<ul>无序列表,<li>列表项 例: 效果: 3. ...
- 几点iOS开发技巧
转自I'm Allen的博客 原文:iOS Programming Architecture and Design Guidelines 原文来自破船的分享 原文作者是开发界中知晓度相当高 ...
- [转]Go的50坑:新Golang开发者要注意的陷阱、技巧和常见错误-高级
from : https://levy.at/blog/11 进阶篇 关闭HTTP的响应 level: intermediate 当你使用标准http库发起请求时,你得到一个http的响应变量.如果你 ...
- Hibernate操作Blob数据
首先看数据库.数据库中新建一个BlobTable表,表中有两个字段,一个id(主键)一个picture字段是Blob类型字段.然后使用Hibernate向该数据库中写入和读取数据 在POJO类中p ...
- wdcp新开站点或绑定域名打不开或无法访问的问题
一 用IP可以打开,但用域名打开网站显示到默认页面1 站点列表里是否有相应的网站信息 2 检查有没站点配置文件后台 >系统管理 >文件管理器 >虚拟主机站点文件(nginx,ap ...
- fuser - identify processes using files or sockets
FUSER(1) User Commands FUSER(1) NAME fuser - identify processes using files or sockets SYNOPSIS fuse ...