]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.java/jprint.java
Update years in copyright notice for the GDB files.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.java / jprint.java
1 // jprint.java test program.
2 //
3 // Copyright 2004-2013 Free Software Foundation, Inc.
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
12 // the Free Software Foundation; either version 3 of the License, or
13 // (at your option) any later version.
14 //
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.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22
23 import java.util.Properties;
24
25 class jvclass {
26 public static int k;
27 static {
28 k = 77;
29 }
30 public static int addprint (int x, int y, int z) {
31 int sum = x + y + z;
32 System.out.println ("sum is " + sum);
33 return 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 static Properties props = new Properties ();
45 public static String hi = "hi maude";
46
47 public int dothat (int x) {
48 int y = x + 3;
49 System.out.println ("new value is " + y);
50 return y + 4;
51 }
52 public static int print (int x) {
53 System.out.println("x is " + x);
54 return x;
55 }
56 public static int print (int x, int y) {
57 System.out.println("y is " + y);
58 return y;
59 }
60 public static void main(String[] args) {
61 jprint x = new jprint ();
62 x.dothat (44);
63 print (k, 33);
64 print (x.addk(0), 33);
65 }
66 }
67
68