Dear Java Programmer:
INTERFACE WITH METHOD SIGNATURE
Package mypersoninterface
public interface PersonInterfaceAnother {
// Add another method to the interface
void reflect();
}//PersonInterfaceAnother interface
CONCRETE CLASS IMPLEMENTATION:
Package mypersoninterface
public class PersonAnother3 implements PersonInterface3,
PersonInterfaceAnother,
PersonInterface {
//code here..
// Implement PersonInterfaceAnother method
public void reflect(){
System.out.print("New Method placed in PersonAnother3.");
}//newMethod
}//PersonAnother3 class
MAIN CLASS:
Package mypersoninterface
public class Main{
public static void main(String[] args){
//code here….
// Create an object instance of PersonAnother3 class.
PersonAnother3 personAnother3 =
new PersonAnother3(10000, 20000, "Sang", "Shin");
//Method call
System.out.println(
"This is the new method = " +
personAnother3.reflect());
}//main(Strting[])
}//Main class
COMMENT:
I receive an error stating "'void' not allowed here." But when I take the
method call out of the System.out.println();
When I write
personAnother3.reflect();
This works.
Respects,
JKid314159
http://existentialists.blogspot.com/
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---