找回密码
 注册
搜索
热搜: java php web
查看: 2580|回复: 3

菜鸟提问,请求高手帮助

[复制链接]
发表于 2009-1-25 20:27:26 | 显示全部楼层 |阅读模式
我刚学java现在一段代码:
public class MathCalc
{
public static void main(string[]args)
{
//calculate the radius of a circle
//which has an area of 100 square feet
double radius = 0.0;
double circleArea = 100.0;
int feet = 0;
int inches = 0;
radius = Math.sqrt(circleArea/Math.PI);
feet = (int)Math.floor(radius);      // Get the whole feet and nothing
                                     //  but the feet
inches = (int)Math.round(12.0*(radius = feet));
System.out.println("The radius of a circle with area " +
                   circleArea + " square feet in\n " +
                   feet + " feet " + inches + "inches");
}
}

大概有什么问题可以指教下吗???它出现了这样的问题(除了这个还有其他吗)
类 MathCalc 是公共的,应在名为 MathCalc.java 的文件中声明
public class MathCalc
发表于 2009-1-25 21:54:00 | 显示全部楼层
问题1: 你的入口函数: public static void main(string[] args) 中的 String "注意大小写"  你这里写的是小写s

问题2: 还有,java文件( *.java文件)的名称必须和你的java的类(MathCalc)名相同 ! ! !
回复

使用道具 举报

发表于 2009-1-25 21:14:56 | 显示全部楼层
谢谢咯
回复

使用道具 举报

发表于 2009-1-25 22:03:17 | 显示全部楼层
都被楼上说了!!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|软晨网(RuanChen.com)

GMT+8, 2024-9-20 15:30

Powered by Discuz! X3.5

Copyright © 2001-2023 Tencent Cloud.

快速回复 返回顶部 返回列表