Shuta Shuta - 2 months ago 27
Java Question

Consecutive run programming

I want to show the sentence "Hello" that is after finish process of

main
method:


  1. input name and it's correct,

  2. ask age, and

  3. correct going to sentence "booting up"



which means I want to run method consecutively.

I only could run main method and not to be able to show the sentence "Hello".

How could I fix this problem?

enter image description here

Answer

I believe what you want to do is call the hello method at the end of your main method. Also you are missing a } after System.out.println("Hello");

Something like this:

public class YourClassName {
    public static void main (String [] theArgs){
        //your code here ....
        hello();
    }
    public static void Hello(){
        System.out.println("Hello");
    }

}
Comments