30/09/2018, 19:33
Cho mình hỏi lỗi trong Java
package edu.bi.basic;
public class Distance {
public static double sumSquares(double x,double y){
return x*x+y*y;
}
public static double distance (double x1,double y1,double x2,double y2){
return Math.sqrt(sumSquares(x2-x1,y2-y1));
}
public static void main(String[] args){
System.out.print(distance(4,5,7,10));
}
}
Bài liên quan
trình báo lỗi: Error: Main method not found in class edu.bi.basic.Distance, please define the main method as:
public static void main(String[] args)
or a JavaFX application class must extend javafx.application.Application
ban cho minh hoi la ban dang dung IDE nao de code jv vay?
minh dung Eclipe …
Theo minh hieu la loi “Thieu Phuong thuc main”, ban nen copy toan bo code va luu vao mot file .txt roi xoa project do, khoi dong lai may va tao thu project moi thu xem. Than .
Hoac truoc het ban thu nhan to hop phim Ctrl + S xem thu sao.
ok mình được rồi,cho mình hỏi luôn là lỗi này từ đâu vậy
loi nay thuong xuat hien do may khong the tim duoc Phuong thuc main hoac file chua Phuong thuc do, thuong la do IDE chu it khi nao la do Java va loi thuong do he thong direction cua Java khong native duoc voi Windows hoac IDE khong tim duoc file trong thu muc mac dinh. Loi nay da duoc nhieu lan debug boi ca Eclipse (IBM) va ca Netbean (Oracle) nhung van khong duoc. Than
mình cảm ơn nha .