Commit | Line | Data |
---|---|---|
7213f6d6 JJ |
1 | // jprint.java test program. |
2 | // | |
8acc9f48 | 3 | // Copyright 2004-2013 Free Software Foundation, Inc. |
7213f6d6 JJ |
4 | // |
5 | // Written by Jeff Johnston <jjohnstn@redhat.com> | |
6 | // Contributed by Red Hat | |
7 | // | |
8 | // This file is part of GDB. | |
9 | // | |
10 | // This program is free software; you can redistribute it and/or modify | |
11 | // it under the terms of the GNU General Public License as published by | |
d53a7b30 | 12 | // the Free Software Foundation; either version 3 of the License, or |
7213f6d6 | 13 | // (at your option) any later version. |
d53a7b30 | 14 | // |
7213f6d6 JJ |
15 | // This program is distributed in the hope that it will be useful, |
16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | // GNU General Public License for more details. | |
d53a7b30 | 19 | // |
7213f6d6 | 20 | // You should have received a copy of the GNU General Public License |
d53a7b30 | 21 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
7213f6d6 | 22 | |
6f451e5e TT |
23 | import java.util.Properties; |
24 | ||
7213f6d6 JJ |
25 | class jvclass { |
26 | public static int k; | |
27 | static { | |
28 | k = 77; | |
29 | } | |
eb5227ce | 30 | public static int addprint (int x, int y, int z) { |
7213f6d6 JJ |
31 | int sum = x + y + z; |
32 | System.out.println ("sum is " + sum); | |
eb5227ce | 33 | return sum; |
7213f6d6 JJ |
34 | } |
35 | ||
36 | public int addk (int x) { | |
37 | int sum = x + k; | |
38 | System.out.println ("adding k gives " + sum); | |
39 | return sum; | |
40 | } | |
41 | } | |
42 | ||
43 | public class jprint extends jvclass { | |
6f451e5e | 44 | public static Properties props = new Properties (); |
eb2a6f42 | 45 | public static String hi = "hi maude"; |
6f451e5e | 46 | |
7213f6d6 JJ |
47 | public int dothat (int x) { |
48 | int y = x + 3; | |
49 | System.out.println ("new value is " + y); | |
50 | return y + 4; | |
51 | } | |
eb5227ce | 52 | public static int print (int x) { |
7213f6d6 | 53 | System.out.println("x is " + x); |
eb5227ce | 54 | return x; |
7213f6d6 | 55 | } |
eb5227ce | 56 | public static int print (int x, int y) { |
7213f6d6 | 57 | System.out.println("y is " + y); |
eb5227ce | 58 | return y; |
7213f6d6 JJ |
59 | } |
60 | public static void main(String[] args) { | |
61 | jprint x = new jprint (); | |
dc5000e7 | 62 | x.dothat (44); |
7213f6d6 | 63 | print (k, 33); |
b7b189f3 | 64 | print (x.addk(0), 33); |
7213f6d6 JJ |
65 | } |
66 | } | |
67 | ||
68 |