課程
/后端開發(fā)
/Java
/Java入門第一季(IDEA工具)
我不懂哪里出錯了
2017-02-27
源自:Java入門第一季(IDEA工具) 4-6
正在回答
沒有main方法。怎么會輸出(system。。。。)成功
BonnieLLLL 提問者
public? static void main(String []args){
}
老哥
public class Week {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc ?= new Scanner(System.in);
double num = sc.nextDouble();
if(num<0){
System.out.println("error");
}else{
System.out.printf("%.3f",Math.sqrt(num));
缺少 public static void main(String[] args) {這句話
//去掉你的括號?double num = sc.nextDouble();后面
你的class名字是不是少了一個*號,
沒有main方法,沒有入口,怎么輸出
舉報
0基礎(chǔ)萌新入門第一課,從Java環(huán)境搭建、工具使用、基礎(chǔ)語法開始
5 回答代碼運(yùn)行不了
4 回答怎么運(yùn)行代碼
1 回答代碼代碼一直運(yùn)行不了
1 回答運(yùn)行錯誤怎么辦
1 回答運(yùn)行失敗怎么辦
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2017-02-27
沒有main方法。怎么會輸出(system。。。。)成功
2017-02-27
public? static void main(String []args){
}
老哥
2017-02-27
public class Week {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc ?= new Scanner(System.in);
double num = sc.nextDouble();
if(num<0){
System.out.println("error");
}else{
System.out.printf("%.3f",Math.sqrt(num));
}
}
}
缺少 public static void main(String[] args) {這句話
2017-02-27
Scanner sc ?= new Scanner(System.in);
double num = sc.nextDouble();
if(num<0){
System.out.println("error");
}else{
System.out.printf("%.3f",Math.sqrt(num));
}
//去掉你的括號?double num = sc.nextDouble();后面
2017-02-27
你的class名字是不是少了一個*號,
2017-02-27
沒有main方法,沒有入口,怎么輸出