source: java2python/core/src/test/java/testcode/SelfReference.java

Last change on this file was 653, checked in by wouter, 12 months ago

use toString to avoid auto bracketing

File size: 462 bytes
Line 
1package testcode;
2
3/**
4 * Class that refers to itself for the {@link #next()} return type
5 *
6 */
7public class SelfReference {
8
9 private Integer num;
10
11 public SelfReference(Integer n) {
12 this.num = n;
13 }
14
15 public SelfReference next() {
16 return new SelfReference(num + 1);
17 }
18
19 @Override
20 public String toString() {
21 return num.toString();
22 }
23
24 static public void main(String[] args) {
25 // simple print
26 System.out.println(new SelfReference(1).next());
27 }
28
29}
Note: See TracBrowser for help on using the repository browser.