Return type for the method is missing怎么回事
importjava.util.Vector;classMyCircle{//privatedoublem_r,m_hou;privatedoublem_r;privat...
import java.util.Vector;
class MyCircle
{
//private double m_r,m_hou;
private double m_r;
private double m_hou;
public MyCirlce(double r,double hou)
{
//r=m_r;
//hou=m_hou;
m_r=r;
m_hou=hou;
}
public MyCirlce(double r)
{
//r=m_r;
//m_hou=0.1;
m_r=r;
m_hou=0.1;
}
public double getTiji()
{
return Math.PI*m_r*m_r*m_hou;
}
}
public class App1
{
public static void main(String[] args)
{
Vector a=new Vector();
//MyCircle a=new MyCircle(2.5,0.6);
//MyCircle a=new MyCircle(2.5);
a.add(new MyCircle(2.5,0.2));
a.add(new MyCircle(2.5));
for(int i;i<a.size();i++)
{
MyCircle x=(MyCircle)a.get(i);
System.out.println("Circle"+x.getTiji());
}
}
}
程序代码
哈哈,我知道啦!我简直无语了,太粗心了,也缺乏考察,对不住大家。 展开
class MyCircle
{
//private double m_r,m_hou;
private double m_r;
private double m_hou;
public MyCirlce(double r,double hou)
{
//r=m_r;
//hou=m_hou;
m_r=r;
m_hou=hou;
}
public MyCirlce(double r)
{
//r=m_r;
//m_hou=0.1;
m_r=r;
m_hou=0.1;
}
public double getTiji()
{
return Math.PI*m_r*m_r*m_hou;
}
}
public class App1
{
public static void main(String[] args)
{
Vector a=new Vector();
//MyCircle a=new MyCircle(2.5,0.6);
//MyCircle a=new MyCircle(2.5);
a.add(new MyCircle(2.5,0.2));
a.add(new MyCircle(2.5));
for(int i;i<a.size();i++)
{
MyCircle x=(MyCircle)a.get(i);
System.out.println("Circle"+x.getTiji());
}
}
}
程序代码
哈哈,我知道啦!我简直无语了,太粗心了,也缺乏考察,对不住大家。 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询