added an example showing the creation and usage of an interface

git-svn-id: https://smali.googlecode.com/svn/trunk@91 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com 2009-06-05 05:15:24 +00:00
parent 0900e0040e
commit b03e029611
2 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,5 @@
.class public abstract interface LInterface;
.super Ljava/lang/Object;
.method public abstract interfaceMethod()Ljava/lang/String;
.end method

View File

@ -0,0 +1,35 @@
.class public LMain;
.super Ljava/lang/Object;
.implements LInterface;
#expected output:
#in interfaceMethod()
.method public constructor <init>()V
.registers 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static main([Ljava/lang/String;)V
.registers 3
sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream;
new-instance v1, LMain;
invoke-direct {v1}, LMain;-><init>()V
invoke-interface {v1}, LInterface;->interfaceMethod()Ljava/lang/String;
move-result-object v1
invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
return-void
.end method
.method public interfaceMethod()Ljava/lang/String;
.registers 1
const-string v0, "in interfaceMethod()"
return-object v0
.end method