Commit | Line | Data |
---|---|---|
7213f6d6 JJ |
1 | // jprint.java test program. |
2 | // | |
3 | // Copyright 2004 | |
4 | // Free Software Foundation, Inc. | |
5 | // | |
6 | // Written by Jeff Johnston <jjohnstn@redhat.com> | |
7 | // Contributed by Red Hat | |
8 | // | |
9 | // This file is part of GDB. | |
10 | // | |
11 | // This program is free software; you can redistribute it and/or modify | |
12 | // it under the terms of the GNU General Public License as published by | |
13 | // the Free Software Foundation; either version 2 of the License, or | |
14 | // (at your option) any later version. | |
15 | // | |
16 | // This program is distributed in the hope that it will be useful, | |
17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | // GNU General Public License for more details. | |
20 | // | |
21 | // You should have received a copy of the GNU General Public License | |
22 | // along with this program; if not, write to the Free Software | |
23 | // Foundation, Inc., 59 Temple Place - Suite 330, | |
24 | // Boston, MA 02111-1307, USA. | |
25 | ||
26 | class jvclass { | |
27 | public static int k; | |
28 | static { | |
29 | k = 77; | |
30 | } | |
31 | public static void addprint (int x, int y, int z) { | |
32 | int sum = x + y + z; | |
33 | System.out.println ("sum is " + sum); | |
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 { | |
44 | public int dothat (int x) { | |
45 | int y = x + 3; | |
46 | System.out.println ("new value is " + y); | |
47 | return y + 4; | |
48 | } | |
49 | public static void print (int x) { | |
50 | System.out.println("x is " + x); | |
51 | } | |
52 | public static void print (int x, int y) { | |
53 | System.out.println("y is " + y); | |
54 | } | |
55 | public static void main(String[] args) { | |
56 | jprint x = new jprint (); | |
dc5000e7 | 57 | x.dothat (44); |
7213f6d6 JJ |
58 | print (k, 33); |
59 | } | |
60 | } | |
61 | ||
62 |