Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
おそらく非常に簡単なことですが、私を大いに混乱させます。別のクラスを呼び出すクラスがあります。
public static int getNumberOfDaysBetweenDates(Date d1, Date d2) { //rest of code }
ファイルの別の部分で呼び出されています。唯一の問題は、d1 と d2 をどのように正確に宣言するかです。いくつかのことを試しましたが、互換性のないエラーなどが発生し続けます.
Curia、あなたが渡しているのはDateオブジェクトではありません..オブジェクトでさえありませんString。オブジェクトを作成してからDateメソッドに渡す必要があり、それが機能します。
Date
String
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Date d = sdf.parse("21/12/2012");