为什么我无法在界面中创建默认方法?

时间:2018-04-08 13:08:17

标签: java oop interface default-method

我只是一个新手并且学习接口。在发布之前我试过阅读一些查询。但似乎对我来说太复杂了。他们谈论的是默认的Object方法。在我的情况下,我正在尝试在界面中创建一个默认方法,但是我收到了这个错误:

Imports System

Public Module Module1

Public Sub Main()
Const MSG_ENTRYNAME = "Please enter the name of the student."
Const MSG_ERROR = "Score not valid, please enter again."
Const MSG_ENTRYDATA = "Please enter the score of the respective student."
Dim marks(10) as Decimal
Dim name(10) as STRING
Console.WriteLine(MSG_ENTRYNAME) 
Console.ReadLine(name) 
Console.WriteLine(MSG_ENTRYDATA) 
Console.WriteLine(marks)
WHILE marks < 25 or marks > 100
    Console.WriteLine(MSG_ERROR)
END WHILE
End Sub
End Module

这是我的代码:

 "Syntax error on token "default", delete this token"

1 个答案:

答案 0 :(得分:0)

考虑检查jdk版本

  接口中的

默认方法可从jdk1.8 =&gt;

获得

https://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html