码迷,mamicode.com
首页 > 编程语言 > 详细

Java基础 矩阵面积

时间:2017-07-27 15:47:57      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:pre   描述   cts   算法   面积   width   expect   const   int   

 

提供 数据结构与算法题目 的平台是LintCode,参考链接是:http://www.lintcode.com/zh-cn/

 

问题描述:

技术分享

 

参考代码:

public class Rectangle {
    /*
     * Define two public attributes width and height of type int.
     */
    // write your code here
    public int width;
    public int height;

    /*
     * Define a constructor which expects two parameters width and height here.
     */
    // write your code here
    Rectangle(int width , int height){
        this.width = width;
        this.height = height;
    }
    
    /*
     * Define a public method `getArea` which can calculate the area of the
     * rectangle and return.
     */
    // write your code here
    public int getArea(){
        return this.width * this.height;
    }
}

 

结果与评价:

技术分享

 

Java基础 矩阵面积

标签:pre   描述   cts   算法   面积   width   expect   const   int   

原文地址:http://www.cnblogs.com/jizuiku/p/7244849.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!