Min*_*ang -1 java if-statement syntax-error
Eclipse不断给我以下错误:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
input cannot be resolved
The method If(boolean) is undefined for the type bai1DinhLuatCuLong
Syntax error, insert ";" to complete Statement
F cannot be resolved to a variable
Run Code Online (Sandbox Code Playgroud)
我不明白.我需要修理什么?为什么我不能使用这个If()功能?
我试过浏览Google和Bing,我已经仔细检查了我的Java示例书,但我无法解决这个问题.
import java.util.Scanner;
public class bai1DinhLuatCuLong
{
public static void main(String[] args)
{
System.out.print("Giá trì c?n tìm (F // q // r) : ");
char cantim = input.nextChar();
// HERE THIS IS WHERE I PUT THE IF STATEMENT !!!
If (cantim == 'F') {
Scanner input = new Scanner(System.in);
System.out.print("?? l?n c?a ?i?n tích th? nh?t : ");
double q1 = input.nextDouble();
System.out.print("?? l?n c?a ?i?n tích th? hai : ");
double q2 = input.nextDouble();
System.out.print("Kho?ng cách gi?a 2 ?i?n tích : ");
double r = input.nextDouble();
System.out.print("H? s? k s? t? ??ng ???c ??t là 9*10^9 nh? trong h? SI");
double F = 9 * Math.pow(10,9) * Math.abs(q1) * Math.abs(q2) / Math.pow(r,2);
}
System.out.print("?? l?n l?c t??ng tác gi?a 2 ?i?n tích ?i?m : " + "\n L?u ý E là *10");
}
}
Run Code Online (Sandbox Code Playgroud)
if (cantim == 'F') 它应该很小 i
要么
你需要写一个方法
public boolean If(boolean test)
{
//Your logic.
}
Run Code Online (Sandbox Code Playgroud)
但是,根据您的代码,似乎您正在寻找"if"声明而不是使用新方法.
| 归档时间: |
|
| 查看次数: |
14354 次 |
| 最近记录: |