public static void main ( String args [ ] ) {
  Node head = null ;
  head = insertEnd ( head , getNode ( 1 ) ) ;
  head = insertEnd ( head , getNode ( 2 ) ) ;
  head = insertEnd ( head , getNode ( 3 ) ) ;
  head = insertEnd ( head , getNode ( 4 ) ) ;
  head = insertEnd ( head , getNode ( 5 ) ) ;
  System . out . print ( "Current list:\n" ) ;
  display ( head ) ;
  head = reverse ( head ) ;
  System . out . print ( "\n\nReversed list:\n" ) ;
  display ( head ) ;
}

public static void main ( String args [ ] ) { Node head = null ; head = insertEnd ( head , getNode ( 1 ) ) ; head = insertEnd ( head , getNode ( 2 ) ) ; head = insertEnd ( head , getNode ( 3 ) ) ; head = insertEnd ( head , getNode ( 4 ) ) ; head = insertEnd ( head , getNode ( 5 ) ) ; System . out . print ( " Current ▁ list : \n " ) ; display ( head ) ; head = reverse ( head ) ; System . out . print ( " \n \n Reversed ▁ list : \n " ) ; display ( head ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (null_literal))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier))))))