2015-08-26 177 views
0

我开始学习JAVA,我认为它比C更简单,比C#更困难,所以我建立了一个使用JERSEY框架的项目,并且出现了一些错误,你想帮我解决这个错误吗? 这里是我的代码 https://github.com/abcdef123ghi/jerseytest学习JAVA,但我有麻烦

我有5个错误,我不知道什么是diffrenet用JAVA & C#,我只是triing写一个Java项目,误差

Description Resource Path Location Type 
The method checkAuth(String, String) is undefined for the type myresource myresource.java /slwebservice/src/service line 40 Java Problem 

Description Resource Path Location Type 
The method inserttherecord(String, List<invdatas>) is undefined for the type myresource myresource.java /slwebservice/src/service line 43 Java Problem 

Description Resource Path Location Type 
The operator == is undefined for the argument type(s) int, null myresource.java /slwebservice/src/service line 31 Java Problem 

Description Resource Path Location Type 
This method must return a result of type int invdataManager.java /slwebservice/src/domain line 88 Java Problem 

Description Resource Path Location Type 
Type mismatch: cannot convert from java.util.Date to java.sql.Date invdataManager.java /slwebservice/src/domain line 223 Java Problem 

感谢 问候 Ken

+2

看到没有触发它们的行的错误是没用的......也就是说,你发布的错误看起来非常简单,例如,checkAuth()方法接受字符串作为参数,并且你发送它“myresource”类型的对象 – alfasin

+0

从简单的事情开始学习。你可以试试[The Java tutorials](https://docs.oracle.com/javase/tutorial/)。 – Willmore

+0

不错,但是我买了一本书,这是伊沃霍顿开始的JAVA 7版。我读完了这本书,但是当错误出现时,我不知道如何解决这些问题 –

回答

0

代码中的编译错误很少。我认为你最好遵循一些java教程,并再次检查代码。无论如何,我会指出错误和解决方案。

  1. checkAuth(String,String)方法未定义:您的myresource.java中没有checkAuth方法。请添加它。

  2. 方法inserttherecord(字符串,列表)是未定义:同上

  3. 的运算符==是未定义的参数类型(一个或多个)INT,空:int是一个原始值。所以int的默认值是0.如果你使用Integer而不是int,那么你的操作是正确的。所以你需要像这样改变代码。 ivm.getRecordcount()==0

  4. 该方法必须返回int类型的结果:方法public int inserttherecord(List<invdatas> invdatalist,String clino)应该返回一个int值。你的代码可以做到这一点,但在条件和块内。这个想法是你应该返回一个int值,而不是你可能会返回它。至少把return 0;放到方法的最后。

  5. 类型不匹配:不能转换从java.util.Date到java.sql.Date:在这里,你的方法private Date parseDate(String date)应该返回java.sql.Date对象,但你回来return format.parse(date);。这将返回java.util.Date。我认为该方法的返回类型应为java.util.Date。看来你输入错误的类。只需导入java.util.Date而不是java.sql.Date

希望这会帮助你。谢谢

+0

你欢迎和所有最好的为你的Java学习 – isurujay