<BlockSwitcher>
<Block name="Java">

```java
Amplify.DataStore.query(Comment.class, Post.STATUS.eq(PostStatus.ACTIVE),
    matches -> {
        while (matches.hasNext()) {
            Comment comment = matches.next();
            Log.i("MyAmplifyApp", "Content: " + comment.getContent());
        }
    },
    failure -> Log.e("MyAmplifyApp", "Query failed.", failure)
);
```

</Block>
<Block name="Kotlin - Callbacks">

```kotlin
Amplify.DataStore.query(Comment::class.java, Post.STATUS.eq(PostStatus.ACTIVE),
    { matches ->
        while (matches.hasNext()) {
            val comment = matches.next()
            Log.i("MyAmplifyApp", "Content: ${comment.content}")
        }
    },
    { Log.e("MyAmplifyApp", "Query failed", it) }
)
```

</Block>
<Block name="Kotlin - Coroutines">

```kotlin
Amplify.DataStore
    .query(Comment::class, Where.matches(Post.STATUS.eq(PostStatus.ACTIVE)))
    .catch { Log.e("MyAmplifyApp", "Query failed", it) }
    .collect { Log.i("MyAmplifyApp", "Content: ${it.content}") }
```

</Block>
<Block name="RxJava">

```java
RxAmplify.DataStore.query(Comment.class, Post.STATUS.eq(PostStatus.ACTIVE))
    .subscribe(
        comment -> Log.i("MyAmplifyApp", "Content: " + comment.getContent()),
        failure -> Log.e("MyAmplifyApp", "Query failed.", failure)
    );
```

</Block>
</BlockSwitcher>
