---
title: Avoid prefix boolean returning method with `get`
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > Code Security > Static Code Analysis (SAST) > SAST
  Rules > Avoid prefix boolean returning method with `get`
---

# Avoid prefix boolean returning method with `get`

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site). ().
{% /alert %}

{% /callout %}

## Metadata{% #metadata %}

**ID:** `java-code-style/boolean-get-method-name`

**Language:** Java

**Severity:** Notice

**Category:** Code Style

## Description{% #description %}

To improve readability, methods that return a boolean should be named accordingly. Instead of prefixing a method with `get`, consider using `is`, `has`, `can`, or `will` .

## Non-Compliant Code Examples{% #non-compliant-code-examples %}

```java
public class Foo {
    public boolean getFoo(); // you are not getting foo
}
```

## Compliant Code Examples{% #compliant-code-examples %}

```java
public class Foo {
    public boolean isFoo();
}
```
  Seamless integrations. Try Datadog Code SecurityDatadog Code Security 
{% icon name="icon-external-link" /%}
 