Respuesta :

Answer:

The code after rearrange the question segment:

public class Q// Class declaration of Q name.

{// Open the class body.

     public static void main(String[] a) // Main function declaration.

{ //Open the main-function body.

            System.out.println("Q"); // Print statement which print Q.

} //close the main-function body.

}//close the class body.

Output:

Q

Explanation:

The correct form of the question segment is written in the answer part. Now, this program can print Q. The syntax used above is described below--

  1. Firstly the user needs to define the class so the class declaration statement is defined above.
  2. Then the user needs to open the braces to tell the compiler about the body of the class
  3. Then the user needs to define the main function which tells the compiler that the execution starts from there.
  4. Then the user needs to open the braces to tell the compiler about the body of the main function.
  5. Then the user needs to define the print statement which helps to print 'Q'.
  6. Then the user needs to close the braces to tell the compiler that the main function body id closed.
  7. Then the user needs to close the braces to tell the compiler that the class body id closed.