---
title: "How to call a void method from another class"  
description: "How to call a void method from another class"  
author: "Anonymous User"  
published: 2014-11-05  
updated: 2014-11-05  
canonical: https://www.mindstick.com/forum/2520/how-to-call-a-void-method-from-another-class  
category: "java"  
tags: ["class", "void"]  
reading_time: 2 minutes  

---

# How to call a void method from another class

I would like to call the [public void](https://www.mindstick.com/interview/2715/can-we-write-static-public-void-instead-of-public-static-void) display() from another [class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp) but i don't know how please help me this my [program](https://www.mindstick.com/blog/12337/scaling-up-your-mentorship-program):\

```
public class SignalMap{    private boolean[][] signal;    private double threshold;    private Network net;    private int size;     public SignalMap(Network net, double threshold, int size)    {        this.net = net;        this.threshold = threshold;        signal = new boolean[size][size];         for(int i = 0; i < size; i++)            {                           for(int j = 0; j < size; j++)                {                    if(net.getSignal(i, j) >= threshold)                    {                        signal[i][j] = false;                    }                    else                    {                        signal[i][j] = true;                    }                }            }    }     public void display()    {        for(int i = 0; i < size; i++)            {                           for(int j = 0; j < size; j++)                {                    if (signal[i][j].equals(true))                    {                        System.out.printf("%5d ", signal[i][j]);                    }                  }                System.out.println();            }       }    public double poorSignal()    {        int x = 0;        for (int i = 0; i < size; i++)        {            for (int j = 0; j < size; j++)            {                if (signal[i][j] == true)                {                    x = x + 1;                }            }        }        return 1 / (size / x);    }}
```

\

Please help tell [me if](https://answers.mindstick.com/qa/50259/tell-me-if-your-system-is-infected-by-a-virus-how-you-will-recover-the-data) I am doing [something wrong](https://www.mindstick.com/forum/12790/something-wrong-with-gridview). This is the [question](https://www.mindstick.com/blog/23175/how-to-solve-neet-question-paper-in-less-time) i have to answer : Write a [method](https://www.mindstick.com/forum/166/webservice-method) display in the SignalMap class which prints the array showing those areas which have poor [signal](https://www.mindstick.com/news/2024/elon-musk-and-twitter-are-now-fighting-about-signal-messages) (for example, display an X if the signal is poor).\

## Replies

### Reply by Anonymous User

Just create instance of SignalMap and call display.

```
public class MainClass {
    public static void main(String args[]) {
         SignalMap signalMap = new SignalMap();
         signalMap.display();
    }
}
```


---

Original Source: https://www.mindstick.com/forum/2520/how-to-call-a-void-method-from-another-class

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
