提供 数据结构与算法题目 的平台是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; } }
结果与评价:
时间: 2024-11-08 19:11:58