Home>
I don't understand when studying Java, but create a getUserAge method with the return value and call it with the main method. >
Ten years later, I'm 30!
I want to output and I am in trouble.
I would appreciate any solution.
Source code
↓
public class Main {
static int getUserAge () {
int num = 20;
return num;
}
public static void main (String [] args) {
System.out.println ("10 years later" + getUserAge () + "I'm old!");
}
}
-
Answer # 1
-
Answer # 2
System.out.println ("I'm 30 years old in 10 years!");
Related articles
- java - the value is not reflected because the return value is not assigned to the variable
- java method, return value
- java - send method return value to servlet with jsp
- how to specify the return value of java recursive processing
- c - it's a problem that seems to use the return value
- java - i want to use the return value of one method in another
- problem that the return value when sizeof () of buffer pointer is different in c language
- java - cannot get value from postgresql
- should mcast() return value be cast
- java - i don't know the cause of the error "this method must return a result of type ○○○○"
- [java] [enum] what does it mean that true/false is written in the enum value declaration?
- java i want to change the format of the value called from a different file
- vbscript - is there a way to get the return value by launching an application created in vbnet from vbsctipt?
- java - i want to use the value set in applicationyml in the domain
- asynchronous processing - in the dart asynchronous process, the return value unexpectedly becomes future type
- java - when you do not want to change the value of the property (field)
- java - receive a specific value in param method of mockmvc and want to test post method of controller class
- java - passing by value and calling methods
- pass by value of java array variable
- java - i have a question about a problem with interface
Trends