Beginner: Can you call methods like this?

I want to know if you can call a method from inside a method, and then, when the called method is finished, the code starts running again from the point directly after this finished method was called. Example: public class Name{ public static void main(String args[]){ System.out.print("A"); example(); System.out.print("C"); //I want it to return to this point, after finishing the called method } public static void example(){ System.out.print("B"); } }
5 Replies
JavaBot
JavaBot10mo ago
This post has been reserved for your question.
Hey @OtáviobzDuplo! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
JavaBot
JavaBot10mo ago
Please format your code to make it more readable. For java, it should look like this:
​`​`​`​java
public void foo() {

}
​`​`​`​
​`​`​`​java
public void foo() {

}
​`​`​`​
dan1st
dan1st10mo ago
yes this is exactly what that code does When a method call completes, it continues after it
OtáviobzDuplo
OtáviobzDuploOP10mo ago
Lmao it was something dumb in my code, forget it
JavaBot
JavaBot10mo ago
Post Closed
This post has been closed by <@701256802821734413>.
Want results from more Discord servers?
Add your server