online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
class PruebaAdapter{ public static void main(String[] args){ A a = new A(); // Usa a I AdapterB ab = new AdapterB(new B()); // ab implementa a I y adaptará a B a.ejec(ab); } } class A{ void ejec(I i){ // i es un objeto de una clase que implementa a I i.m1(); i.m2(); } } interface I{ void m1(); void m2(); } class B{ // No implementa a I; pero se requiere que simule implementarla void b1(){System.out.println("Se adaptó a m1");} void b2(){System.out.println("Se adaptó a m2");} } class AdapterB implements I{ // Es un adaptador de B a I B b; AdapterB(B b){this.b = b;} public void m1(){b.b1();} public void m2(){b.b2();} } /* Salida Se adaptó a m1 Se adaptó a m2 */

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue