• Post Reply Bookmark Topic Watch Topic
  • New Topic

syntax error on token "delete" this token on interface  RSS feed

 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I am follwing this article

http://docs.oracle.com/javase/tutorial/java/IandI/override.html

And I have created 4 different types of Interfaces and Classes

Interface:-Flyer,Mythical
Class:-Horse,Pegasys.



But on Interface

I am getting error on line
default public String identifyMyself()

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


Any help where I am wrong?


Here is code for all 4 interfaces and classes
 
Campbell Ritchie
Marshal
Posts: 56518
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which version of Java® are you using? Default methods in interfaces are only available in Java8.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using java-7..


So is it not possible to add work with default methods on Java SE7?
 
Campbell Ritchie
Marshal
Posts: 56518
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. Only in Java8.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!