mirror of
https://github.com/revanced/smali.git
synced 2025-04-29 22:24:26 +02:00
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:
parent
0900e0040e
commit
b03e029611
5
examples/Interface/Interface.smali
Normal file
5
examples/Interface/Interface.smali
Normal file
@ -0,0 +1,5 @@
|
||||
.class public abstract interface LInterface;
|
||||
.super Ljava/lang/Object;
|
||||
|
||||
.method public abstract interfaceMethod()Ljava/lang/String;
|
||||
.end method
|
35
examples/Interface/Main.smali
Normal file
35
examples/Interface/Main.smali
Normal 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
|
Loading…
x
Reference in New Issue
Block a user