简体   繁体   English

为什么仍然需要错误返回类型?

[英]Why there still have error return type required?

I want to draw a line from value in function before. 我想从函数中的值画一条线。 Therefore, I need a return function so, it more smoothly to draw a line in graphic function. 因此,我需要一个返回函数,以便在图形函数中更流畅地绘制线条。

I confused, why there still error since I was put the return function. 我很困惑,为什么自从我把return函数放进去后仍然还有错误。 Please help me.. 请帮我..

"Program.java:45: invalid method declaration; return type required" “ Program.java:45:无效的方法声明;需要返回类型”

   public static SLL(int SLL)

   public Program()
  {
     super("MyProgram"); //window name
     .....
     computeButton.addActionListener(this);
  }


   public void actionPerformed(ActionEvent ee)
  {
  }
   public static SLL(int SLL)
  {  ....

     HomePosition HP[][] = new HomePosition[2][6];
     HomePosition DP[][]= new HomePosition[2][6];
     HomePosition FB[][] =new HomePosition[2][6];
     ...
     FB[1][0].x= FB[2][0].x=40;
     FB[1][0].y=FB[2][0].y=40;

     HP[1][0].x = 40;       HP[1][0].y = 30;        
     HP[1][1].x = 26;       HP[1][1].y = 30;       


     DP[1][0].x = 30;           DP[1][0].y =40;    
     DP[1][1].x = 16;           DP[1][1].y = 40;   

     SLL.SLx[m][n]=HP[m][n].x;

     return SLL;
  }

   public void paint(Graphics g) {
     super.paint(g);      
     }


      BasicStroke stroke;
     Graphics2D g2 = (Graphics2D)g;

     stroke = new BasicStroke(4.0f); 
     g2.setStroke(stroke);
    .....
      for (m=1;m<=2;m++){
        for (n=0;n<=1;n++){
             g2.drawLine( SLL.SLx[m][n]*M,40*M,40*M,30*M);
        }
     }
  }

   public static void main(String[] arguments)
  {
     Program frame=new Program();
     final int WIDTH=910;
     final int LENGTH=725;
     frame.setSize(WIDTH,LENGTH);
     final int buttonWidth=30;
     final int buttonHeight=10;
     frame.setVisible(true);
  }
}

You are not stating your return type. 您没有说明您的退货类型。 It should be 它应该是

public static int SSL(...)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我已经尝试使用long作为函数的变量类型以及返回类型,但是仍然溢出。 我不明白为什么? - I have tried using long both as the variable type as well as the return type of the function but still it is overflowing. I cannot understand why? 泛型类型返回类型错误:需要类型 T,提供 MyObject - Generics type return type error: required type T, provided MyObject 为什么在返回类型之前为静态泛型方法键入参数 - Why type parameter required before return type for static generic methods 下面的程序我们有一个错误无效的方法声明需要返回类型请解释我需要的程序o / p - below program we have one error invalid method declaration return type required pls explain the program i need o/p 构造函数所需的返回类型 - Return type Required for Constructor Java 中要求的返回类型 - return type required in Java 我似乎无法找出为什么我不断收到错误“无效的方法声明;需要返回类型” - I can't seem to find out why I keep getting the error "Invalid method declaration; return type required" 协助我查找错误:方法声明无效; 需要返回类型 - Assist me in finding the error: invalid method declaration; return type required 尝试使用Citrus-编译错误:需要返回类型 - Trying to use Citrus - Compilation error: return type required Java 错误 - 无效的方法声明; 需要返回类型 - Java error - invalid method declaration; return type required
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM