We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › error while using interfaces
Page Index Toggle Pages: 1
error while using interfaces (Read 486 times)
error while using interfaces
Jul 9th, 2009, 6:25am
 
//What's the problem?Its error message says "Syntax error on token 'interface',identifier expected".Thank you for help.
Test t;
void setup()
{
 t=new Test();
}
void draw()
{
 t.A1_Print();
}
 
interface A1
{
public void A1_Print();
}

interface A2
{
public void A2_Print();
}

public class Test implements A1,A2
{
 public void A1_Print()
 {
  System.out.println("A1_Print");
  System.out.println("A2_Print");
 }
 
 public void A2_Print()
 {
  System.out.println("A2_Print");
 }
}
Re: error while using interfaces
Reply #1 - Jul 9th, 2009, 7:23am
 
Your code works fine (as expected) with Processing 1.0 on Windows XP.
I use the version without Java, so it runs on my copy of Java 1.6.0_13.

Why do you use System.out.println instead of simple println?
Re: error while using interfaces
Reply #2 - Jul 9th, 2009, 7:45am
 
I just tested on Vista64. Works fine.
Re: error while using interfaces
Reply #3 - Jul 10th, 2009, 1:50am
 
Er...
I put the code into a new file window and it works...But the original document keeps throwing exception still...So queer thing...Thank you!
Re: error while using interfaces
Reply #4 - Jul 10th, 2009, 4:18am
 
How do you name the sketch? You might have a clash between the sketch name and one of the internal class/interface names.
Page Index Toggle Pages: 1