fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. interface InterfaceA {
  8. public void PartOfIinterfaceA();
  9. }
  10.  
  11. class Class_To_Test_Interface_encapsulation implements InterfaceA {
  12.  
  13. public void MethodM() {
  14.  
  15. }
  16.  
  17. @Override
  18. public void PartOfIinterfaceA() {
  19. // TODO Auto-generated method stub
  20.  
  21. }
  22.  
  23. }
  24.  
  25. public class Main {
  26.  
  27. public static void main(String args[]) {
  28.  
  29. InterfaceA Ia = new Class_To_Test_Interface_encapsulation().MethodM();
  30. }
  31. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:29: error: incompatible types: void cannot be converted to InterfaceA
	    InterfaceA Ia = new Class_To_Test_Interface_encapsulation().MethodM();
	                                                                       ^
1 error
stdout
Standard output is empty