- Joined
- Sep 6, 2009
- Messages
- 5
- Reaction score
- 0
i have error in line no.4 and 5
in 4 ..variable final must be initialized
in 5.identifier expected
//import java.io.*;
interface callback {
void callback(int parm);
int i;
i = 10;
}
class client implements callback,Fig {
public void callback(int p) {
System.out.println("callback called with"+p);
}
public void callback(int p,int q) {
System.out.println("callback called with"+(p+q));
}
void nonIface() {
System.out.println("classes that implents that also defined other method");
}
public void add(int a,int b){
System.out.println("sum="+(a+b));
}
}
interface Fig {
void add(int a,int b);
void callback(int parm);
}
class TestIface {
public static void main(String args[]) {
callback c = new client();
c.callback(428);
//c.nonIface();
//c.add(2,5);
client d = new client();
c = d;
//c.nonIface();
d.nonIface();
d.callback(78);
d.add(3,4);
d.callback(2,6);
Fig f = new client();
f.callback(34);
}
}
in 4 ..variable final must be initialized
in 5.identifier expected
//import java.io.*;
interface callback {
void callback(int parm);
int i;
i = 10;
}
class client implements callback,Fig {
public void callback(int p) {
System.out.println("callback called with"+p);
}
public void callback(int p,int q) {
System.out.println("callback called with"+(p+q));
}
void nonIface() {
System.out.println("classes that implents that also defined other method");
}
public void add(int a,int b){
System.out.println("sum="+(a+b));
}
}
interface Fig {
void add(int a,int b);
void callback(int parm);
}
class TestIface {
public static void main(String args[]) {
callback c = new client();
c.callback(428);
//c.nonIface();
//c.add(2,5);
client d = new client();
c = d;
//c.nonIface();
d.nonIface();
d.callback(78);
d.add(3,4);
d.callback(2,6);
Fig f = new client();
f.callback(34);
}
}