Java Error: <identifier> expected inside protected interface -


i facing following problem. trying put simple tutorial on strategy in java when ran problem. compiler gives me "<identifier> expected" error on void do(int i); in interface: here full class:

import java.util.*; public class data { private list<integer> ints;    public data( int[] ) {     ints = new linkedlist<>();      for( int : ) ints.add( );  }   protected static interface strategy{     void do(int i);  }   protected void loop( strategy s ) {         for( int : ints ) {             s.do( );         }     }  } 

why getting error? thank in advance.

the method name do java keyword (section 3.9, jls) , can't method name. change method name not keyword.

protected static interface strategy{     void doaction(int i); } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -