public static void main ( String args [ ] ) {
  Node head = newNode ( 1 ) ;
  head . next = newNode ( 2 ) ;
  head . next . next = newNode ( 3 ) ;
  head . next . next . next = newNode ( 4 ) ;
  System . out . print ( isCircular ( head ) ? "Yes\n" : "No\n" ) ;
  head . next . next . next . next = head ;
  System . out . print ( isCircular ( head ) ? "Yes\n" : "No\n" ) ;
}

public static void main ( String args [ ] ) { Node head = newNode ( 1 ) ; head . next = newNode ( 2 ) ; head . next . next = newNode ( 3 ) ; head . next . next . next = newNode ( 4 ) ; System . out . print ( isCircular ( head ) ? " Yes \n " : " No \n " ) ; head . next . next . next . next = head ; System . out . print ( isCircular ( head ) ? " Yes \n " : " No \n " ) ; }
(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: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (expression_statement (assignment_expression left: (field_access object: (identifier) field: (identifier)) right: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (expression_statement (assignment_expression left: (field_access object: (field_access object: (identifier) field: (identifier)) field: (identifier)) right: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (expression_statement (assignment_expression left: (field_access object: (field_access object: (field_access object: (identifier) field: (identifier)) field: (identifier)) field: (identifier)) right: (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 (ternary_expression condition: (method_invocation name: (identifier) arguments: (argument_list (identifier))) consequence: (string_literal) alternative: (string_literal))))) (expression_statement (assignment_expression left: (field_access object: (field_access object: (field_access object: (field_access object: (identifier) field: (identifier)) field: (identifier)) field: (identifier)) field: (identifier)) right: (identifier))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (ternary_expression condition: (method_invocation name: (identifier) arguments: (argument_list (identifier))) consequence: (string_literal) alternative: (string_literal)))))))