【发布时间】:2012-03-19 14:59:33
【问题描述】:
我的代码中出现以下错误: - 缺少退货声明 -第二种方法找不到符号
这是我的代码:
import java.io.*;
import javax.swing.JOptionPane;
public class Converter {
public static void main(String[] args) throws Exception{
//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String unit = JOptionPane.showInputDialog("Enter unit F or C: ");
String temp1 = JOptionPane.showInputDialog("Enter the Temperature: ");
double temp = Double.valueOf(temp1).doubleValue();
}
public static double convertTemp(){
if((unit.equals("F"))||(unit.equals("f"))){
double c= (temp - 32) / 1.8;
JOptionPane.showMessageDialog(null,c+" Celsius"));
}
else if((unit.equals("C"))||(unit.equals("c"))){
double f=((9.0 / 5.0) * temp) + 32.0;
JOptionPane.showMessageDialog(null,f+" Fahrenheit");
}
}
}
【问题讨论】:
-
当你没有return语句时,告诉你没有return语句的错误有什么不清楚的地方?
标签: java