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

JAVA 类与对象题目3

时间:2016-05-18 09:08:35      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:

import java.awt.Label;

public class Ladder {

double SD;
double XD;
double G;
double MJ;

Ladder(double SD1,double XD1,double G1)
{
SD = SD1;
XD = XD1;
G = G1;
}
double getMJ()
{
MJ = (SD + XD)*G/2;
System.out.println("面积是"+ MJ);
return MJ;
}

public static void main(String[] args)
{
Ladder L = new Ladder(3,8,6);
double mj = L.getMJ();
System.out.println(mj);

}

}

JAVA 类与对象题目3

标签:

原文地址:http://www.cnblogs.com/xt641151246/p/5503910.html

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