Quantcast
Channel: Active questions tagged return-value - Stack Overflow
Viewing all articles
Browse latest Browse all 207

What does it mean to return a value?

$
0
0

I'm fairly new to programming, and I'm confused about what it means exactly to return a value. At first, I thought it meant to output what value is being returned, but when I tried that in my own code, nothing happened.

class Class1 {    public static int x = 3;    public static int getX(){        return x;    }    public static void main(String[] args){        Class1.getX();    }}

This is an example of what I mean. When I run the program, nothing shows up. Considering this, I'm led to believe returning a value means something else. But what?


Viewing all articles
Browse latest Browse all 207

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>